tests: add umask.test

* tests/umask.c: New file.
* tests/umask.test: New test.
* tests/.gitignore: Add umask.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(TESTS): Add umask.test.
This commit is contained in:
Fei Jie 2016-03-01 16:55:37 +08:00 committed by Dmitry V. Levin
parent a4128a75f5
commit eee3476844
4 changed files with 26 additions and 0 deletions

1
tests/.gitignore vendored
View File

@ -121,6 +121,7 @@ uid
uid16
uid32
uio
umask
umount
umount2
umovestr

View File

@ -169,6 +169,7 @@ check_PROGRAMS = \
uid16 \
uid32 \
uio \
umask \
umount \
umount2 \
umovestr \
@ -325,6 +326,7 @@ TESTS = \
uid16.test \
uid32.test \
uio.test \
umask.test \
umount.test \
umount2.test \
umovestr.test \

12
tests/umask.c Normal file
View File

@ -0,0 +1,12 @@
#include <stdio.h>
#include <sys/stat.h>
int
main(void)
{
mode_t rc = umask(044);
printf("umask(%#o) = %#o\n", 044, rc);
puts("+++ exited with 0 +++");
return 0;
}

11
tests/umask.test Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
# Check umask syscall decoding.
. "${srcdir=.}/init.sh"
run_prog > /dev/null
OUT="$LOG.out"
run_strace -eumask -a11 $args > "$OUT"
match_diff "$LOG" "$OUT"
rm -f "$OUT"