@@ -17,65 +17,65 @@ echo "Determining maximum mpps the machine can handle"
echo "Will take a few minutes to determine mpps value"
echo "And 10 minutes run to confirm the final mpps value is stable"
-for mpps in `seq 3 3 50`; do
- echo testing $mpps Mpps
+for mpps in $(seq 3 3 50); do
+ echo testing "$mpps" Mpps
- OUTFILE=`mktemp`
- $PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f `sh get_cpuinfo_mhz.sh` -p "$mpps" -t 30 > $OUTFILE
+ OUTFILE=$(mktemp)
+ $PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f "$(sh get_cpuinfo_mhz.sh)" -p "$mpps" -t 30 > "$OUTFILE"
- exceeded=`grep exceeded $OUTFILE`
+ exceeded=$(grep exceeded "$OUTFILE")
if [ ! -z "$exceeded" ]; then
- echo mpps failed: $mpps
+ echo mpps failed: "$mpps"
break;
fi
echo success
done
-echo first loop mpps: $mpps
+echo first loop mpps: "$mpps"
first_mpps=$(($mpps - 1))
-for mpps in `seq $first_mpps -1 3`; do
- echo testing $mpps Mpps
+for mpps in $(seq $first_mpps -1 3); do
+ echo testing "$mpps" Mpps
- OUTFILE=`mktemp`
- $PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f `sh get_cpuinfo_mhz.sh` -p "$mpps" -t 30 > $OUTFILE
+ OUTFILE=$(mktemp)
+ $PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f "$(sh get_cpuinfo_mhz.sh)" -p "$mpps" -t 30 > "$OUTFILE"
- exceeded=`grep exceeded $OUTFILE`
+ exceeded=$(grep exceeded "$OUTFILE")
if [ -z "$exceeded" ]; then
- echo mpps success $mpps
+ echo mpps success "$mpps"
break;
fi
echo failure
done
-second_mpps=`echo "$mpps + 0.3" | bc`
-echo second loop mpps: $mpps
+second_mpps=$(echo "$mpps + 0.3" | bc)
+echo second loop mpps: "$mpps"
-for mpps in `seq $second_mpps 0.3 $first_mpps`; do
- echo testing $mpps Mpps
+for mpps in $(seq "$second_mpps" 0.3 $first_mpps); do
+ echo testing "$mpps" Mpps
- OUTFILE=`mktemp`
- $PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f `sh get_cpuinfo_mhz.sh` -p "$mpps" -t 30 > $OUTFILE
+ OUTFILE=$(mktemp)
+ $PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f "$(sh get_cpuinfo_mhz.sh)" -p "$mpps" -t 30 > "$OUTFILE"
- exceeded=`grep exceeded $OUTFILE`
+ exceeded=$(grep exceeded "$OUTFILE")
if [ ! -z "$exceeded" ]; then
- echo mpps failure $mpps
+ echo mpps failure "$mpps"
break;
fi
echo success
done
-echo third loop mpps: $mpps
-third_mpps=`echo "$mpps -0.1" | bc`
+echo third loop mpps: "$mpps"
+third_mpps=$(echo "$mpps -0.1" | bc)
-for mpps in `seq $third_mpps -0.1 3`; do
- echo testing $mpps Mpps
+for mpps in $(seq "$third_mpps" -0.1 3); do
+ echo testing "$mpps" Mpps
- OUTFILE=`mktemp`
- $PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f `sh get_cpuinfo_mhz.sh` -p "$mpps" -t 30 > $OUTFILE
+ OUTFILE=$(mktemp)
+ $PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f "$(sh get_cpuinfo_mhz.sh)" -p "$mpps" -t 30 > "$OUTFILE"
- exceeded=`grep exceeded $OUTFILE`
+ exceeded=$(grep exceeded "$OUTFILE")
if [ -z "$exceeded" ]; then
- echo mpps success $mpps
+ echo mpps success "$mpps"
break;
fi
echo failure
@@ -89,14 +89,14 @@ while [ $queuelat_failure == 1 ]; do
echo -n "Starting 10 runs of 30 seconds with "
echo "$mpps Mpps"
- for i in `seq 1 10`; do
- $PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f `get_cpuinfo_mhz.sh` -p "$mpps" -t 30 > $OUTFILE
- exceeded=`grep exceeded $OUTFILE`
+ for i in $(seq 1 10); do
+ $PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f "$(get_cpuinfo_mhz.sh)" -p "$mpps" -t 30 > "$OUTFILE"
+ exceeded=$(grep exceeded "$OUTFILE")
if [ ! -z "$exceeded" ]; then
echo "mpps failure (run $i) $mpps"
export queuelat_failure=1
- mpps=`echo $mpps - 0.1 | bc`
+ mpps=$(echo "$mpps" - 0.1 | bc)
export mpps
break
fi
@@ -113,19 +113,20 @@ while [ $queuelat_failure == 1 ]; do
echo -n "Starting 10 minutes run with "
echo "$mpps Mpps"
- $PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f `get_cpuinfo_mhz.sh` -p "$mpps" -t 600 > $OUTFILE
- exceeded=`grep exceeded $OUTFILE`
+ $PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f "$(get_cpuinfo_mhz.sh)" -p "$mpps" -t 600 > "$OUTFILE"
+ exceeded=$(grep exceeded "$OUTFILE")
if [ ! -z "$exceeded" ]; then
echo "mpps failure (run $i) $mpps"
export queuelat_failure=1
- export mpps=`echo $mpps - 0.1 | bc`
+ mpps=$(echo "$mpps" - 0.1 | bc)
+ export mpps
continue
fi
echo "run $i success"
done
-echo Final mpps is: $mpps
+echo Final mpps is: "$mpps"
unset queuelat_failure
unset mpps
Fix a number of issues in the script determine_maximum_mpps.sh such as 1. Convert legacy backticks to $(...) notation 2. Double quote where necessary to prevent globbing 3. Double quote where necessary to prevent word splitting. Note: these fixes are more than just cosmetic, they are needed for the script to work correctly. Signed-off-by: John Kacur <jkacur@redhat.com> --- src/queuelat/determine_maximum_mpps.sh | 75 +++++++++++++------------- 1 file changed, 38 insertions(+), 37 deletions(-)