[PATCH 3/3] tests: add umask.test

Fei Jie feij.fnst at cn.fujitsu.com
Fri Feb 26 09:41:39 UTC 2016


* tests/umask.c: New file.
* tests/umask.test: New test.
* tests/.gitignore: Add umask.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(TESTS): Add umask.test.
---
 tests/.gitignore  |  1 +
 tests/Makefile.am |  2 ++
 tests/umask.c     | 25 +++++++++++++++++++++++++
 tests/umask.test  | 11 +++++++++++
 4 files changed, 39 insertions(+)
 create mode 100644 tests/umask.c
 create mode 100755 tests/umask.test

diff --git a/tests/.gitignore b/tests/.gitignore
index a5d586d..31b643c 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -121,6 +121,7 @@ uid
 uid16
 uid32
 uio
+umask
 umount
 umount2
 umovestr
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 4603c92..6ce2def 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -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 \
diff --git a/tests/umask.c b/tests/umask.c
new file mode 100644
index 0000000..badc6f5
--- /dev/null
+++ b/tests/umask.c
@@ -0,0 +1,25 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_umask
+
+# include <stdio.h>
+# include <sys/types.h>
+# include <sys/stat.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	mode_t rc = syscall(__NR_umask, 044);
+	printf("umask(0%o) = 0%o\n", 044, rc);
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_umask")
+
+#endif
diff --git a/tests/umask.test b/tests/umask.test
new file mode 100755
index 0000000..0fe6554
--- /dev/null
+++ b/tests/umask.test
@@ -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"
-- 
1.8.3.1







More information about the Strace-devel mailing list