[LTP] [PATCH v4 4/4] generate_lvm_runfile.sh: Fix bashism

Petr Vorel pvorel@suse.cz
Wed Aug 10 18:38:15 CEST 2022


Hi Martin,

> Hi,
> I've tested the patchset and the generator script now work correctly.

Thanks! I'll wait unless you suggest anything on 3rd commit and merge with this
style change below. FYI I tested various setup:

for i in y n 0 1 ""; do
	echo "== '$i' =="
	LTP_COLORIZE_OUTPUT=$i PATH="/opt/ltp/testcases/bin:$PATH" $f
	rc=$?
	echo "'$i': $rc"
	[ $rc -eq 0 ] || break
done

I also added patch for this test
https://lore.kernel.org/ltp/20220808122716.18556-1-pvorel@suse.cz/

Kind regards,
Petr

> Reviewed-by: Martin Doucha <mdoucha@suse.cz>

diff --git testcases/lib/tst_ansi_color.sh testcases/lib/tst_ansi_color.sh
index 517b709d0..04e120cf7 100644
--- testcases/lib/tst_ansi_color.sh
+++ testcases/lib/tst_ansi_color.sh
@@ -24,9 +24,16 @@ tst_flag2color()
 
 tst_color_enabled()
 {
-	[ "$LTP_COLORIZE_OUTPUT" = "n" -o "$LTP_COLORIZE_OUTPUT" = "0" ] || return 1
-	[ "$LTP_COLORIZE_OUTPUT" = "y" -o "$LTP_COLORIZE_OUTPUT" = "1" ] || return 0
+	if [ "$LTP_COLORIZE_OUTPUT" = "n" -o "$LTP_COLORIZE_OUTPUT" = "0" ]; then
+		return 0
+	fi
+
+	if [ "$LTP_COLORIZE_OUTPUT" = "y" -o "$LTP_COLORIZE_OUTPUT" = "1" ]; then
+		return 0
+	fi
+
 	[ -t 1 ] || return 0
+
 	return 1
 }
 


More information about the ltp mailing list