tests: add mkdir.test

* tests/mkdir.c: New file.
* tests/mkdir.test: New test.
* tests/.gitignore: Add mkdir.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add mkdir.test.
This commit is contained in:
Fei Jie 2016-04-21 15:53:49 +08:00 committed by Dmitry V. Levin
parent 8bfe0d5e22
commit 5c1776fe00
4 changed files with 36 additions and 0 deletions

1
tests/.gitignore vendored
View File

@ -99,6 +99,7 @@ lstat64
membarrier
memfd_create
mincore
mkdir
mkdirat
mknod
mlock2

View File

@ -150,6 +150,7 @@ check_PROGRAMS = \
membarrier \
memfd_create \
mincore \
mkdir \
mkdirat \
mknod \
mlock2 \
@ -395,6 +396,7 @@ DECODER_TESTS = \
membarrier.test \
memfd_create.test \
mincore.test \
mkdir.test \
mkdirat.test \
mknod.test \
mlock2.test \

27
tests/mkdir.c Normal file
View File

@ -0,0 +1,27 @@
#include "tests.h"
#include <sys/syscall.h>
#ifdef __NR_mkdir
# include <errno.h>
# include <stdio.h>
# include <unistd.h>
int
main(void)
{
static const char sample[] = "mkdir";
long rc = syscall(__NR_mkdir, sample, 0600);
printf("mkdir(\"%s\", 0600) = %ld %s (%m)\n",
sample, rc, errno == ENOSYS ? "ENOSYS" : "EEXIST");
puts("+++ exited with 0 +++");
return 0;
}
#else
SKIP_MAIN_UNDEFINED("__NR_mkdir")
#endif

6
tests/mkdir.test Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
# Check mkdir syscall decoding.
. "${srcdir=.}/init.sh"
run_strace_match_diff -a21