[LTP] [PATCH v3 4/4] generate_lvm_runfile.sh: Fix bashism
Petr Vorel
pvorel@suse.cz
Mon Aug 8 12:10:19 CEST 2022
ERR is not on dash (tested on 0.5.11).
using -e (i.e. implying 'set -e') is required to exit on any non zero
exit code. It requires 2 previous fixes.
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
testcases/misc/lvm/generate_lvm_runfile.sh | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/testcases/misc/lvm/generate_lvm_runfile.sh b/testcases/misc/lvm/generate_lvm_runfile.sh
index 72b286a69..aba706c64 100755
--- a/testcases/misc/lvm/generate_lvm_runfile.sh
+++ b/testcases/misc/lvm/generate_lvm_runfile.sh
@@ -1,6 +1,7 @@
-#!/bin/sh
+#!/bin/sh -e
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) 2020 SUSE LLC <mdoucha@suse.cz>
+# Copyright (c) Linux Test Project, 2022
#
# Generate LTP runfile for LVM tests (runtest/lvm.local)
@@ -13,7 +14,7 @@ LVM_TMPDIR="$LVM_DIR/ltp/growfiles"
generate_runfile()
{
- trap 'tst_brk TBROK "Cannot create LVM runfile"' ERR
+ trap '[ $? -eq 0 ] || tst_brk TBROK "Cannot create LVM runfile"' EXIT
INFILE="$LTPROOT/testcases/data/lvm/runfile.tpl"
OUTFILE="$LTPROOT/runtest/lvm.local"
FS_LIST=`tst_supported_fs`
--
2.37.1
More information about the ltp
mailing list