From 736703054ebc2d3fe27d981891b2239568a02944 Mon Sep 17 00:00:00 2001 From: Yaro Kasear Date: Mon, 21 Apr 2025 13:55:41 -0500 Subject: [PATCH] Fixed set -x --- runtest.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/runtest.sh b/runtest.sh index ed0b0fb..d70f17d 100755 --- a/runtest.sh +++ b/runtest.sh @@ -1,6 +1,6 @@ #!/bin/bash -set x +set -x set -euo pipefail 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 direction="$3" local args=("-c" "$target" "-J" "-t" "10") - + if [ "$mode" = "udp" ]; then args+=("-u") fi - + if [ "$direction" = "down" ]; then args+=("--reverse") fi - + local tmp_err tmp_err=$(mktemp) - + local result result=$(iperf3 "${args[@]}" 2>"$tmp_err" | jq -r ' if .error then @@ -140,7 +140,7 @@ while [ "$COUNTER" -lt "$NUM_TESTS" ]; do else "unexpected-format" end' || echo "execution-failed") - + 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 "[stderr] $(cat "$tmp_err")" >> "$FAILURE_LOG" @@ -148,7 +148,7 @@ while [ "$COUNTER" -lt "$NUM_TESTS" ]; do else echo "$result" fi - + rm -f "$tmp_err" }