isofs.sh: Create group and user before check mount option
PATCH 1/1 isofs.sh: Create group and user before check mount option
--- testcases/kernel/fs/iso9660/isofs.sh | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)
testcases/kernel/fs/iso9660/isofs.sh +20 -2
@@ -13,10 +13,27 @@ TST_NEEDS_CMDS="mount umount" TST_NEEDS_TMPDIR=1 TST_TESTFUNC=do_test TST_CNT=3 +TST_SETUP="setup" +TST_CLEANUP="cleanup" MAX_DEPTH=3 MAX_DIRS=4 +test_group="abc" + +setup() +{ + if ! getent group $test_group > /dev/null; then + useradd -U $test_group + fi +} + +cleanup() +{ + userdel -f $test_group + groupdel -f $test_group +} + gen_fs_tree() { local cur_path="$1"
@@ -69,6 +86,7 @@ do_test() mkdir -p $make_file_sys_dir gen_fs_tree "$make_file_sys_dir" 1 + # Make ISO9660 file system with different options. # Mount the ISO9660 file system with different mount options. for mkisofs_opt in \
@@ -92,8 +110,8 @@ do_test() "loop,block=512,unhide" \ "loop,block=1024,cruft" \ "loop,block=2048,nocompress" \ - "loop,check=strict,map=off,gid=bin,uid=bin" \ - "loop,check=strict,map=acorn,gid=bin,uid=bin" \ + "loop,block=2048,nocompress" \ "loop,check=strict,map=off,gid=$test_group,uid=$test_group" \ + "loop,check=strict,map=acorn,gid=$test_group,uid=$test_group" \ "loop,check=relaxed,map=normal" \ "loop,block=512,unhide,session=2" do
Signature · 5 lines
2.35.3 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Here should a description why is this needed.
Quoted 38 lines
Signed-off-by Wei Gao <[email protected]>--- testcases/kernel/fs/iso9660/isofs.sh | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)testcases/kernel/fs/iso9660/isofs.sh +17
-0@@ -13,10 +13,27 @@ TST_NEEDS_CMDS="mount umount" TST_NEEDS_TMPDIR=1 TST_TESTFUNC=do_test TST_CNT=3 +TST_SETUP="setup" +TST_CLEANUP="cleanup" MAX_DEPTH=3 MAX_DIRS=4 +test_group="abc" + +setup() +{ + if ! getent group $test_group > /dev/null; then + useradd -U $test_group + fi +} + +cleanup() +{ + userdel -f $test_group + groupdel -f $test_group +} + gen_fs_tree() { local cur_path="$1"
testcases/kernel/fs/iso9660/isofs.sh do_test() · line 89
Quoted 4 lines
testcases/kernel/fs/iso9660/isofs.sh +1
-0@@ -69,6 +86,7 @@ do_test() mkdir -p $make_file_sys_dir gen_fs_tree "$make_file_sys_dir" 1 +
And you shouldn't add empty lines like this.
Quoted 20 lines
testcases/kernel/fs/iso9660/isofs.sh +2
-2# Make ISO9660 file system with different options. # Mount the ISO9660 file system with different mount options. for mkisofs_opt in \@@ -92,8 +110,8 @@ do_test() "loop,block=512,unhide" \ "loop,block=1024,cruft" \ "loop,block=2048,nocompress" \ - "loop,check=strict,map=off,gid=bin,uid=bin" \ - "loop,check=strict,map=acorn,gid=bin,uid=bin" \ + "loop,block=2048,nocompress" \ "loop,check=strict,map=off,gid=$test_group,uid=$test_group" \ + "loop,check=strict,map=acorn,gid=$test_group,uid=$test_group" \ "loop,check=relaxed,map=normal" \ "loop,block=512,unhide,session=2" doSignature · 5 lines
2.35.3 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v2 1/1 isofs.sh: Create group and user before check mount option
In reply to Wei Gao via ltpCase will failed if default system has no group named "bin", such as suse sle-micro, so this patch will create specific group for test instead of fixed "bin" group.
--- testcases/kernel/fs/iso9660/isofs.sh | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-)
testcases/kernel/fs/iso9660/isofs.sh +19 -2
@@ -13,10 +13,27 @@ TST_NEEDS_CMDS="mount umount" TST_NEEDS_TMPDIR=1 TST_TESTFUNC=do_test TST_CNT=3 +TST_SETUP="setup" +TST_CLEANUP="cleanup" MAX_DEPTH=3 MAX_DIRS=4 +test_group="abc" + +setup() +{ + if ! getent group $test_group > /dev/null; then + useradd -U $test_group + fi +} + +cleanup() +{ + userdel -f $test_group + groupdel -f $test_group +} + gen_fs_tree() { local cur_path="$1"
@@ -92,8 +109,8 @@ do_test() "loop,block=512,unhide" \ "loop,block=1024,cruft" \ "loop,block=2048,nocompress" \ - "loop,check=strict,map=off,gid=bin,uid=bin" \ - "loop,check=strict,map=acorn,gid=bin,uid=bin" \ + "loop,block=2048,nocompress" \ "loop,check=strict,map=off,gid=$test_group,uid=$test_group" \ + "loop,check=strict,map=acorn,gid=$test_group,uid=$test_group" \ "loop,check=relaxed,map=normal" \ "loop,block=512,unhide,session=2" do
Signature · 5 lines
2.35.3 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Wei,
Quoted 3 lines
Case will failed if default system has no group named "bin", such as suse sle-micro, so this patch will create specific group for test instead of fixed "bin" group.
I wonder if we should not add this group to SUT, there are more tests which needs some group (IDcheck.sh has bin, daemon, nobody, ...), e.g. hugeshmat03.c, cgroup_core0[12].c, access01.c use nobody. Maybe that is more common than bin (and presented on the SUT).
FYI we even have a ticket, although I don't expect you would have time to to work on something generic...
https://github.com/linux-test-project/ltp/issues/468
...
Quoted 4 lines
MAX_DEPTH=3
MAX_DIRS=4+test_group="abc"
... thus I'm not opposite to workaround like this. But it'd be better to name the new user ltp_isofs or something really unique.
testcases/kernel/fs/iso9660/isofs.sh TST_NEEDS_CMDS="mount umount" · line 34
Quoted 12 lines
testcases/kernel/fs/iso9660/isofs.sh +12
-0+ +setup() +{ + if ! getent group $test_group > /dev/null; then + useradd -U $test_group + fi +} + +cleanup() +{ + userdel -f $test_group + groupdel -f $test_group
+1 for using userdel which is everywhere.
But maybe prefix it with ROD?
or use TST_NEEDS_CMDS to make sure both binaries are on SUT?
Kind regards,
Petr
Quoted 16 lines
testcases/kernel/fs/iso9660/isofs.sh +4
-2+} + gen_fs_tree() { local cur_path="$1"@@ -92,8 +109,8 @@ do_test() "loop,block=512,unhide" \ "loop,block=1024,cruft" \ "loop,block=2048,nocompress" \ - "loop,check=strict,map=off,gid=bin,uid=bin" \ - "loop,check=strict,map=acorn,gid=bin,uid=bin" \ + "loop,block=2048,nocompress" \ "loop,check=strict,map=off,gid=$test_group,uid=$test_group" \ + "loop,check=strict,map=acorn,gid=$test_group,uid=$test_group" \ "loop,check=relaxed,map=normal" \ "loop,block=512,unhide,session=2" do
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v3 1/1 isofs.sh: Create group and user before check mount option
In reply to Wei Gao via ltpCase will failed if default system has no group named "bin", such as suse sle-micro, so this patch will create specific group for test instead of fixed "bin" group.
--- testcases/kernel/fs/iso9660/isofs.sh | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-)
testcases/kernel/fs/iso9660/isofs.sh +19 -2
@@ -13,10 +13,27 @@ TST_NEEDS_CMDS="mount umount" TST_NEEDS_TMPDIR=1 TST_TESTFUNC=do_test TST_CNT=3 +TST_SETUP="setup" +TST_CLEANUP="cleanup" MAX_DEPTH=3 MAX_DIRS=4 +test_group="ltp_isofs" + +setup() +{ + if ! getent group $test_group > /dev/null; then + ROD useradd -U $test_group + fi +} + +cleanup() +{ + ROD userdel -f $test_group + ROD groupdel -f $test_group +} + gen_fs_tree() { local cur_path="$1"
@@ -92,8 +109,8 @@ do_test() "loop,block=512,unhide" \ "loop,block=1024,cruft" \ "loop,block=2048,nocompress" \ - "loop,check=strict,map=off,gid=bin,uid=bin" \ - "loop,check=strict,map=acorn,gid=bin,uid=bin" \ + "loop,block=2048,nocompress" \ "loop,check=strict,map=off,gid=$test_group,uid=$test_group" \ + "loop,check=strict,map=acorn,gid=$test_group,uid=$test_group" \ "loop,check=relaxed,map=normal" \ "loop,block=512,unhide,session=2" do
Signature · 5 lines
2.35.3 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Wei, Cyril,
Quoted 3 lines
Case will failed if default system has no group named "bin", such as suse sle-micro, so this patch will create specific group for test instead of fixed "bin" group.
I suggested an alternative solution, which does not force user creation on all distros.
https://patchwork.ozlabs.org/project/ltp/patch/[email protected]/
I proposed (long term) library solution:
https://github.com/linux-test-project/ltp/issues/468#issuecomment-2320992135
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp