tests: add access.test

* tests/access.c: New file.
* tests/access.test: New test.
* tests/.gitignore: Add access.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add access.test.
diff --git a/tests/.gitignore b/tests/.gitignore
index e33c009..248110c 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -6,6 +6,7 @@
 *.tmp.*
 *.trs
 _newselect
+access
 acct
 adjtimex
 aio
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 08889a5..1113972 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -59,6 +59,7 @@
 
 check_PROGRAMS = \
 	_newselect \
+	access \
 	acct \
 	adjtimex \
 	aio \
@@ -313,6 +314,7 @@
 
 DECODER_TESTS = \
 	_newselect.test \
+	access.test \
 	acct.test \
 	adjtimex.test \
 	aio.test \
diff --git a/tests/access.c b/tests/access.c
new file mode 100644
index 0000000..aeb3a79
--- /dev/null
+++ b/tests/access.c
@@ -0,0 +1,30 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_access
+
+# include <errno.h>
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	static const char sample[] = "access_sample";
+
+	long rc = syscall(__NR_access, sample, F_OK);
+	printf("access(\"%s\", F_OK) = %ld %s (%m)\n",
+	       sample, rc, errno == ENOSYS ? "ENOSYS" : "ENOENT");
+
+	rc = syscall(__NR_access, sample, R_OK|W_OK|X_OK);
+	printf("access(\"%s\", R_OK|W_OK|X_OK) = %ld %s (%m)\n",
+	       sample, rc, errno == ENOSYS ? "ENOSYS" : "ENOENT");
+
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_access")
+
+#endif
diff --git a/tests/access.test b/tests/access.test
new file mode 100755
index 0000000..3ab2eb4
--- /dev/null
+++ b/tests/access.test
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Check access syscall decoding.
+
+. "${srcdir=.}/init.sh"
+
+check_prog grep
+run_prog > /dev/null
+run_strace -eaccess -a30 $args > "$EXP"
+
+# Filter out access() calls made by libc.
+grep -F access_sample < "$LOG" > "$OUT"
+match_diff "$OUT" "$EXP"
+
+rm -f "$EXP" "$OUT"