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

Fei Jie feij.fnst at cn.fujitsu.com
Tue Mar 1 08:55:37 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     | 12 ++++++++++++
 tests/umask.test  | 11 +++++++++++
 4 files changed, 26 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..2dcea28
--- /dev/null
+++ b/tests/umask.c
@@ -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;
+}
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