tests: add mount variants with different xlat verbosity levels

* tests/mount-Xabbrev.c: New file.
* tests/mount-Xraw.c: Likewise.
* tests/mount-Xverbose.c: Likewise.
* tests/mount.c: Add handling of XLAT_RAW and XLAT_VERBOSE macros.
* tests/pure_executables.list: Add mount-Xabbrev, mount-Xraw,
and mount-Xverbose.
* tests/.gitignore: Likewise.
* tests/gen_tests.in (mount-Xabbrev, mount-Xraw, mount-Xverbose): New
tests.
This commit is contained in:
Eugene Syromyatnikov 2018-04-04 23:03:26 +02:00 committed by Dmitry V. Levin
parent 42f1ccc867
commit 1f357a8f1a
7 changed files with 41 additions and 6 deletions

3
tests/.gitignore vendored
View File

@ -206,6 +206,9 @@ mmsg_name
mmsg_name-v
modify_ldt
mount
mount-Xabbrev
mount-Xraw
mount-Xverbose
move_pages
mq
mq_sendrecv

View File

@ -193,6 +193,9 @@ mmsg_name -a25 -e trace=sendmmsg,recvmmsg
mmsg_name-v -v -a25 -e trace=sendmmsg,recvmmsg
modify_ldt -a23
mount
mount-Xabbrev -e trace=mount -Xabbrev
mount-Xraw -e trace=mount -Xraw
mount-Xverbose -e trace=mount -Xverbose
move_pages -s3
mq -a32 -e trace=mq_getsetattr,mq_open,mq_unlink
mq_sendrecv -a14 -e trace=mq_open,mq_notify,mq_timedsend,mq_timedreceive,mq_unlink

1
tests/mount-Xabbrev.c Normal file
View File

@ -0,0 +1 @@
#include "mount.c"

2
tests/mount-Xraw.c Normal file
View File

@ -0,0 +1,2 @@
#define XLAT_RAW 1
#include "mount.c"

2
tests/mount-Xverbose.c Normal file
View File

@ -0,0 +1,2 @@
#define XLAT_VERBOSE 1
#include "mount.c"

View File

@ -40,7 +40,28 @@
# define MS_RELATIME (1ul << 21)
#endif
#define str_ro_nosuid_nodev_noexec "MS_RDONLY|MS_NOSUID|MS_NODEV|MS_NOEXEC"
#if XLAT_RAW
# define str_mgc_val "0xc0ed0000"
# define str_remount "0x20"
# define str_bind "0x1000"
# define str_ro_nosuid_nodev_noexec "0xf"
# define str_ro_nosuid_nodev_noexec_relatime "0x20000f"
#elif XLAT_VERBOSE
# define str_mgc_val "0xc0ed0000 /* MS_MGC_VAL */"
# define str_remount "0x20 /* MS_REMOUNT */"
# define str_bind "0x1000 /* MS_BIND */"
# define str_ro_nosuid_nodev_noexec \
"0xf /* MS_RDONLY|MS_NOSUID|MS_NODEV|MS_NOEXEC */"
# define str_ro_nosuid_nodev_noexec_relatime \
"0x20000f /* MS_RDONLY|MS_NOSUID|MS_NODEV|MS_NOEXEC|MS_RELATIME */"
#else /* !XLAT_RAW && !XLAT_VERBOSE */
# define str_mgc_val "MS_MGC_VAL"
# define str_remount "MS_REMOUNT"
# define str_bind "MS_BIND"
# define str_ro_nosuid_nodev_noexec "MS_RDONLY|MS_NOSUID|MS_NODEV|MS_NOEXEC"
# define str_ro_nosuid_nodev_noexec_relatime \
"MS_RDONLY|MS_NOSUID|MS_NODEV|MS_NOEXEC|MS_RELATIME"
#endif /* XLAT_RAW, XLAT_VERBOSE */
int
main(void)
@ -58,26 +79,26 @@ main(void)
rc = mount(source, target, fstype, MS_RELATIME | 15, data);
printf("mount(\"%s\", \"%s\", \"%s\", %s, \"%s\") = %d %s (%m)\n",
source, target, fstype,
str_ro_nosuid_nodev_noexec "|MS_RELATIME",
str_ro_nosuid_nodev_noexec_relatime,
data, rc, errno2name());
rc = mount(source, target, fstype, MS_MGC_VAL, data);
printf("mount(\"%s\", \"%s\", \"%s\", %s, \"%s\") = %d %s (%m)\n",
source, target, fstype, "MS_MGC_VAL", data, rc, errno2name());
source, target, fstype, str_mgc_val, data, rc, errno2name());
rc = mount(source, target, fstype, MS_MGC_VAL | 15, data);
printf("mount(\"%s\", \"%s\", \"%s\", %s, \"%s\") = %d %s (%m)\n",
source, target, fstype,
"MS_MGC_VAL|" str_ro_nosuid_nodev_noexec,
str_mgc_val "|" str_ro_nosuid_nodev_noexec,
data, rc, errno2name());
rc = mount(source, target, fstype, MS_REMOUNT, data);
printf("mount(\"%s\", \"%s\", %p, %s, \"%s\") = %d %s (%m)\n",
source, target, fstype, "MS_REMOUNT", data, rc, errno2name());
source, target, fstype, str_remount, data, rc, errno2name());
rc = mount(source, target, fstype, MS_BIND, data);
printf("mount(\"%s\", \"%s\", %p, %s, %p) = %d %s (%m)\n",
source, target, fstype, "MS_BIND", data, rc, errno2name());
source, target, fstype, str_bind, data, rc, errno2name());
puts("+++ exited with 0 +++");
return 0;

View File

@ -165,6 +165,9 @@ mmsg
mmsg_name
modify_ldt
mount
mount-Xabbrev
mount-Xraw
mount-Xverbose
move_pages
mq
mq_sendrecv