tests: add old_mmap variants with different xlat verbosity levels
* tests/old_mmap-Xabbrev.c: New file. * tests/old_mmap-Xraw.c: Likewise. * tests/old_mmap-Xverbose.c: Likewise. * tests/old_mmap.c (main): Add handling of XLAT_RAW and XLAT_VERBOSE macros. * tests/pure_executables.list: Add old_mmap-Xabbrev, old_mmap-Xraw, and old_mmap-Xverbose. * tests/.gitignore: Likewise. * tests/gen_tests.in (old_mmap-Xabbrev, old_mmap-Xraw, old_mmap-Xverbose): New tests.
This commit is contained in:
3
tests/.gitignore
vendored
3
tests/.gitignore
vendored
@ -284,6 +284,9 @@ nsyscalls-d
|
||||
old_mmap
|
||||
old_mmap-P
|
||||
old_mmap-v-none
|
||||
old_mmap-Xabbrev
|
||||
old_mmap-Xraw
|
||||
old_mmap-Xverbose
|
||||
oldfstat
|
||||
oldlstat
|
||||
oldselect
|
||||
|
@ -260,6 +260,9 @@ nlattr_unix_diag_msg +netlink_sock_diag.test
|
||||
old_mmap -a11 -e trace=mmap
|
||||
old_mmap-P -e trace=mmap -P "/dev/full" 9>>/dev/full
|
||||
old_mmap-v-none -a11 -e trace=mmap -e verbose=none
|
||||
old_mmap-Xabbrev -a11 -e trace=mmap -Xabbrev
|
||||
old_mmap-Xraw -a11 -e trace=mmap -Xraw
|
||||
old_mmap-Xverbose -a11 -e trace=mmap -Xverbose
|
||||
oldfstat -a18 -v -P stat.sample
|
||||
oldlstat -a32 -v -P stat.sample -P /dev/full
|
||||
oldselect -a13 -e trace=select
|
||||
|
1
tests/old_mmap-Xabbrev.c
Normal file
1
tests/old_mmap-Xabbrev.c
Normal file
@ -0,0 +1 @@
|
||||
#include "old_mmap.c"
|
2
tests/old_mmap-Xraw.c
Normal file
2
tests/old_mmap-Xraw.c
Normal file
@ -0,0 +1,2 @@
|
||||
#define XLAT_RAW 1
|
||||
#include "old_mmap.c"
|
2
tests/old_mmap-Xverbose.c
Normal file
2
tests/old_mmap-Xverbose.c
Normal file
@ -0,0 +1,2 @@
|
||||
#define XLAT_VERBOSE 1
|
||||
#include "old_mmap.c"
|
@ -79,17 +79,41 @@ main(void)
|
||||
void *args = tail_memdup(args1_c, sizeof(args1_c));
|
||||
|
||||
rc = syscall(__NR_mmap, args);
|
||||
# if XLAT_RAW
|
||||
printf("mmap(%#lx, %lu, %#x, %#x|%#x, %d, %#lx) = %ld %s (%m)\n",
|
||||
args1_c[0], args1_c[1], PROT_READ|PROT_EXEC, MAP_FILE, MAP_FIXED,
|
||||
(int) args1_c[4], args1_c[5], rc, errno2name());
|
||||
# elif XLAT_VERBOSE
|
||||
printf("mmap(%#lx, %lu, %#x /* PROT_READ|PROT_EXEC */"
|
||||
", %#x /* MAP_FILE */|%#x /* MAP_FIXED */"
|
||||
", %d, %#lx) = %ld %s (%m)\n",
|
||||
args1_c[0], args1_c[1], PROT_READ|PROT_EXEC, MAP_FILE, MAP_FIXED,
|
||||
(int) args1_c[4], args1_c[5], rc, errno2name());
|
||||
# else
|
||||
printf("mmap(%#lx, %lu, PROT_READ|PROT_EXEC, MAP_FILE|MAP_FIXED"
|
||||
", %d, %#lx) = %ld %s (%m)\n",
|
||||
args1_c[0], args1_c[1], (int) args1_c[4], args1_c[5],
|
||||
rc, errno2name());
|
||||
# endif
|
||||
|
||||
memcpy(args, args2_c, sizeof(args2_c));
|
||||
rc = syscall(__NR_mmap, args);
|
||||
# ifndef PATH_TRACING
|
||||
# if XLAT_RAW
|
||||
printf("mmap(NULL, %lu, %#x, %#x|%#x, %d, %#lx) = %#lx\n",
|
||||
args2_c[1], PROT_READ|PROT_WRITE, MAP_PRIVATE, MAP_ANONYMOUS,
|
||||
(int) args2_c[4], args2_c[5], rc);
|
||||
# elif XLAT_VERBOSE
|
||||
printf("mmap(NULL, %lu, %#x /* PROT_READ|PROT_WRITE */"
|
||||
", %#x /* MAP_PRIVATE */|%#x /* MAP_ANONYMOUS */"
|
||||
", %d, %#lx) = %#lx\n",
|
||||
args2_c[1], PROT_READ|PROT_WRITE, MAP_PRIVATE, MAP_ANONYMOUS,
|
||||
(int) args2_c[4], args2_c[5], rc);
|
||||
# else
|
||||
printf("mmap(NULL, %lu, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS"
|
||||
", %d, %#lx) = %#lx\n",
|
||||
args2_c[1], (int) args2_c[4], args2_c[5], rc);
|
||||
# endif
|
||||
# endif
|
||||
|
||||
void *addr = (void *) rc;
|
||||
|
@ -236,6 +236,9 @@ nlattr_unix_diag_msg
|
||||
old_mmap
|
||||
old_mmap-P
|
||||
old_mmap-v-none
|
||||
old_mmap-Xabbrev
|
||||
old_mmap-Xraw
|
||||
old_mmap-Xverbose
|
||||
oldfstat
|
||||
oldlstat
|
||||
oldselect
|
||||
|
Reference in New Issue
Block a user