diff mbox series

[v1] isofs.sh: Create group and user before check mount option

Message ID 20240828052500.2395-1-wegao@suse.com
State Changes Requested
Headers show
Series [v1] isofs.sh: Create group and user before check mount option | expand

Commit Message

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

Comments

Cyril Hrubis Aug. 28, 2024, 9:14 a.m. UTC | #1
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
diff mbox series

Patch

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