Fixed set -x
This commit is contained in:
parent
26c3927e75
commit
736703054e
1 changed files with 7 additions and 7 deletions
14
runtest.sh
14
runtest.sh
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set x
|
set -x
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
trap 'echo "[✖] Execution halted at line $LINENO. An unexpected error occurred. Please contact your nearest bash therapist." >&2' ERR
|
trap 'echo "[✖] Execution halted at line $LINENO. An unexpected error occurred. Please contact your nearest bash therapist." >&2' ERR
|
||||||
|
|
||||||
|
@ -115,18 +115,18 @@ while [ "$COUNTER" -lt "$NUM_TESTS" ]; do
|
||||||
local mode="$2"
|
local mode="$2"
|
||||||
local direction="$3"
|
local direction="$3"
|
||||||
local args=("-c" "$target" "-J" "-t" "10")
|
local args=("-c" "$target" "-J" "-t" "10")
|
||||||
|
|
||||||
if [ "$mode" = "udp" ]; then
|
if [ "$mode" = "udp" ]; then
|
||||||
args+=("-u")
|
args+=("-u")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$direction" = "down" ]; then
|
if [ "$direction" = "down" ]; then
|
||||||
args+=("--reverse")
|
args+=("--reverse")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local tmp_err
|
local tmp_err
|
||||||
tmp_err=$(mktemp)
|
tmp_err=$(mktemp)
|
||||||
|
|
||||||
local result
|
local result
|
||||||
result=$(iperf3 "${args[@]}" 2>"$tmp_err" | jq -r '
|
result=$(iperf3 "${args[@]}" 2>"$tmp_err" | jq -r '
|
||||||
if .error then
|
if .error then
|
||||||
|
@ -140,7 +140,7 @@ while [ "$COUNTER" -lt "$NUM_TESTS" ]; do
|
||||||
else
|
else
|
||||||
"unexpected-format"
|
"unexpected-format"
|
||||||
end' || echo "execution-failed")
|
end' || echo "execution-failed")
|
||||||
|
|
||||||
if [[ "$result" == "iperf3-error" || "$result" == "no-end" || "$result" == "unexpected-format" || "$result" == "execution-failed" ]]; then
|
if [[ "$result" == "iperf3-error" || "$result" == "no-end" || "$result" == "unexpected-format" || "$result" == "execution-failed" ]]; then
|
||||||
echo "$(date -Iseconds),iperf $mode $direction to $target failed with '$result'" >> "$FAILURE_LOG"
|
echo "$(date -Iseconds),iperf $mode $direction to $target failed with '$result'" >> "$FAILURE_LOG"
|
||||||
echo "[stderr] $(cat "$tmp_err")" >> "$FAILURE_LOG"
|
echo "[stderr] $(cat "$tmp_err")" >> "$FAILURE_LOG"
|
||||||
|
@ -148,7 +148,7 @@ while [ "$COUNTER" -lt "$NUM_TESTS" ]; do
|
||||||
else
|
else
|
||||||
echo "$result"
|
echo "$result"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f "$tmp_err"
|
rm -f "$tmp_err"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue