From 012dacab930f00295c9adc89f0a850b29fa2cc26 Mon Sep 17 00:00:00 2001 From: Shaowei Song Date: Wed, 6 Nov 2024 11:08:56 +0000 Subject: [PATCH] Ensure only numeric values are extracted from the benchmark results --- test/benchmark/bench_linux_and_aster.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/benchmark/bench_linux_and_aster.sh b/test/benchmark/bench_linux_and_aster.sh index c2575629f..cf3bb4f12 100755 --- a/test/benchmark/bench_linux_and_aster.sh +++ b/test/benchmark/bench_linux_and_aster.sh @@ -24,9 +24,10 @@ parse_results() { local result_template="$6" local result_file="$7" + # Extract numeric result from a specific field in the matching line local linux_result aster_result - linux_result=$(awk "/${search_pattern}/ {result=\$$result_index} END {print result}" "${linux_output}" | tr -d '\r') - aster_result=$(awk "/${search_pattern}/ {result=\$$result_index} END {print result}" "${aster_output}" | tr -d '\r') + linux_result=$(awk "/${search_pattern}/ {result=\$$result_index} END {print result}" "${linux_output}" | tr -d '\r' | sed 's/[^0-9.]*//g') + aster_result=$(awk "/${search_pattern}/ {result=\$$result_index} END {print result}" "${aster_output}" | tr -d '\r' | sed 's/[^0-9.]*//g') if [ -z "${linux_result}" ] || [ -z "${aster_result}" ]; then echo "Error: Failed to parse the results from the benchmark output" >&2