Linux CXL
 help / color / mirror / Atom feed
* [ndctl PATCH v2] test/monitor.sh: Fix 2 bash syntax errors
@ 2024-10-16  5:20 Li Zhijian
  2024-10-16 22:45 ` Verma, Vishal L
  2024-10-17  1:00 ` Alison Schofield
  0 siblings, 2 replies; 5+ messages in thread
From: Li Zhijian @ 2024-10-16  5:20 UTC (permalink / raw)
  To: nvdimm; +Cc: linux-cxl, Li Zhijian

$ 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, which need to be converted to
  integer before operation: $((inject_value + 1))

Some features have not been really verified due to these errors

Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
---
V1:
 V1 has a mistake which overts to integer too late.
 Move the conversion forward before the operation
---
 test/monitor.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/test/monitor.sh b/test/monitor.sh
index c5beb2c..7809a7c 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"
@@ -146,6 +146,7 @@ test_filter_dimmevent()
 	stop_monitor
 
 	inject_value=$($NDCTL list -H -d $monitor_dimms | jq -r .[]."health"."temperature_threshold")
+	inject_value=${inject_value%.*}
 	inject_value=$((inject_value + 1))
 	start_monitor "-d $monitor_dimms -D dimm-media-temperature"
 	inject_smart "-m $inject_value"
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-10-17 15:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-16  5:20 [ndctl PATCH v2] test/monitor.sh: Fix 2 bash syntax errors Li Zhijian
2024-10-16 22:45 ` Verma, Vishal L
2024-10-17 15:57   ` Alison Schofield
2024-10-17  1:00 ` Alison Schofield
2024-10-17  3:30   ` Zhijian Li (Fujitsu)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox