aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Vanotti <mvanotti@google.com>2020-03-20 11:20:02 -0700
committerDmitry Vyukov <dvyukov@google.com>2020-03-21 07:02:15 +0100
commitaa6c6a5572a4797ea6109a75ca50a2c86908375e (patch)
tree1e7e8d579c9969bcf4d301a8e6da97319c2c38fb
parent2c31c529a9a44be5d99e769204b7a4b84b93eec1 (diff)
sys/fuchsia: Add cprng and vmo tests.
This commit adds two new tests for fuchsia. One tests a basic syscall (zx_cprng_draw), and the other does multiple tests over a vmo.
-rw-r--r--pkg/runtest/run.go3
-rw-r--r--sys/fuchsia/test/cprng2
-rw-r--r--sys/fuchsia/test/vmo5
3 files changed, 10 insertions, 0 deletions
diff --git a/pkg/runtest/run.go b/pkg/runtest/run.go
index 399fb2f49..7c2b1e6a4 100644
--- a/pkg/runtest/run.go
+++ b/pkg/runtest/run.go
@@ -291,6 +291,9 @@ func parseProg(target *prog.Target, dir, filename string) (*prog.Prog, map[strin
"EINVAL": 22,
"ENOTTY": 25,
"EOPNOTSUPP": 95,
+
+ // Fuchsia specific errors.
+ "ZX_ERR_BAD_HANDLE": 11,
}
info := &ipc.ProgInfo{Calls: make([]ipc.CallInfo, len(p.Calls))}
for i, call := range p.Calls {
diff --git a/sys/fuchsia/test/cprng b/sys/fuchsia/test/cprng
new file mode 100644
index 000000000..0b87bf8d6
--- /dev/null
+++ b/sys/fuchsia/test/cprng
@@ -0,0 +1,2 @@
+zx_cprng_draw(&(0x7f0000000000/0x100), 0x100)
+zx_cprng_draw(&(0x7f0000000000/0x1), 0x1)
diff --git a/sys/fuchsia/test/vmo b/sys/fuchsia/test/vmo
new file mode 100644
index 000000000..444e579d9
--- /dev/null
+++ b/sys/fuchsia/test/vmo
@@ -0,0 +1,5 @@
+zx_vmo_create(0x100, 0x0, &AUTO=<r0=>0x0)
+zx_vmo_write(r0, &AUTO="010101", 0x01, 0x4)
+zx_handle_close(r0)
+zx_vmo_write(r0, &AUTO="010101", 0x01, 0x4) # ZX_ERR_BAD_HANDLE
+zx_handle_close(r0) # ZX_ERR_BAD_HANDLE