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.
This commit is contained in:
1
tests/.gitignore
vendored
1
tests/.gitignore
vendored
@ -57,6 +57,7 @@ netlink_unix_diag
|
|||||||
newfstatat
|
newfstatat
|
||||||
oldselect
|
oldselect
|
||||||
pc
|
pc
|
||||||
|
personality
|
||||||
pipe
|
pipe
|
||||||
ppoll
|
ppoll
|
||||||
pselect6
|
pselect6
|
||||||
|
@ -91,6 +91,7 @@ check_PROGRAMS = \
|
|||||||
newfstatat \
|
newfstatat \
|
||||||
oldselect \
|
oldselect \
|
||||||
pc \
|
pc \
|
||||||
|
personality \
|
||||||
pipe \
|
pipe \
|
||||||
ppoll \
|
ppoll \
|
||||||
pselect6 \
|
pselect6 \
|
||||||
@ -216,6 +217,7 @@ TESTS = \
|
|||||||
newfstatat.test \
|
newfstatat.test \
|
||||||
oldselect.test \
|
oldselect.test \
|
||||||
pc.test \
|
pc.test \
|
||||||
|
personality.test \
|
||||||
pipe.test \
|
pipe.test \
|
||||||
ppoll.test \
|
ppoll.test \
|
||||||
pselect6.test \
|
pselect6.test \
|
||||||
|
20
tests/personality.c
Normal file
20
tests/personality.c
Normal file
@ -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;
|
||||||
|
}
|
13
tests/personality.test
Executable file
13
tests/personality.test
Executable file
@ -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
|
Reference in New Issue
Block a user