tests: add mknod.test
* tests/mknod.c: New file. * tests/mknod.test: New test. * tests/.gitignore: Add mknod. * tests/Makefile.am (check_PROGRAMS): Likewise. (DECODER_TESTS): Add mknod.test.
This commit is contained in:
parent
9a88371122
commit
0ebe67b780
1
tests/.gitignore
vendored
1
tests/.gitignore
vendored
@ -65,6 +65,7 @@ lstat64
|
||||
membarrier
|
||||
memfd_create
|
||||
mincore
|
||||
mknod
|
||||
mlock2
|
||||
mmap
|
||||
mmap64
|
||||
|
@ -114,6 +114,7 @@ check_PROGRAMS = \
|
||||
membarrier \
|
||||
memfd_create \
|
||||
mincore \
|
||||
mknod \
|
||||
mlock2 \
|
||||
mmap \
|
||||
mmap64 \
|
||||
@ -282,6 +283,7 @@ DECODER_TESTS = \
|
||||
membarrier.test \
|
||||
memfd_create.test \
|
||||
mincore.test \
|
||||
mknod.test \
|
||||
mlock2.test \
|
||||
mmap.test \
|
||||
mmap64.test \
|
||||
|
29
tests/mknod.c
Normal file
29
tests/mknod.c
Normal file
@ -0,0 +1,29 @@
|
||||
#include "tests.h"
|
||||
#include <sys/syscall.h>
|
||||
|
||||
#ifdef __NR_mknod
|
||||
|
||||
# include <errno.h>
|
||||
# include <stdio.h>
|
||||
# include <sys/stat.h>
|
||||
# include <unistd.h>
|
||||
|
||||
# define TMP_FILE "mknod"
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
int rc = syscall(__NR_mknod, TMP_FILE, S_IFREG|0600, 0);
|
||||
printf("mknod(\"%s\", S_IFREG|0600) = %d %s (%m)\n",
|
||||
TMP_FILE, rc,
|
||||
errno == ENOSYS ? "ENOSYS" : "EEXIST");
|
||||
|
||||
puts("+++ exited with 0 +++");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
SKIP_MAIN_UNDEFINED("__NR_mknod")
|
||||
|
||||
#endif
|
11
tests/mknod.test
Executable file
11
tests/mknod.test
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Check mknod syscall decoding.
|
||||
|
||||
. "${srcdir=.}/init.sh"
|
||||
|
||||
run_prog > /dev/null
|
||||
OUT="$LOG.out"
|
||||
run_strace -emknod -a29 $args > "$OUT"
|
||||
match_diff "$LOG" "$OUT"
|
||||
rm -f "$OUT"
|
Loading…
Reference in New Issue
Block a user