diff options
author | Dmitry V. Levin <ldv@altlinux.org> | 2015-12-25 00:52:42 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2015-12-25 02:27:06 +0000 |
commit | f7423af0df9d7126032a487375f76e2ac78732cf (patch) | |
tree | a0faa091201b2eaf91928b16d0c7af9b67ff698e | |
parent | 97cbf69756ef371853280574962f3fec05c7461e (diff) | |
download | strace-f7423af0df9d7126032a487375f76e2ac78732cf.tar.gz |
tests: add personality.test
* 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.
-rw-r--r-- | tests/.gitignore | 1 | ||||
-rw-r--r-- | tests/Makefile.am | 2 | ||||
-rw-r--r-- | tests/personality.c | 20 | ||||
-rwxr-xr-x | tests/personality.test | 13 |
4 files changed, 36 insertions, 0 deletions
diff --git a/tests/.gitignore b/tests/.gitignore index bfd34b40..b4d1df9a 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -57,6 +57,7 @@ netlink_unix_diag newfstatat oldselect pc +personality pipe ppoll pselect6 diff --git a/tests/Makefile.am b/tests/Makefile.am index 0f23b4b4..c54fdf34 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 index 00000000..82200fa1 --- /dev/null +++ b/tests/personality.c @@ -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 index 00000000..b4329c0c --- /dev/null +++ b/tests/personality.test @@ -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 |