public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH v1] isofs.sh: Create group and user before check mount option
@ 2024-08-28  5:25 Wei Gao via ltp
  2024-08-28  9:14 ` Cyril Hrubis
  2024-08-28 13:45 ` [LTP] [PATCH v2] " Wei Gao via ltp
  0 siblings, 2 replies; 6+ messages in thread
From: Wei Gao via ltp @ 2024-08-28  5:25 UTC (permalink / raw)
  To: ltp

Signed-off-by: Wei Gao <wegao@suse.com>
---
 testcases/kernel/fs/iso9660/isofs.sh | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/fs/iso9660/isofs.sh b/testcases/kernel/fs/iso9660/isofs.sh
index d1a362d97..7ec314d1e 100755
--- a/testcases/kernel/fs/iso9660/isofs.sh
+++ b/testcases/kernel/fs/iso9660/isofs.sh
@@ -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
-- 
2.35.3


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH v1] isofs.sh: Create group and user before check mount option
  2024-08-28  5:25 [LTP] [PATCH v1] isofs.sh: Create group and user before check mount option Wei Gao via ltp
@ 2024-08-28  9:14 ` Cyril Hrubis
  2024-08-28 13:45 ` [LTP] [PATCH v2] " Wei Gao via ltp
  1 sibling, 0 replies; 6+ messages in thread
From: Cyril Hrubis @ 2024-08-28  9:14 UTC (permalink / raw)
  To: Wei Gao; +Cc: ltp

Here should a description why is this needed.

> Signed-off-by: Wei Gao <wegao@suse.com>
> ---
>  testcases/kernel/fs/iso9660/isofs.sh | 22 ++++++++++++++++++++--
>  1 file changed, 20 insertions(+), 2 deletions(-)
> 
> diff --git a/testcases/kernel/fs/iso9660/isofs.sh b/testcases/kernel/fs/iso9660/isofs.sh
> index d1a362d97..7ec314d1e 100755
> --- a/testcases/kernel/fs/iso9660/isofs.sh
> +++ b/testcases/kernel/fs/iso9660/isofs.sh
> @@ -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
>  
> +

And you shouldn't add empty lines like this.

>  	# 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
> -- 
> 2.35.3
> 
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [LTP] [PATCH v2] isofs.sh: Create group and user before check mount option
  2024-08-28  5:25 [LTP] [PATCH v1] isofs.sh: Create group and user before check mount option Wei Gao via ltp
  2024-08-28  9:14 ` Cyril Hrubis
@ 2024-08-28 13:45 ` Wei Gao via ltp
  2024-08-28 23:02   ` Petr Vorel
  2024-08-29  6:59   ` [LTP] [PATCH v3] " Wei Gao via ltp
  1 sibling, 2 replies; 6+ messages in thread
From: Wei Gao via ltp @ 2024-08-28 13:45 UTC (permalink / raw)
  To: ltp

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.

Signed-off-by: Wei Gao <wegao@suse.com>
---
 testcases/kernel/fs/iso9660/isofs.sh | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/fs/iso9660/isofs.sh b/testcases/kernel/fs/iso9660/isofs.sh
index d1a362d97..812df1caa 100755
--- a/testcases/kernel/fs/iso9660/isofs.sh
+++ b/testcases/kernel/fs/iso9660/isofs.sh
@@ -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
-- 
2.35.3


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH v2] isofs.sh: Create group and user before check mount option
  2024-08-28 13:45 ` [LTP] [PATCH v2] " Wei Gao via ltp
@ 2024-08-28 23:02   ` Petr Vorel
  2024-08-29  6:59   ` [LTP] [PATCH v3] " Wei Gao via ltp
  1 sibling, 0 replies; 6+ messages in thread
From: Petr Vorel @ 2024-08-28 23:02 UTC (permalink / raw)
  To: Wei Gao; +Cc: ltp

Hi Wei,

> 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

...
>  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.

> +
> +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
> +}
> +
>  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

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [LTP] [PATCH v3] isofs.sh: Create group and user before check mount option
  2024-08-28 13:45 ` [LTP] [PATCH v2] " Wei Gao via ltp
  2024-08-28 23:02   ` Petr Vorel
@ 2024-08-29  6:59   ` Wei Gao via ltp
  2024-08-30 11:55     ` Petr Vorel
  1 sibling, 1 reply; 6+ messages in thread
From: Wei Gao via ltp @ 2024-08-29  6:59 UTC (permalink / raw)
  To: ltp

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.

Signed-off-by: Wei Gao <wegao@suse.com>
---
 testcases/kernel/fs/iso9660/isofs.sh | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/fs/iso9660/isofs.sh b/testcases/kernel/fs/iso9660/isofs.sh
index d1a362d97..9114c1d99 100755
--- a/testcases/kernel/fs/iso9660/isofs.sh
+++ b/testcases/kernel/fs/iso9660/isofs.sh
@@ -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
-- 
2.35.3


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH v3] isofs.sh: Create group and user before check mount option
  2024-08-29  6:59   ` [LTP] [PATCH v3] " Wei Gao via ltp
@ 2024-08-30 11:55     ` Petr Vorel
  0 siblings, 0 replies; 6+ messages in thread
From: Petr Vorel @ 2024-08-30 11:55 UTC (permalink / raw)
  To: Wei Gao; +Cc: ltp

Hi Wei, Cyril,

> 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/20240830113913.49675-1-pvorel@suse.cz/

I proposed (long term) library solution:

https://github.com/linux-test-project/ltp/issues/468#issuecomment-2320992135

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-08-30 11:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-28  5:25 [LTP] [PATCH v1] isofs.sh: Create group and user before check mount option Wei Gao via ltp
2024-08-28  9:14 ` Cyril Hrubis
2024-08-28 13:45 ` [LTP] [PATCH v2] " Wei Gao via ltp
2024-08-28 23:02   ` Petr Vorel
2024-08-29  6:59   ` [LTP] [PATCH v3] " Wei Gao via ltp
2024-08-30 11:55     ` Petr Vorel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox