public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH v3 1/1] isofs.sh: Test genisoimage, xorriso and mksisofs
@ 2024-01-29  9:22 Petr Vorel
  2024-01-29 16:42 ` Cyril Hrubis
  0 siblings, 1 reply; 3+ messages in thread
From: Petr Vorel @ 2024-01-29  9:22 UTC (permalink / raw)
  To: ltp; +Cc: Subramanya Swamy

From: Subramanya Swamy <subramanya.swamy.linux@gmail.com>

Run test an all 3 tools: genisoimage, xorriso and mksisofs.

mkisofs, genisoimage and xorriso tools are present as separate tools in
some distros while in others they are symlinks to one another. Tests are
skipped on symlinks.

mkisofs supports only -hfs option
genisoimage supports both -hfs and -hfsplus options
xorrisofs supports only -hfsplus option

This actually fixes xorrisofs on CentOS which is a symlink to mkisofs
and because it does not supports -hfs test IMHO fails.

Reviewed-by: Petr Vorel <pvorel@suse.cz>
Co-Authored-By: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Subramanya Swamy <subramanya.swamy.linux@gmail.com>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
@Cyril unless you ack this, it will be merged after the release.

Also, I consider to implement test variants for shell API, because it
would be better to use tests variants for this (and test variants would
be useful to be used here and for ping tests.

Kind regards,
Petr

 testcases/kernel/fs/iso9660/isofs.sh | 49 ++++++++++++++++++----------
 1 file changed, 31 insertions(+), 18 deletions(-)

diff --git a/testcases/kernel/fs/iso9660/isofs.sh b/testcases/kernel/fs/iso9660/isofs.sh
index dfa4ac73d..06f97a64f 100755
--- a/testcases/kernel/fs/iso9660/isofs.sh
+++ b/testcases/kernel/fs/iso9660/isofs.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) International Business Machines Corp., 2003
-# Copyright (c) Linux Test Project, 2016-2021
+# Copyright (c) Linux Test Project, 2016-2024
 # Written by Prakash Narayana (prakashn@us.ibm.com)
 # and Michael Reed (mreed10@us.ibm.com)
 #
@@ -11,23 +11,12 @@
 
 TST_NEEDS_CMDS="mount umount"
 TST_NEEDS_TMPDIR=1
-TST_SETUP=setup
 TST_TESTFUNC=do_test
+TST_CNT=3
 
 MAX_DEPTH=3
 MAX_DIRS=4
 
-setup()
-{
-	if tst_cmd_available mkisofs; then
-		MKISOFS_CMD="mkisofs"
-	elif tst_cmd_available genisoimage; then
-		MKISOFS_CMD="genisoimage"
-	else
-		tst_brk TCONF "please install mkisofs or genisoimage"
-	fi
-}
-
 gen_fs_tree()
 {
 	local cur_path="$1"
@@ -50,10 +39,33 @@ do_test()
 	local make_file_sys_dir="$PWD/files"
 	local mkisofs_opt mount_opt
 
+	case $1 in
+		1) MKISOFS_CMD="mkisofs"
+			HFSOPT="-hfs -D"
+			GREPOPT="mkisofs";;
+		2) MKISOFS_CMD="genisoimage"
+			HFSOPT="-hfsplus -D -hfs -D"
+			GREPOPT="genisoimage";;
+		3) MKISOFS_CMD="xorrisofs"
+			HFSOPT="-hfsplus -D"
+			GREPOPT="xorriso";;
+	esac
+
+	tst_res TINFO "Testing $MKISOFS_CMD"
+
+	if ! tst_cmd_available $MKISOFS_CMD; then
+		tst_res TCONF "Missing '$MKISOFS_CMD'"
+		return
+	fi
+
+	if ! $MKISOFS_CMD 2>&1 | head -n 2 | grep -q "$GREPOPT"; then
+		tst_res TCONF "'$MKISOFS_CMD' is a symlink to another tool"
+		return
+	fi
+
 	mkdir -p -m 777 $mnt_point
 	mkdir -p $make_file_sys_dir
 
-	# Generated directories and files
 	mkdir -p $make_file_sys_dir
 	gen_fs_tree "$make_file_sys_dir" 1
 
@@ -62,15 +74,16 @@ do_test()
 	for mkisofs_opt in \
 		" " \
 		"-J" \
-		"-hfs -D" \
+		"$HFSOPT" \
 		" -R " \
 		"-R -J" \
 		"-f -l -D -J -allow-leading-dots -R" \
-		"-allow-lowercase -allow-multidot -iso-level 3 -f -l -D -J -allow-leading-dots -R"
+		"-allow-lowercase -allow-multidot -iso-level 3 -f -l -D -J \
+			-allow-leading-dots -R"
 	do
 		rm -f isofs.iso
-		EXPECT_PASS $MKISOFS_CMD -o isofs.iso -quiet $mkisofs_opt $make_file_sys_dir 2\> /dev/null \
-			|| continue
+		EXPECT_PASS $MKISOFS_CMD -o isofs.iso -quiet $mkisofs_opt \
+			$make_file_sys_dir 2\> /dev/null || continue
 
 		for mount_opt in \
 			"loop" \
-- 
2.43.0


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

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

* Re: [LTP] [PATCH v3 1/1] isofs.sh: Test genisoimage, xorriso and mksisofs
  2024-01-29  9:22 [LTP] [PATCH v3 1/1] isofs.sh: Test genisoimage, xorriso and mksisofs Petr Vorel
@ 2024-01-29 16:42 ` Cyril Hrubis
  2024-01-29 17:05   ` Petr Vorel
  0 siblings, 1 reply; 3+ messages in thread
From: Cyril Hrubis @ 2024-01-29 16:42 UTC (permalink / raw)
  To: Petr Vorel; +Cc: Subramanya Swamy, ltp

Hi!
> @@ -50,10 +39,33 @@ do_test()
>  	local make_file_sys_dir="$PWD/files"
>  	local mkisofs_opt mount_opt
>  
> +	case $1 in
> +		1) MKISOFS_CMD="mkisofs"
> +			HFSOPT="-hfs -D"
> +			GREPOPT="mkisofs";;
> +		2) MKISOFS_CMD="genisoimage"
> +			HFSOPT="-hfsplus -D -hfs -D"
> +			GREPOPT="genisoimage";;
> +		3) MKISOFS_CMD="xorrisofs"
> +			HFSOPT="-hfsplus -D"
> +			GREPOPT="xorriso";;
> +	esac
> +
> +	tst_res TINFO "Testing $MKISOFS_CMD"
                ^
               Maybe this should be after the two TCONF messages so that
	       we do not print:

	       INFO: "Testing foo"
	       CONF: "Missing foo"


Other than that it does look fine, as long as it's well tested feel free
to add this for the release.

Reviewed-by: Cyril Hrubis

> +	if ! tst_cmd_available $MKISOFS_CMD; then
> +		tst_res TCONF "Missing '$MKISOFS_CMD'"
> +		return
> +	fi
> +
> +	if ! $MKISOFS_CMD 2>&1 | head -n 2 | grep -q "$GREPOPT"; then
> +		tst_res TCONF "'$MKISOFS_CMD' is a symlink to another tool"
> +		return
> +	fi
> +
>  	mkdir -p -m 777 $mnt_point
>  	mkdir -p $make_file_sys_dir
>  
> -	# Generated directories and files
>  	mkdir -p $make_file_sys_dir
>  	gen_fs_tree "$make_file_sys_dir" 1
>  
> @@ -62,15 +74,16 @@ do_test()
>  	for mkisofs_opt in \
>  		" " \
>  		"-J" \
> -		"-hfs -D" \
> +		"$HFSOPT" \
>  		" -R " \
>  		"-R -J" \
>  		"-f -l -D -J -allow-leading-dots -R" \
> -		"-allow-lowercase -allow-multidot -iso-level 3 -f -l -D -J -allow-leading-dots -R"
> +		"-allow-lowercase -allow-multidot -iso-level 3 -f -l -D -J \
> +			-allow-leading-dots -R"
>  	do
>  		rm -f isofs.iso
> -		EXPECT_PASS $MKISOFS_CMD -o isofs.iso -quiet $mkisofs_opt $make_file_sys_dir 2\> /dev/null \
> -			|| continue
> +		EXPECT_PASS $MKISOFS_CMD -o isofs.iso -quiet $mkisofs_opt \
> +			$make_file_sys_dir 2\> /dev/null || continue
>  
>  		for mount_opt in \
>  			"loop" \
> -- 
> 2.43.0
> 

-- 
Cyril Hrubis
chrubis@suse.cz

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

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

* Re: [LTP] [PATCH v3 1/1] isofs.sh: Test genisoimage, xorriso and mksisofs
  2024-01-29 16:42 ` Cyril Hrubis
@ 2024-01-29 17:05   ` Petr Vorel
  0 siblings, 0 replies; 3+ messages in thread
From: Petr Vorel @ 2024-01-29 17:05 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: Subramanya Swamy, ltp

Hi Cyril,

> > +	tst_res TINFO "Testing $MKISOFS_CMD"
>                 ^
>                Maybe this should be after the two TCONF messages so that
> 	       we do not print:

> 	       INFO: "Testing foo"
> 	       CONF: "Missing foo"


> Other than that it does look fine, as long as it's well tested feel free
> to add this for the release.

Good point. Fixed that and merged.

Kind regards,
Petr

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

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

end of thread, other threads:[~2024-01-29 17:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-29  9:22 [LTP] [PATCH v3 1/1] isofs.sh: Test genisoimage, xorriso and mksisofs Petr Vorel
2024-01-29 16:42 ` Cyril Hrubis
2024-01-29 17:05   ` Petr Vorel

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