diff mbox series

[ndctl] test/monitor.sh: Fix 2 bash syntax errors

Message ID 20241016030358.983042-1-lizhijian@fujitsu.com
State Superseded
Headers show
Series [ndctl] test/monitor.sh: Fix 2 bash syntax errors | expand

Commit Message

Zhijian Li (Fujitsu) Oct. 16, 2024, 3:03 a.m. UTC
$ grep -w line build/meson-logs/testlog.txt
test/monitor.sh: line 99: [: too many arguments
test/monitor.sh: line 99: [: nmem0: binary operator expected
test/monitor.sh: line 149: 40.0: syntax error: invalid arithmetic operator (error token is ".0")

- monitor_dimms could be a string with multiple *spaces*, like: "nmem0 nmem1 nmem2"
- inject_value is a float value, like 40.0, need to convert to integer.

Some features have not been really verified due to these errors

Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
---
 test/monitor.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/test/monitor.sh b/test/monitor.sh
index c5beb2c..544e57b 100755
--- a/test/monitor.sh
+++ b/test/monitor.sh
@@ -96,7 +96,7 @@  test_filter_region()
 	while [ $i -lt $count ]; do
 		monitor_region=$($NDCTL list -R -b $smart_supported_bus | jq -r .[$i].dev)
 		monitor_dimms=$(get_monitor_dimm "-r $monitor_region")
-		[ ! -z $monitor_dimms ] && break
+		[ ! -z "$monitor_dimms" ] && break
 		i=$((i + 1))
 	done
 	start_monitor "-r $monitor_region"
@@ -147,6 +147,7 @@  test_filter_dimmevent()
 
 	inject_value=$($NDCTL list -H -d $monitor_dimms | jq -r .[]."health"."temperature_threshold")
 	inject_value=$((inject_value + 1))
+	inject_value=${inject_value%.*}
 	start_monitor "-d $monitor_dimms -D dimm-media-temperature"
 	inject_smart "-m $inject_value"
 	check_result "$monitor_dimms"