]> granicus.if.org Git - strace/commitdiff
tests: add personality.test
authorDmitry V. Levin <ldv@altlinux.org>
Fri, 25 Dec 2015 00:52:42 +0000 (00:52 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Fri, 25 Dec 2015 02:27:06 +0000 (02:27 +0000)
* tests/personality.c: New file.
* tests/personality.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add personality.
(TESTS): Add personality.test.
* tests/.gitignore: Add personality.

tests/.gitignore
tests/Makefile.am
tests/personality.c [new file with mode: 0644]
tests/personality.test [new file with mode: 0755]

index bfd34b40b8faac78670030dcdb84d52f3f159998..b4d1df9a11470e6ffc661cfbf396727ba200738b 100644 (file)
@@ -57,6 +57,7 @@ netlink_unix_diag
 newfstatat
 oldselect
 pc
+personality
 pipe
 ppoll
 pselect6
index 0f23b4b4e72b45a75765ce541e1a2e1f15b27531..c54fdf342758b58ad2547db74c08dd11944828f3 100644 (file)
@@ -91,6 +91,7 @@ check_PROGRAMS = \
        newfstatat \
        oldselect \
        pc \
+       personality \
        pipe \
        ppoll \
        pselect6 \
@@ -216,6 +217,7 @@ TESTS = \
        newfstatat.test \
        oldselect.test \
        pc.test \
+       personality.test \
        pipe.test \
        ppoll.test \
        pselect6.test \
diff --git a/tests/personality.c b/tests/personality.c
new file mode 100644 (file)
index 0000000..82200fa
--- /dev/null
@@ -0,0 +1,20 @@
+#include <stdio.h>
+#include <sys/personality.h>
+
+int main(void)
+{
+       const unsigned int test_pers =
+               SHORT_INODE | WHOLE_SECONDS | STICKY_TIMEOUTS;
+       const unsigned int saved_pers = personality(0);
+
+       printf("personality\\(PER_LINUX\\) = %#x \\([^)]*\\)\n", saved_pers);
+       personality(test_pers);
+       puts("personality\\(SHORT_INODE\\|WHOLE_SECONDS\\|STICKY_TIMEOUTS\\)"
+            " = 0 \\(PER_LINUX\\)");
+       personality(saved_pers);
+       printf("personality\\([^)]*\\) = %#x"
+              " \\(SHORT_INODE\\|WHOLE_SECONDS\\|STICKY_TIMEOUTS\\)\n",
+              test_pers);
+
+       return 0;
+}
diff --git a/tests/personality.test b/tests/personality.test
new file mode 100755 (executable)
index 0000000..b4329c0
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# Check personality syscall decoding.
+
+. "${srcdir=.}/init.sh"
+
+run_prog > /dev/null
+OUT="$LOG.out"
+run_strace -a22 -epersonality $args > "$OUT"
+match_grep "$LOG" "$OUT"
+rm -f "$OUT"
+
+exit 0