* sim/cris/c/access1.c: New test.
authorHans-Peter Nilsson <hp@axis.com>
Sat, 3 Jan 2009 18:38:27 +0000 (18:38 +0000)
committerHans-Peter Nilsson <hp@axis.com>
Sat, 3 Jan 2009 18:38:27 +0000 (18:38 +0000)
sim/testsuite/ChangeLog
sim/testsuite/sim/cris/c/access1.c [new file with mode: 0644]

index e3cfea94e60d42dde3b33e73dc8ff2985735ed13..d5bc103e1bd6e2418ff3649a0c8183977ed11ed6 100644 (file)
@@ -1,5 +1,6 @@
 2009-01-03  Hans-Peter Nilsson  <hp@axis.com>
 
+       * sim/cris/c/access1.c: New test.
        * sim/cris/asm/pid1.ms: New test.
 
 2008-12-30  Hans-Peter Nilsson  <hp@axis.com>
diff --git a/sim/testsuite/sim/cris/c/access1.c b/sim/testsuite/sim/cris/c/access1.c
new file mode 100644 (file)
index 0000000..ba9be34
--- /dev/null
@@ -0,0 +1,16 @@
+/* Check access(2) trivially.  Newlib doesn't have it.
+#notarget: cris*-*-elf
+*/
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+int main (int argc, char **argv)
+{
+  if (access (argv[0], R_OK|W_OK|X_OK) == 0
+      && access ("/dev/null", R_OK|W_OK) == 0
+      && access ("/dev/null", X_OK) == -1
+      && errno == EACCES)
+    printf ("pass\n");
+  exit (0);
+}