Skip to content

Commit 7806e44

Browse files
committed
fs/isofs.sh: Don't use /etc/ for the image
The content of /etc/ is not predictable and may cause false possitives. I recently started to get failures with -J when there are two files with long names that differ only at the end. The exact error I got is: genisoimage: Error: /etc/zypp/repos.d/SUSE_Linux_Enterprise_Server_12_SP1_x86_64:SLES12-SP1-Debuginfo-Updates.repo and /etc/zypp/repos.d/SUSE_Linux_Enterprise_Server_12_SP1_x86_64:SLES12-SP1-Debuginfo-Pool.repo have the same Joliet name Joliet tree sort failed. This patch changes the script to generate filesystem tree instead of copying content of /etc/. Signed-off-by: Cyril Hrubis <[email protected]>
1 parent e52148b commit 7806e44

File tree

1 file changed

+26
-12
lines changed

1 file changed

+26
-12
lines changed

testcases/kernel/fs/iso9660/isofs.sh

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ NO_CLEANUP=""
3232

3333
usage()
3434
{
35-
echo "USAGE: $0 <optional> -n -h -d [directory name]"
35+
echo "USAGE: $0 <optional> -n -h"
3636
exit
3737
}
3838

@@ -45,18 +45,34 @@ cleanup()
4545
fi
4646
}
4747

48+
max_depth=3
49+
max_dirs=4
4850

49-
COPY_DIR="/etc/"
51+
gen_fs_tree()
52+
{
53+
local cur_path="$1"
54+
local cur_depth="$2"
55+
56+
if [ "$cur_depth" -gt "$max_depth" ]; then
57+
return
58+
fi
59+
60+
for i in $(seq 1 $max_dirs); do
61+
local new_path="$cur_path/subdir_$i"
62+
63+
mkdir -p "$new_path"
64+
65+
dd if=/dev/urandom of="$new_path/file" bs=1024 count=100 &> /dev/null
66+
67+
gen_fs_tree "$new_path" $((cur_depth + 1))
68+
done
69+
}
5070

5171
while getopts :hnd: arg; do
5272
case $arg in
53-
d)
54-
COPY_DIR=$OPTARG
55-
;;
5673
h)
5774
echo ""
5875
echo "n - The directories created will not be removed"
59-
echo "d - Specify a directory to copy into /tmp"
6076
echo "h - Help options"
6177
echo ""
6278
usage
@@ -68,22 +84,20 @@ while getopts :hnd: arg; do
6884
esac
6985
done
7086

71-
if [ ! -e "$COPY_DIR" ]; then
72-
tst_brkm TCONF "$COPY_DIR not found"
73-
fi
74-
7587
tst_require_root
7688

7789
tst_tmpdir
7890
TST_CLEANUP=cleanup
7991

8092
MNT_POINT="$PWD/mnt"
81-
MAKE_FILE_SYS_DIR="$PWD/tmp/$COPY_DIR"
93+
MAKE_FILE_SYS_DIR="$PWD/files"
8294

8395
mkdir -p -m 777 $MNT_POINT
8496
mkdir -p $MAKE_FILE_SYS_DIR
8597

86-
cp -rf $COPY_DIR* $MAKE_FILE_SYS_DIR
98+
# Generated directories and files
99+
mkdir -p $MAKE_FILE_SYS_DIR
100+
gen_fs_tree "$MAKE_FILE_SYS_DIR" 1
87101

88102
# Make ISO9660 file system with different options.
89103
# Mount the ISO9660 file system with different mount options.

0 commit comments

Comments
 (0)