* [LTP] [PATCH] isofs: Convert to new library
@ 2019-12-09 9:36 Joerg Vehlow
2019-12-18 10:39 ` Petr Vorel
0 siblings, 1 reply; 5+ messages in thread
From: Joerg Vehlow @ 2019-12-09 9:36 UTC (permalink / raw)
To: ltp
From: Joerg Vehlow <joerg.vehlow@aox-tech.de>
Signed-off-by: Joerg Vehlow <joerg.vehlow@aox-tech.de>
---
testcases/kernel/fs/iso9660/isofs.sh | 193 ++++++++++-----------------
1 file changed, 71 insertions(+), 122 deletions(-)
diff --git a/testcases/kernel/fs/iso9660/isofs.sh b/testcases/kernel/fs/iso9660/isofs.sh
index 5f90354d9..43a079a14 100755
--- a/testcases/kernel/fs/iso9660/isofs.sh
+++ b/testcases/kernel/fs/iso9660/isofs.sh
@@ -1,21 +1,6 @@
#!/bin/sh
-#
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2003
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
# Written by Prakash Narayana (prakashn@us.ibm.com)
# and Michael Reed (mreed10@us.ibm.com)
#
@@ -24,40 +9,25 @@
# mounts the ISO9660 file system with different mount options.
#
-TCID=isofs
-TST_TOTAL=77
-. test.sh
+TST_NEEDS_CMDS="mkisofs"
+TST_NEEDS_TMPDIR=1
+TST_TESTFUNC=do_test
-NO_CLEANUP=""
+. tst_test.sh
-usage()
-{
- echo "USAGE: $0 <optional> -n -h"
- exit
-}
-
-cleanup()
-{
- if [ "$NO_CLEANUP" = "no" ]; then
- tst_resm TINFO "Temporary directory $PWD was not removed"
- else
- tst_rmdir
- fi
-}
-
-max_depth=3
-max_dirs=4
+MAX_DEPTH=3
+MAX_DIRS=4
gen_fs_tree()
{
local cur_path="$1"
local cur_depth="$2"
- if [ "$cur_depth" -gt "$max_depth" ]; then
+ if [ "$cur_depth" -gt "$MAX_DEPTH" ]; then
return
fi
- for i in $(seq 1 $max_dirs); do
+ for i in $(seq 1 $MAX_DIRS); do
local new_path="$cur_path/subdir_$i"
mkdir -p "$new_path"
@@ -68,94 +38,73 @@ gen_fs_tree()
done
}
-while getopts :hnd: arg; do
- case $arg in
- h)
- echo ""
- echo "n - The directories created will not be removed"
- echo "h - Help options"
- echo ""
- usage
- echo ""
- ;;
- n)
- NO_CLEANUP="no"
- ;;
- esac
-done
-
-tst_require_root
-
-tst_tmpdir
-TST_CLEANUP=cleanup
-
-MNT_POINT="$PWD/mnt"
-MAKE_FILE_SYS_DIR="$PWD/files"
-
-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
-
-# Make ISO9660 file system with different options.
-# Mount the ISO9660 file system with different mount options.
-
-tst_require_cmds mkisofs
-
-for mkisofs_opt in \
- " " \
- "-J" \
- "-hfs -D" \
- " -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"
-do
- rm -f isofs.iso
- mkisofs -o isofs.iso -quiet $mkisofs_opt $MAKE_FILE_SYS_DIR 2> /dev/null
- if [ $? -eq 0 ]; then
- tst_resm TPASS \
- "mkisofs -o isofs.iso -quiet $mkisofs_opt $MAKE_FILE_SYS_DIR"
- else
- tst_resm TFAIL \
- tst_resm TFAIL "mkisofs -o isofs.iso -quiet $mkisofs_opt $MAKE_FILE_SYS_DIR"
- continue
- fi
+do_test() {
+ local mnt_point="$PWD/mnt"
+ local make_file_sys_dir="$PWD/files"
+
+ 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
+
+ # Make ISO9660 file system with different options.
+ # Mount the ISO9660 file system with different mount options.
- for mount_opt in \
- "loop" \
- "loop,norock" \
- "loop,nojoliet" \
- "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,check=relaxed,map=normal" \
- "loop,block=512,unhide,session=2"
- # "loop,sbsector=32"
+ for mkisofs_opt in \
+ " " \
+ "-J" \
+ "-hfs -D" \
+ " -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"
do
- mount -t iso9660 -o $mount_opt isofs.iso $MNT_POINT
- if [ $? -ne 0 ]; then
+ rm -f isofs.iso
+ mkisofs -o isofs.iso -quiet $mkisofs_opt $make_file_sys_dir 2> /dev/null
+ if [ $? -eq 0 ]; then
+ tst_res TPASS \
+ "mkisofs -o isofs.iso -quiet $mkisofs_opt $make_file_sys_dir"
+ else
tst_resm TFAIL \
- "mount -t iso9660 -o $mount_opt isofs.iso $MNT_POINT"
+ tst_res TFAIL "mkisofs -o isofs.iso -quiet $mkisofs_opt $make_file_sys_dir"
continue
fi
- ls -lR $MNT_POINT > /dev/null
- if [ $? -ne 0 ]; then
- tst_resm TFAIL "ls -lR $MNT_POINT"
- fi
-
- umount $MNT_POINT
- if [ $? -ne 0 ]; then
- tst_brkm TFAIL "umount $MNT_POINT"
- fi
-
- tst_resm TPASS "mount/umount with \"$mount_opt\" options"
+ for mount_opt in \
+ "loop" \
+ "loop,norock" \
+ "loop,nojoliet" \
+ "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,check=relaxed,map=normal" \
+ "loop,block=512,unhide,session=2"
+ # "loop,sbsector=32"
+ do
+ mount -t iso9660 -o $mount_opt isofs.iso $mnt_point
+ if [ $? -ne 0 ]; then
+ tst_res TFAIL \
+ "mount -t iso9660 -o $mount_opt isofs.iso $mnt_point"
+ continue
+ fi
+
+ ls -lR $mnt_point > /dev/null
+ if [ $? -ne 0 ]; then
+ tst_res TFAIL "ls -lR $mnt_point"
+ fi
+
+ umount $mnt_point
+ if [ $? -ne 0 ]; then
+ tst_brk TFAIL "umount $mnt_point"
+ fi
+
+ tst_res TPASS "mount/umount with \"$mount_opt\" options"
+ done
done
-done
+}
-tst_exit
+tst_run
--
2.20.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [LTP] [PATCH] isofs: Convert to new library
2019-12-09 9:36 [LTP] [PATCH] isofs: Convert to new library Joerg Vehlow
@ 2019-12-18 10:39 ` Petr Vorel
2019-12-18 10:59 ` Petr Vorel
0 siblings, 1 reply; 5+ messages in thread
From: Petr Vorel @ 2019-12-18 10:39 UTC (permalink / raw)
To: ltp
Hi Joerg,
thanks a lot for your patch, merged with few minor changes:
(mostly changing style + remove forgotten 'tst_resm TFAIL \',
use ROD_SILENT and remove commented out '# "loop,sbsector=32"').
You correctly removed getopt options: -n just set NO_CLEANUP, which is not used
any more on test.sh. Both libraries support TST_NO_CLEANUP, so we should
document it (going to send a patch).
Kind regards,
Petr
^ permalink raw reply [flat|nested] 5+ messages in thread
* [LTP] [PATCH] isofs: Convert to new library
2019-12-18 10:39 ` Petr Vorel
@ 2019-12-18 10:59 ` Petr Vorel
2019-12-18 11:03 ` Joerg Vehlow
0 siblings, 1 reply; 5+ messages in thread
From: Petr Vorel @ 2019-12-18 10:59 UTC (permalink / raw)
To: ltp
Hi Joerg,
> You correctly removed getopt options: -n just set NO_CLEANUP, which is not used
> any more on test.sh. Both libraries support TST_NO_CLEANUP, so we should
> document it (going to send a patch).
In the end I just merged that simple doc change.
I wonder if there would be use for variable keeping $TST_TMPDIR (because it's
deleted even with $TST_NO_CLEANUP).
Kind regards,
Petr
^ permalink raw reply [flat|nested] 5+ messages in thread
* [LTP] [PATCH] isofs: Convert to new library
2019-12-18 10:59 ` Petr Vorel
@ 2019-12-18 11:03 ` Joerg Vehlow
2019-12-18 15:30 ` Petr Vorel
0 siblings, 1 reply; 5+ messages in thread
From: Joerg Vehlow @ 2019-12-18 11:03 UTC (permalink / raw)
To: ltp
Hi Petr,
thanks for merging
>> You correctly removed getopt options: -n just set NO_CLEANUP, which is not used
>> any more on test.sh. Both libraries support TST_NO_CLEANUP, so we should
>> document it (going to send a patch).
> In the end I just merged that simple doc change.
> I wonder if there would be use for variable keeping $TST_TMPDIR (because it's
> deleted even with $TST_NO_CLEANUP).
I think that was the reason why I completely removed the flag in the
first place.
Also I did not see any reason to keep the tempdir. If I ever needed this
in the past, I just modified the test.
J?rg
^ permalink raw reply [flat|nested] 5+ messages in thread
* [LTP] [PATCH] isofs: Convert to new library
2019-12-18 11:03 ` Joerg Vehlow
@ 2019-12-18 15:30 ` Petr Vorel
0 siblings, 0 replies; 5+ messages in thread
From: Petr Vorel @ 2019-12-18 15:30 UTC (permalink / raw)
To: ltp
Hi J?rg,
> thanks for merging
> > > You correctly removed getopt options: -n just set NO_CLEANUP, which is not used
> > > any more on test.sh. Both libraries support TST_NO_CLEANUP, so we should
> > > document it (going to send a patch).
> > In the end I just merged that simple doc change.
> > I wonder if there would be use for variable keeping $TST_TMPDIR (because it's
> > deleted even with $TST_NO_CLEANUP).
> I think that was the reason why I completely removed the flag in the first
> place.
+1.
> Also I did not see any reason to keep the tempdir. If I ever needed this in
> the past, I just modified the test.
Thanks for info. You're right, it's probably useless.
Kind regards,
Petr
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-12-18 15:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-09 9:36 [LTP] [PATCH] isofs: Convert to new library Joerg Vehlow
2019-12-18 10:39 ` Petr Vorel
2019-12-18 10:59 ` Petr Vorel
2019-12-18 11:03 ` Joerg Vehlow
2019-12-18 15:30 ` Petr Vorel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.