From 03712a82865c06ea8872005a2d4664335469a664 Mon Sep 17 00:00:00 2001 From: Hongyu Ning Date: Thu, 5 Sep 2024 09:58:09 +0800 Subject: [PATCH] [tdx-guest] Bug Fix: remove potential whitespace in server ID in corner case, server ID return trimed value still has leading whitespace, remove such potential leading and trailing whitespace for correct server target operation [Test Components] tdx-guest [Test Types] func [Supported Devices] spr,emr,gnr,srf Signed-off-by: Hongyu Ning --- BM/tdx-guest/tdx_speed_test.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/BM/tdx-guest/tdx_speed_test.sh b/BM/tdx-guest/tdx_speed_test.sh index 2451f79..bde8d0a 100755 --- a/BM/tdx-guest/tdx_speed_test.sh +++ b/BM/tdx-guest/tdx_speed_test.sh @@ -46,6 +46,8 @@ fi # get nearest server ID for test while [[ "$RETRY_ID" -gt 0 ]]; do ID=$(speedtest-cli --list | awk -F')' 'NR==2 {print $1; exit}') + # remove potential whitespace before or after server ID + ID=$(echo "$ID" | awk '{$1=$1; print}') if [[ "$ID" =~ ^[0-9]+$ ]]; then if [ "$ID" -gt 0 ]; then test_print_trc "BW test server ID: $ID @RETRY: $RETRY_ID"