Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions configs/renode/expected_logs.txt

This file was deleted.

2 changes: 1 addition & 1 deletion lib/dmlog
Submodule dmlog updated 1 files
+55 −14 tools/monitor/gdb.c
45 changes: 24 additions & 21 deletions scripts/run_renode_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#
# This script reproduces the Renode CI tests locally.
# It builds the firmware with emulation mode, starts Renode, runs monitor-gdb
# to capture firmware logs, verifies the expected log messages, checks that
# the shell answers on the console UART, checks the SD card (an image with a
# to capture firmware logs, checks that the monitor can read the ring over
# GDB, verifies boot through the console UART, checks the SD card (an image with a
# FAT16 partition inserted in the card slot: read, write, remount), checks the
# LCD (the display shows the splash screen at boot, then what lcdtest draws),
# checks the touch panel (touches injected through the Renode monitor reach
Expand Down Expand Up @@ -33,8 +33,6 @@ SOURCE_DIR="${1:-$(cd "$SCRIPT_DIR/.." && pwd)}"
BUILD_DIR="${2:-$SOURCE_DIR/build}"

BOARD="stm32f746g-disco"
EXPECTED_LOGS="$SOURCE_DIR/configs/renode/expected_logs.txt"
VERIFY_SCRIPT="$SOURCE_DIR/scripts/verify_renode_logs.sh"
UART_TEST_SCRIPT="$SOURCE_DIR/scripts/test_renode_uart.py"
UART_PORT=3456
SDCARD_IMAGE_SCRIPT="$SOURCE_DIR/scripts/make_sdcard_image.py"
Expand All @@ -50,16 +48,16 @@ NETWORK_TEST_SCRIPT="$SOURCE_DIR/scripts/test_renode_network.py"
TAP_INTERFACE=tap0

# Timeouts (seconds)
# Upper bound only: step 4 stops as soon as every expected line is captured
MONITOR_TIMEOUT=300
# Upper bound only: step 4 stops as soon as the monitor reads the ring header
MONITOR_READY_TIMEOUT=60
UART_TIMEOUT=90
SDCARD_TIMEOUT=90
LCD_TIMEOUT=120
TOUCH_TIMEOUT=120
NETWORK_TIMEOUT=120
# Renode has to outlive the monitor and the UART, SD card, LCD, touch and network tests
TESTS_TIMEOUT=$((UART_TIMEOUT + SDCARD_TIMEOUT + LCD_TIMEOUT + TOUCH_TIMEOUT + NETWORK_TIMEOUT))
CONNECT_TIMEOUT=$((MONITOR_TIMEOUT + TESTS_TIMEOUT + 60))
CONNECT_TIMEOUT=$((MONITOR_READY_TIMEOUT + TESTS_TIMEOUT + 60))

# The network test needs a TAP interface: root and /dev/net/tun
NETWORK_TEST=0
Expand Down Expand Up @@ -102,9 +100,8 @@ cmake -DCMAKE_BUILD_TYPE=Debug \
-S "$SOURCE_DIR" \
-B "$BUILD_DIR"
cmake --build "$BUILD_DIR" --config Debug
# The boot log is much larger than the 8 KiB dmlog ring, so the machine waits
# for monitor-gdb to attach (DMBOOT_RENODE_WAIT_FOR_GDB) - build the monitor
# now, so it does not eat into the monitoring time
# Build the monitor before starting Renode. The machine waits for GDB to attach
# (DMBOOT_RENODE_WAIT_FOR_GDB), so the monitor can follow boot from the start.
cmake --build "$BUILD_DIR" --target build_dmlog_monitor extract_ring_buffer_config
echo "✓ Build completed"
echo ""
Expand Down Expand Up @@ -145,31 +142,37 @@ echo "✓ Renode started successfully"
echo ""

# -------------------------------------------------------
# Step 4 – Run monitor-gdb and verify firmware logs
# Step 4 – Run monitor-gdb and verify access to the log ring
# -------------------------------------------------------
echo "[4/9] Running monitor-gdb to capture firmware logs..."
MONITOR_LOG="$BUILD_DIR/monitor.log"
# The monitor stays attached through steps 5 to 9: it keeps resuming the
# target between its reads, whereas stopping it mid-read could leave the
# target halted
timeout "$((MONITOR_TIMEOUT + TESTS_TIMEOUT))" cmake --build "$BUILD_DIR" --target monitor-gdb > "$MONITOR_LOG" 2>&1 &
timeout "$((MONITOR_READY_TIMEOUT + TESTS_TIMEOUT))" cmake --build "$BUILD_DIR" --target monitor-gdb > "$MONITOR_LOG" 2>&1 &
MONITOR_PID=$!

# Wait until every expected line has been captured, or MONITOR_TIMEOUT
MONITOR_DEADLINE=$((SECONDS + MONITOR_TIMEOUT))
# The ring contains only recent output. An earlier boot message can disappear
# while the monitor drains a busy boot, even when firmware starts correctly.
# The UART test in step 5 checks that boot reached a working shell.
MONITOR_READY_PATTERN="Connected to dmlog ring buffer at"
MONITOR_DEADLINE=$((SECONDS + MONITOR_READY_TIMEOUT))
while [ "$SECONDS" -lt "$MONITOR_DEADLINE" ] && kill -0 "$MONITOR_PID" 2>/dev/null; do
if bash "$VERIFY_SCRIPT" "$MONITOR_LOG" "$EXPECTED_LOGS" > /dev/null 2>&1; then
if grep -Fq "$MONITOR_READY_PATTERN" "$MONITOR_LOG" 2>/dev/null; then
break
fi
sleep 2
done

echo "Monitor output:"
cat "$MONITOR_LOG"
echo ""

# Verify expected log messages
bash "$VERIFY_SCRIPT" "$MONITOR_LOG" "$EXPECTED_LOGS"
if ! grep -Fq "$MONITOR_READY_PATTERN" "$MONITOR_LOG" 2>/dev/null; then
echo "✗ monitor-gdb could not read the dmlog ring within ${MONITOR_READY_TIMEOUT}s"
echo "--- monitor.log (tail) ---"
tail -n 80 "$MONITOR_LOG"
echo "--- connect.log (tail) ---"
tail -n 80 "$CONNECT_LOG"
exit 1
fi
echo "✓ monitor-gdb connected to the dmlog ring"
echo ""

# -------------------------------------------------------
Expand Down
56 changes: 0 additions & 56 deletions scripts/verify_renode_logs.sh

This file was deleted.

Loading