Skip to content

Commit

Permalink
sanitize core count variable
Browse files Browse the repository at this point in the history
  • Loading branch information
inwho committed Nov 11, 2024
1 parent a2c7401 commit 1307955
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions templates/memtest.script.epp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]]
Expand All @@ -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<core_count; i++))
do
Expand Down

0 comments on commit 1307955

Please sign in to comment.