Remove duplicated ".needs_tmpdir=1" when using equivalent flags
PATCH 1/1 Remove duplicated ".needs_tmpdir=1" when using equivalent flags
From ltp library code, when we have used these flags(".needs_device" ".mntpoint" ".resource_file" ".needs_checkpoints" ".format_device" "mount_device" ".all_filesystems"), we don't need to set ".needs_tmpdir=1". So remove it.
--- doc/test-writing-guidelines.txt | 5 ++++- lib/newlib_tests/tst_device.c | 1 - testcases/kernel/fs/fs_fill/fs_fill.c | 1 - testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl01.c | 1 - testcases/kernel/security/dirtyc0w/dirtyc0w.c | 1 - testcases/kernel/syscalls/access/access04.c | 1 - testcases/kernel/syscalls/acct/acct01.c | 1 - .../kernel/syscalls/copy_file_range/copy_file_range01.c | 1 - .../kernel/syscalls/copy_file_range/copy_file_range02.c | 1 - testcases/kernel/syscalls/creat/creat06.c | 1 - testcases/kernel/syscalls/execveat/execveat03.c | 1 - testcases/kernel/syscalls/fallocate/fallocate04.c | 1 - testcases/kernel/syscalls/fallocate/fallocate05.c | 1 - testcases/kernel/syscalls/fanotify/fanotify01.c | 1 - testcases/kernel/syscalls/fanotify/fanotify05.c | 1 - testcases/kernel/syscalls/fanotify/fanotify06.c | 1 - testcases/kernel/syscalls/fanotify/fanotify10.c | 1 - testcases/kernel/syscalls/fanotify/fanotify15.c | 1 - testcases/kernel/syscalls/fcntl/fcntl33.c | 1 - testcases/kernel/syscalls/fgetxattr/fgetxattr01.c | 1 - testcases/kernel/syscalls/flock/flock03.c | 1 - testcases/kernel/syscalls/fremovexattr/fremovexattr01.c | 1 - testcases/kernel/syscalls/fremovexattr/fremovexattr02.c | 1 - testcases/kernel/syscalls/fsetxattr/fsetxattr01.c | 1 - testcases/kernel/syscalls/fsync/fsync01.c | 1 - testcases/kernel/syscalls/ftruncate/ftruncate04.c | 1 - testcases/kernel/syscalls/getxattr/getxattr04.c | 1 - testcases/kernel/syscalls/inotify/inotify03.c | 1 - testcases/kernel/syscalls/inotify/inotify07.c | 1 - testcases/kernel/syscalls/inotify/inotify08.c | 1 - testcases/kernel/syscalls/ioctl/ioctl04.c | 1 - testcases/kernel/syscalls/lremovexattr/lremovexattr01.c | 1 - testcases/kernel/syscalls/mkdir/mkdir03.c | 1 - testcases/kernel/syscalls/msync/msync04.c | 1 - testcases/kernel/syscalls/preadv2/preadv203.c | 1 - testcases/kernel/syscalls/quotactl/quotactl01.c | 1 - testcases/kernel/syscalls/quotactl/quotactl02.c | 1 - testcases/kernel/syscalls/quotactl/quotactl03.c | 1 - testcases/kernel/syscalls/quotactl/quotactl04.c | 1 - testcases/kernel/syscalls/quotactl/quotactl05.c | 1 - testcases/kernel/syscalls/readahead/readahead02.c | 1 - testcases/kernel/syscalls/statx/statx01.c | 1 - testcases/kernel/syscalls/statx/statx04.c | 1 - testcases/kernel/syscalls/statx/statx06.c | 1 - testcases/kernel/syscalls/umount/umount01.c | 1 - testcases/kernel/syscalls/umount/umount02.c | 1 - testcases/kernel/syscalls/umount/umount03.c | 1 - testcases/kernel/uevents/uevent01.c | 1 - testcases/kernel/uevents/uevent02.c | 1 - testcases/kernel/uevents/uevent03.c | 1 - 50 files changed, 4 insertions(+), 50 deletions(-)
doc/test-writing-guidelines.txt +4 -1
@@ -493,7 +493,10 @@ this needed. If '.needs_tmpdir' is set to '1' in the 'struct tst_test' unique test temporary is created and it's set as the test working directory. Tests *MUST -NOT* create temporary files outside that directory. +NOT* create temporary files outside that directory. If we have used one of +these flags(".needs_device" ".mntpoint" ".resource_file" ".needs_checkpoints" +".format_device" "mount_device" ".all_filesystems"), we don't need to set +'.needs_tmpdir' again because these flags also will create temporary directory. IMPORTANT: Close all file descriptors (that point to files in test temporary directory, even the unlinked ones) either in the 'test()' function
lib/newlib_tests/tst_device.c +0 -1
@@ -32,7 +32,6 @@ static void do_test(void) }static struct tst_test test = { - .needs_tmpdir =1 , .needs_device =1 , .dev_min_size =300 , .test_all = do_test,
testcases/kernel/fs/fs_fill/fs_fill.c +0 -1
@@ -110,7 +110,6 @@ static void cleanup(void)static struct tst_test test = { .needs_root =1 , - .needs_tmpdir =1 , .mount_device =1 , .mntpoint =MNTPOINT , .all_filesystems =1 ,
testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl01.c +0 -1
@@ -333,7 +333,6 @@ void cleanup(void)static struct tst_test test = { .needs_root =1 , .forks_child =1 , - .needs_tmpdir =1 , .options = options, .setup = setup, .cleanup = cleanup,
testcases/kernel/security/dirtyc0w/dirtyc0w.c +0 -1
@@ -92,7 +92,6 @@ void dirtyc0w_test(void) }static struct tst_test test = { - .needs_tmpdir =1 , .needs_checkpoints =1 , .forks_child =1 , .needs_root =1 ,
testcases/kernel/syscalls/access/access04.c +0 -1
@@ -110,7 +110,6 @@ static void setup(void)static struct tst_test test = { .tcnt =ARRAY_SIZE (tcases), - .needs_tmpdir =1 , .needs_root =1 , .forks_child =1 , .needs_rofs =1 ,
testcases/kernel/syscalls/acct/acct01.c +0 -1
@@ -120,7 +120,6 @@ static void verify_acct(unsigned int nr)static struct tst_test test = { .needs_root =1 , - .needs_tmpdir =1 , .mntpoint ="mntpoint" , .needs_rofs =1 , .tcnt =ARRAY_SIZE (tcases),
testcases/kernel/syscalls/copy_file_range/copy_file_range01.c +0 -1
@@ -227,7 +227,6 @@ static struct tst_test test = { .setup = setup, .cleanup = cleanup, .tcnt = ARRAY_SIZE(tcases), - .needs_tmpdir = 1, .mount_device = 1, .mntpoint = MNTPOINT, .all_filesystems = 1,
testcases/kernel/syscalls/copy_file_range/copy_file_range02.c +0 -1
@@ -248,6 +248,5 @@ static struct tst_test test = { .mount_device = 1, .mntpoint = MNTPOINT, .needs_root = 1, - .needs_tmpdir = 1, .test_variants = TEST_VARIANTS, };
testcases/kernel/syscalls/creat/creat06.c +0 -1
@@ -153,7 +153,6 @@ static struct tst_test test = { .test = verify_creat, .needs_root = 1, .needs_rofs = 1, - .needs_tmpdir = 1, .mntpoint = "mntpoint", .setup = setup, };
testcases/kernel/syscalls/execveat/execveat03.c +0 -1
@@ -75,7 +75,6 @@ static const char *const resource_files[] = {static struct tst_test test = { .needs_root =1 , - .needs_tmpdir =1 , .mount_device =1 , .needs_overlay =1 , .mntpoint = mntpoint,
testcases/kernel/syscalls/fallocate/fallocate04.c +0 -1
@@ -310,6 +310,5 @@ static struct tst_test test = { .mount_device = 1, .mntpoint = MNTPOINT, .all_filesystems = 1, - .needs_tmpdir = 1, .needs_root = 1, };
testcases/kernel/syscalls/fallocate/fallocate05.c +0 -1
@@ -84,7 +84,6 @@ static void cleanup(void)static struct tst_test test = { .needs_root =1 , - .needs_tmpdir =1 , .mount_device =1 , .mntpoint =MNTPOINT , .all_filesystems =1 ,
testcases/kernel/syscalls/fanotify/fanotify01.c +0 -1
@@ -379,7 +379,6 @@ static struct tst_test test = { .tcnt = ARRAY_SIZE(tcases), .setup = setup, .cleanup = cleanup, - .needs_tmpdir = 1, .needs_root = 1, .mount_device = 1, .mntpoint = MOUNT_PATH,
testcases/kernel/syscalls/fanotify/fanotify05.c +0 -1
@@ -127,7 +127,6 @@ static struct tst_test test = { .setup = setup, .cleanup = cleanup, .needs_root = 1, - .needs_tmpdir = 1, .mount_device = 1, .mntpoint = MOUNT_PATH, };
testcases/kernel/syscalls/fanotify/fanotify06.c +0 -1
@@ -252,7 +252,6 @@ static struct tst_test test = { .tcnt = ARRAY_SIZE(tcases), .setup = setup, .cleanup = cleanup, - .needs_tmpdir = 1, .needs_root = 1, .mount_device = 1, .mntpoint = mntpoint,
testcases/kernel/syscalls/fanotify/fanotify10.c +0 -1
@@ -440,7 +440,6 @@ static struct tst_test test = { .cleanup = cleanup, .mount_device = 1, .mntpoint = MOUNT_PATH, - .needs_tmpdir = 1, .needs_root = 1, .forks_child = 1, .resource_files = resource_files,
testcases/kernel/syscalls/fanotify/fanotify15.c +0 -1
@@ -233,7 +233,6 @@ static void do_cleanup(void)static struct tst_test test = { .needs_root =1 , - .needs_tmpdir =1 , .mount_device =1 , .mntpoint =MOUNT_POINT , .all_filesystems =1 ,
testcases/kernel/syscalls/fcntl/fcntl33.c +0 -1
@@ -226,7 +226,6 @@ static void cleanup(void)static struct tst_test test = { .forks_child =1 , .needs_root =1 , - .needs_tmpdir =1 , .needs_checkpoints =1 , .tcnt =ARRAY_SIZE (test_cases), .setup = setup,
testcases/kernel/syscalls/fgetxattr/fgetxattr01.c +0 -1
@@ -141,7 +141,6 @@ static struct tst_test test = { .mntpoint = MNTPOINT, .mount_device = 1, .all_filesystems = 1, - .needs_tmpdir = 1, .needs_root = 1, };
testcases/kernel/syscalls/flock/flock03.c +0 -1
@@ -92,7 +92,6 @@ static void setup(void)static struct tst_test test = { .test_all = verify_flock, .needs_checkpoints =1 , - .needs_tmpdir =1 , .forks_child =1 , .setup = setup, };
testcases/kernel/syscalls/fremovexattr/fremovexattr01.c +0 -1
@@ -89,7 +89,6 @@ static struct tst_test test = { .mntpoint = MNTPOINT, .mount_device = 1, .all_filesystems = 1, - .needs_tmpdir = 1, .needs_root = 1, };
testcases/kernel/syscalls/fremovexattr/fremovexattr02.c +0 -1
@@ -112,7 +112,6 @@ static struct tst_test test = { .mntpoint = MNTPOINT, .mount_device = 1, .all_filesystems = 1, - .needs_tmpdir = 1, .needs_root = 1, };
testcases/kernel/syscalls/fsetxattr/fsetxattr01.c +0 -1
@@ -221,7 +221,6 @@ static struct tst_test test = { .mntpoint = MNTPOINT, .mount_device = 1, .all_filesystems = 1, - .needs_tmpdir = 1, .needs_root = 1, };
testcases/kernel/syscalls/fsync/fsync01.c +0 -1
@@ -47,7 +47,6 @@ static struct tst_test test = { .cleanup = cleanup, .setup = setup, .test_all = verify_fsync, - .needs_tmpdir = 1, .needs_root = 1, .mount_device = 1, .mntpoint = "mntpoint",
testcases/kernel/syscalls/ftruncate/ftruncate04.c +0 -1
@@ -171,7 +171,6 @@ static struct tst_test test = { .test_all = verify_ftruncate, .setup = setup, .needs_checkpoints = 1, - .needs_tmpdir = 1, .forks_child = 1, .mount_device = 1, .needs_root = 1,
testcases/kernel/syscalls/getxattr/getxattr04.c +0 -1
@@ -106,7 +106,6 @@ static void setup(void) }static struct tst_test test = { - .needs_tmpdir =1 , .needs_root =1 , .mount_device =1 , .dev_fs_type ="xfs" ,
testcases/kernel/syscalls/inotify/inotify03.c +0 -1
@@ -168,7 +168,6 @@ static void cleanup(void)static struct tst_test test = { .needs_root =1 , - .needs_tmpdir =1 , .format_device =1 , .setup = setup, .cleanup = cleanup,
testcases/kernel/syscalls/inotify/inotify07.c +0 -1
@@ -179,7 +179,6 @@ static void cleanup(void)static struct tst_test test = { .needs_root =1 , - .needs_tmpdir =1 , .mount_device =1 , .needs_overlay =1 , .mntpoint = mntpoint,
testcases/kernel/syscalls/inotify/inotify08.c +0 -1
@@ -173,7 +173,6 @@ static void cleanup(void)static struct tst_test test = { .needs_root =1 , - .needs_tmpdir =1 , .mount_device =1 , .needs_overlay =1 , .mntpoint = mntpoint,
testcases/kernel/syscalls/ioctl/ioctl04.c +0 -1
@@ -81,7 +81,6 @@ static void cleanup(void) }static struct tst_test test = { - .needs_tmpdir =1 , .format_device =1 , .needs_root =1 , .setup = setup,
testcases/kernel/syscalls/lremovexattr/lremovexattr01.c +0 -1
@@ -121,7 +121,6 @@ static struct tst_test test = { .mntpoint = MNTPOINT, .mount_device = 1, .all_filesystems = 1, - .needs_tmpdir = 1, .needs_root = 1, };
testcases/kernel/syscalls/mkdir/mkdir03.c +0 -1
@@ -87,7 +87,6 @@ static void setup(void)static struct tst_test test = { .tcnt =ARRAY_SIZE (TC ), - .needs_tmpdir =1 , .needs_root =1 , .needs_rofs =1 , .mntpoint =MNT_POINT ,
testcases/kernel/syscalls/msync/msync04.c +0 -1
@@ -93,7 +93,6 @@ static struct tst_test test = { .test_all = test_msync, .setup = setup, .cleanup = cleanup, - .needs_tmpdir = 1, .needs_root = 1, .mntpoint = "msync04", .mount_device = 1,
testcases/kernel/syscalls/preadv2/preadv203.c +0 -1
@@ -279,6 +279,5 @@ static struct tst_test test = { .mntpoint = MNTPOINT, .mount_device = 1, .all_filesystems = 1, - .needs_tmpdir = 1, .needs_root = 1, };
testcases/kernel/syscalls/quotactl/quotactl01.c +0 -1
@@ -226,7 +226,6 @@ static const char *kconfigs[] = { };static struct tst_test test = { - .needs_tmpdir =1 , .needs_root =1 , .needs_kconfigs = kconfigs, .test = verify_quota,
testcases/kernel/syscalls/quotactl/quotactl02.c +0 -1
@@ -141,7 +141,6 @@ static void verify_quota(unsigned int n) }static struct tst_test test = { - .needs_tmpdir =1 , .needs_root =1 , .needs_kconfigs = kconfigs, .test = verify_quota,
testcases/kernel/syscalls/quotactl/quotactl03.c +0 -1
@@ -70,7 +70,6 @@ static const char *kconfigs[] = { };static struct tst_test test = { - .needs_tmpdir =1 , .needs_root =1 , .needs_kconfigs = kconfigs, .test_all = verify_quota,
testcases/kernel/syscalls/quotactl/quotactl04.c +0 -1
@@ -148,7 +148,6 @@ static const char *kconfigs[] = { };static struct tst_test test = { - .needs_tmpdir =1 , .needs_root =1 , .needs_kconfigs = kconfigs, .min_kver ="4.10" ,/* commit 689c958cbe6b (ext4: add project quota support) */
testcases/kernel/syscalls/quotactl/quotactl05.c +0 -1
@@ -98,7 +98,6 @@ static void verify_quota(unsigned int n) }static struct tst_test test = { - .needs_tmpdir =1 , .needs_root =1 , .needs_kconfigs = kconfigs, .test = verify_quota,
testcases/kernel/syscalls/readahead/readahead02.c +0 -1
@@ -401,7 +401,6 @@ static void cleanup(void)static struct tst_test test = { .needs_root =1 , - .needs_tmpdir =1 , .mount_device =1 , .mntpoint = mntpoint, .setup = setup,
testcases/kernel/syscalls/statx/statx01.c +0 -1
@@ -165,5 +165,4 @@ static struct tst_test test = { .needs_devfs = 1, .mntpoint = MNTPOINT, .needs_root = 1, - .needs_tmpdir = 1, };
testcases/kernel/syscalls/statx/statx04.c +0 -1
@@ -180,7 +180,6 @@ static struct tst_test test = { .needs_root = 1, .all_filesystems = 1, .mount_device = 1, - .needs_tmpdir = 1, .mntpoint = MOUNT_POINT, .min_kver = "4.11", };
testcases/kernel/syscalls/statx/statx06.c +0 -1
@@ -169,7 +169,6 @@ static struct tst_test test = { .test = test_statx, .min_kver = "4.11", .needs_root = 1, - .needs_tmpdir = 1, .mntpoint = MOUNT_POINT, .mount_device = 1, .dev_fs_type = "ext4",
testcases/kernel/syscalls/umount/umount01.c +0 -1
@@ -53,7 +53,6 @@ static void cleanup(void)static struct tst_test test = { .needs_root =1 , - .needs_tmpdir =1 , .format_device =1 , .setup = setup, .cleanup = cleanup,
testcases/kernel/syscalls/umount/umount02.c +0 -1
@@ -81,7 +81,6 @@ static void cleanup(void)static struct tst_test test = { .tcnt =ARRAY_SIZE (tcases), .needs_root =1 , - .needs_tmpdir =1 , .format_device =1 , .setup = setup, .cleanup = cleanup,
testcases/kernel/syscalls/umount/umount03.c +0 -1
@@ -58,7 +58,6 @@ static void cleanup(void)static struct tst_test test = { .needs_root =1 , - .needs_tmpdir =1 , .format_device =1 , .setup = setup, .cleanup = cleanup,
testcases/kernel/uevents/uevent01.c +0 -1
@@ -88,7 +88,6 @@ static void verify_uevent(void)static struct tst_test test = { .test_all = verify_uevent, .forks_child =1 , - .needs_tmpdir =1 , .needs_checkpoints =1 , .needs_drivers = (const char *const []) {"loop" ,
testcases/kernel/uevents/uevent02.c +0 -1
@@ -134,7 +134,6 @@ static void verify_uevent(void)static struct tst_test test = { .test_all = verify_uevent, .forks_child =1 , - .needs_tmpdir =1 , .needs_checkpoints =1 , .needs_drivers = (const char *const []) {"tun" ,
testcases/kernel/uevents/uevent03.c +0 -1
@@ -234,7 +234,6 @@ static void verify_uevent(void)static struct tst_test test = { .test_all = verify_uevent, .forks_child =1 , - .needs_tmpdir =1 , .needs_checkpoints =1 , .needs_drivers = (const char *const []) {"uinput" ,
Signature · 1 line
2.18.0
PATCH 1/1 Remove duplicated ".needs_tmpdir=1" when using equivalent flags
Hi Xu,
Quoted 4 lines
From ltp library code, when we have used these flags(".needs_device" ".mntpoint" ".resource_file" ".needs_checkpoints" ".format_device" "
mount_device" ".all_filesystems"), we don't need to set ".needs_tmpdir=1". So remove it.
LGTM (unless Cyril has some objections).
I propose following diff (fix formating, reword; I'll modify it before merge).
Kind regards,
Petr
test-writing-guidelines.txt +4 -4
@@ -493,10 +493,10 @@ this needed. If '.needs_tmpdir' is set to '1' in the 'struct tst_test' unique test temporary is created and it's set as the test working directory. Tests *MUST -NOT* create temporary files outside that directory. If we have used one of -these flags(".needs_device" ".mntpoint" ".resource_file" ".needs_checkpoints" -".format_device" "mount_device" ".all_filesystems"), we don't need to set -'.needs_tmpdir' again because these flags also will create temporary directory. +NOT* create temporary files outside that directory. The flag is not needed to +be set when use these flags: '.all_filesystems', '.format_device', '.mntpoint', +'.mount_device' '.needs_checkpoints', '.needs_device', '.resource_file' +(these flags imply creating temporary directory). IMPORTANT: Close all file descriptors (that point to files in test temporary directory, even the unlinked ones) either in the 'test()' function
PATCH 1/1 Remove duplicated ".needs_tmpdir=1" when using equivalent flags
Hi Xu,
Quoted 4 lines
Quoted 4 lines
From ltp library code, when we have used these flags(".needs_device" ".mntpoint" ".resource_file" ".needs_checkpoints" ".format_device" "
mount_device" ".all_filesystems"), we don't need to set ".needs_tmpdir=1". So remove it.
Patch for shell API (should be merged only if we agree on this one).
https://patchwork.ozlabs.org/patch/1206651/
Kind regards,
Petr
PATCH 1/1 Remove duplicated ".needs_tmpdir=1" when using equivalent flags
In reply to Yang XuHi!
Acked from me as well, Peter feel free to merge.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 1/1 Remove duplicated ".needs_tmpdir=1" when using equivalent flags
Hi Cyril,
Quoted 2 lines
Hi!
Acked from me as well, Peter feel free to merge.
Thanks for ack, merged.
Kind regards,
Petr