tests: add more mount checks

* tests/gen_tests.in (mount, mount-Xabbrev, mount-Xraw, mount-Xverbose):
Add -a33 option.
* tests/mount.c: Check printing of flags and pointers.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
This commit is contained in:
Eugene Syromyatnikov 2018-04-04 23:25:19 +02:00 committed by Dmitry V. Levin
parent 8d5c37dbfd
commit 6dd265b961
2 changed files with 38 additions and 8 deletions

View File

@ -192,10 +192,10 @@ mmsg-silent -a25 -e verbose=none -e trace=sendmmsg,recvmmsg
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
mount -a33
mount-Xabbrev -a33 -e trace=mount -Xabbrev
mount-Xraw -a33 -e trace=mount -Xraw
mount-Xverbose -a33 -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

View File

@ -41,12 +41,16 @@
#endif
#if XLAT_RAW
# define str_unknown "0x300"
# define str_submount_200 "0x4000200"
# 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_unknown "0x300 /* MS_??? */"
# define str_submount_200 "0x4000200 /* MS_SUBMOUNT|0x200 */"
# define str_mgc_val "0xc0ed0000 /* MS_MGC_VAL */"
# define str_remount "0x20 /* MS_REMOUNT */"
# define str_bind "0x1000 /* MS_BIND */"
@ -55,6 +59,8 @@
# 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_unknown "0x300 /* MS_??? */"
# define str_submount_200 "MS_SUBMOUNT|0x200"
# define str_mgc_val "MS_MGC_VAL"
# define str_remount "MS_REMOUNT"
# define str_bind "MS_BIND"
@ -70,8 +76,24 @@ main(void)
static const char target[] = "mount_target";
static const char fstype[] = "mount_fstype";
static const char data[] = "mount_data";
TAIL_ALLOC_OBJECT_CONST_PTR(char, bogus);
int rc = mount(source, target, fstype, 15, data);
bogus[0] = 'a';
int rc = mount(NULL, NULL, NULL, 0, NULL);
printf("mount(NULL, NULL, NULL, 0, NULL) = %s\n",
sprintrc(rc));
rc = mount(bogus, bogus, bogus, 768, bogus);
printf("mount(%p, %p, %p, %s, %p) = %s\n",
bogus, bogus, bogus, str_unknown, bogus, sprintrc(rc));
rc = mount(bogus + 1, bogus + 1, bogus + 1, 0x4000200, bogus + 1);
printf("mount(%p, %p, %p, %s, %p) = %s\n",
bogus + 1, bogus + 1, bogus + 1, str_submount_200,
bogus + 1, sprintrc(rc));
rc = mount(source, target, fstype, 15, data);
printf("mount(\"%s\", \"%s\", \"%s\", %s, \"%s\") = %s\n",
source, target, fstype, str_ro_nosuid_nodev_noexec,
data, sprintrc(rc));
@ -92,13 +114,21 @@ main(void)
str_mgc_val "|" str_ro_nosuid_nodev_noexec,
data, sprintrc(rc));
rc = mount(source, target, NULL, MS_REMOUNT, data);
printf("mount(\"%s\", \"%s\", NULL, %s, \"%s\") = %s\n",
source, target, str_remount, data, sprintrc(rc));
rc = mount(source, target, fstype, MS_REMOUNT, data);
printf("mount(\"%s\", \"%s\", %p, %s, \"%s\") = %s\n",
source, target, fstype, str_remount, data, sprintrc(rc));
rc = mount(source, target, fstype, MS_BIND, data);
printf("mount(\"%s\", \"%s\", %p, %s, %p) = %s\n",
source, target, fstype, str_bind, data, sprintrc(rc));
rc = mount(source, target, NULL, MS_BIND, data);
printf("mount(\"%s\", \"%s\", NULL, %s, %p) = %s\n",
source, target, str_bind, data, sprintrc(rc));
rc = mount(source, target, fstype, MS_BIND, NULL);
printf("mount(\"%s\", \"%s\", %p, %s, NULL) = %s\n",
source, target, fstype, str_bind, sprintrc(rc));
puts("+++ exited with 0 +++");
return 0;