Skip to content

Commit 885abb8

Browse files
isofs.sh: Test genisoimage, xorriso and mksisofs
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. Link: https://lore.kernel.org/ltp/[email protected]/ Co-Authored-By: Petr Vorel <[email protected]> Reviewed-by: Petr Vorel <[email protected]> Reviewed-by: Cyril Hrubis <[email protected]> Signed-off-by: Subramanya Swamy <[email protected]> Signed-off-by: Petr Vorel <[email protected]>
1 parent e5970b2 commit 885abb8

File tree

1 file changed

+31
-18
lines changed

1 file changed

+31
-18
lines changed

testcases/kernel/fs/iso9660/isofs.sh

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22
# SPDX-License-Identifier: GPL-2.0-or-later
33
# Copyright (c) International Business Machines Corp., 2003
4-
# Copyright (c) Linux Test Project, 2016-2021
4+
# Copyright (c) Linux Test Project, 2016-2024
55
# Written by Prakash Narayana ([email protected])
66
# and Michael Reed ([email protected])
77
#
@@ -11,23 +11,12 @@
1111

1212
TST_NEEDS_CMDS="mount umount"
1313
TST_NEEDS_TMPDIR=1
14-
TST_SETUP=setup
1514
TST_TESTFUNC=do_test
15+
TST_CNT=3
1616

1717
MAX_DEPTH=3
1818
MAX_DIRS=4
1919

20-
setup()
21-
{
22-
if tst_cmd_available mkisofs; then
23-
MKISOFS_CMD="mkisofs"
24-
elif tst_cmd_available genisoimage; then
25-
MKISOFS_CMD="genisoimage"
26-
else
27-
tst_brk TCONF "please install mkisofs or genisoimage"
28-
fi
29-
}
30-
3120
gen_fs_tree()
3221
{
3322
local cur_path="$1"
@@ -50,10 +39,33 @@ do_test()
5039
local make_file_sys_dir="$PWD/files"
5140
local mkisofs_opt mount_opt
5241

42+
case $1 in
43+
1) MKISOFS_CMD="mkisofs"
44+
HFSOPT="-hfs -D"
45+
GREPOPT="mkisofs";;
46+
2) MKISOFS_CMD="genisoimage"
47+
HFSOPT="-hfsplus -D -hfs -D"
48+
GREPOPT="genisoimage";;
49+
3) MKISOFS_CMD="xorrisofs"
50+
HFSOPT="-hfsplus -D"
51+
GREPOPT="xorriso";;
52+
esac
53+
54+
if ! tst_cmd_available $MKISOFS_CMD; then
55+
tst_res TCONF "Missing '$MKISOFS_CMD'"
56+
return
57+
fi
58+
59+
if ! $MKISOFS_CMD 2>&1 | head -n 2 | grep -q "$GREPOPT"; then
60+
tst_res TCONF "'$MKISOFS_CMD' is a symlink to another tool"
61+
return
62+
fi
63+
64+
tst_res TINFO "Testing $MKISOFS_CMD"
65+
5366
mkdir -p -m 777 $mnt_point
5467
mkdir -p $make_file_sys_dir
5568

56-
# Generated directories and files
5769
mkdir -p $make_file_sys_dir
5870
gen_fs_tree "$make_file_sys_dir" 1
5971

@@ -62,15 +74,16 @@ do_test()
6274
for mkisofs_opt in \
6375
" " \
6476
"-J" \
65-
"-hfs -D" \
77+
"$HFSOPT" \
6678
" -R " \
6779
"-R -J" \
6880
"-f -l -D -J -allow-leading-dots -R" \
69-
"-allow-lowercase -allow-multidot -iso-level 3 -f -l -D -J -allow-leading-dots -R"
81+
"-allow-lowercase -allow-multidot -iso-level 3 -f -l -D -J \
82+
-allow-leading-dots -R"
7083
do
7184
rm -f isofs.iso
72-
EXPECT_PASS $MKISOFS_CMD -o isofs.iso -quiet $mkisofs_opt $make_file_sys_dir 2\> /dev/null \
73-
|| continue
85+
EXPECT_PASS $MKISOFS_CMD -o isofs.iso -quiet $mkisofs_opt \
86+
$make_file_sys_dir 2\> /dev/null || continue
7487

7588
for mount_opt in \
7689
"loop" \

0 commit comments

Comments
 (0)