From 1307955013eacd406d77715644f27c647966b6b7 Mon Sep 17 00:00:00 2001 From: hwang104 Date: Mon, 11 Nov 2024 14:02:01 -0600 Subject: [PATCH] sanitize core count variable --- templates/memtest.script.epp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/templates/memtest.script.epp b/templates/memtest.script.epp index acdbabe..08a2d50 100644 --- a/templates/memtest.script.epp +++ b/templates/memtest.script.epp @@ -38,10 +38,7 @@ verbose () { fi } -# Look up expected performance value for current node -found=-1 -core_count=1 - +# Read memtest_table for the appropriate performance values and core counts (if defined) while read -r host threshold cores do if [[ "$HOSTNAME" =~ $host ]] @@ -54,13 +51,19 @@ do done < $performance_table # Exit if hostname cannot be matched in the lookup table -if (( $found < 0 )) +if [[ -z "$found" ]] then logger "STREAM: no match for $HOSTNAME in the performance table" verbose "Error: no match for $HOSTNAME in the performance table" exit 1 fi +# Set core_count to 1 if not otherwise specified +if [[ -z "$core_count" ]] +then + core_count=1 +fi + # Grab Triad stream rate from STREAM. Loop through all cores for ((i=0; i