Skip to content

Commit 188b9de

Browse files
committed
Fix regressions caused by ASSERT output capture
This commit fixes the CI timeout issue where netdev tests would hang for 10 minutes and fail. The root cause was the ASSERT function capturing command output, which broke expect's TTY interaction. The original implementation executed commands directly without capture, which is essential for interactive commands like expect. Capturing output broke the TTY connection that expect requires.
1 parent d9deacb commit 188b9de

File tree

5 files changed

+21
-10
lines changed

5 files changed

+21
-10
lines changed

.ci/autorun.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
55
source "${SCRIPT_DIR}/common.sh"
66

7+
# Clean up any existing semu processes before starting tests
8+
cleanup
9+
710
ASSERT expect <<DONE
811
set timeout ${TIMEOUT}
912
spawn make check

.ci/check-format.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22

33
set -euo pipefail
44

5-
# Get list of source files into array
6-
mapfile -t SOURCES < <(git ls-files '*.c' '*.cxx' '*.cpp' '*.h' '*.hpp')
5+
# Get list of source files into array (POSIX-compatible for macOS bash 3.2)
6+
SOURCES=()
7+
while IFS= read -r file; do
8+
SOURCES+=("$file")
9+
done < <(git ls-files '*.c' '*.cxx' '*.cpp' '*.h' '*.hpp')
710

811
# Use clang-format dry-run mode with --Werror to fail on format violations
912
# This eliminates the need for temporary files and manual diff comparisons

.ci/common.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,15 @@ trap cleanup EXIT INT TERM
1818

1919
# ASSERT function - executes command and exits on failure
2020
ASSERT() {
21-
local cmd_output
2221
local exit_code
2322

2423
set +e
25-
cmd_output="$("$@" 2>&1)"
24+
"$@"
2625
exit_code=$?
2726
set -e
2827

2928
if [ "$exit_code" -ne 0 ]; then
3029
echo "Assert failed: $*" >&2
31-
echo "Output: $cmd_output" >&2
3230
exit "$exit_code"
3331
fi
3432
}
@@ -69,10 +67,10 @@ COLOR_RESET='\e[0m'
6967

7068
# Print success message
7169
print_success() {
72-
printf "\n[ ${COLOR_GREEN}$1${COLOR_RESET} ]\n"
70+
printf "\n[ ${COLOR_GREEN}%s${COLOR_RESET} ]\n" "$1"
7371
}
7472

7573
# Print error message
7674
print_error() {
77-
printf "\n[ ${COLOR_RED}$1${COLOR_RESET} ]\n" >&2
75+
printf "\n[ ${COLOR_RED}%s${COLOR_RESET} ]\n" "$1" >&2
7876
}

.ci/test-netdev.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ case "${OS_TYPE}" in
1818
;;
1919
esac
2020

21+
# Clean up any existing semu processes before starting tests
22+
cleanup
23+
2124
# Test network device functionality
2225
TEST_NETDEV() {
2326
local NETDEV="$1"

.github/workflows/main.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ concurrency:
88

99
permissions:
1010
contents: read
11+
actions: write
1112

1213
jobs:
1314
semu-linux:
1415
runs-on: ubuntu-24.04
1516
strategy:
17+
fail-fast: false
1618
matrix:
1719
dependency:
1820
- none
@@ -66,7 +68,6 @@ jobs:
6668
- name: netdev test
6769
run: .ci/test-netdev.sh
6870
shell: bash
69-
if: ${{ success() }}
7071
timeout-minutes: 10
7172

7273
semu-macOS:
@@ -137,8 +138,11 @@ jobs:
137138
run: |
138139
set -euo pipefail
139140
140-
# Get list of source files into array
141-
mapfile -t SOURCES < <(git ls-files '*.c' '*.cxx' '*.cpp' '*.h' '*.hpp')
141+
# Get list of source files into array (POSIX-compatible for macOS bash 3.2)
142+
SOURCES=()
143+
while IFS= read -r file; do
144+
SOURCES+=("$file")
145+
done < <(git ls-files '*.c' '*.cxx' '*.cpp' '*.h' '*.hpp')
142146
143147
# Register cleanup function to restore files on exit
144148
cleanup_files() {

0 commit comments

Comments
 (0)