diff options
author | Fei Jie <feij.fnst@cn.fujitsu.com> | 2016-04-21 15:53:51 +0800 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2016-04-21 17:37:43 +0000 |
commit | f914194fc39c4ff3b1537372976783898bffc466 (patch) | |
tree | 956832c3054635017ddf483fc40ba33ba92b41d5 /tests/access.c | |
parent | e0057a578f25c8a5f611d0fb43d6b67fb8d80bf1 (diff) | |
download | strace-f914194fc39c4ff3b1537372976783898bffc466.tar.gz |
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.
Diffstat (limited to 'tests/access.c')
-rw-r--r-- | tests/access.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/access.c b/tests/access.c new file mode 100644 index 000000000..aeb3a791b --- /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 |