Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NF-613: Fix card.binary HIL tests. #160

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
23 changes: 14 additions & 9 deletions .github/workflows/notecard-binary-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,24 +186,25 @@ jobs:
cd hil_lab/
pip install -r requirements.txt

# Reserve a Notestation with the label "note_c_card_binary_test",
# which means it has everything needed to run the note-c card.binary
# tests.
# For now, we're hardcoding the Notestation to
# los-angeles-notestation-1, which is the only one we've set up to run
# these tests.
cd notestation/
nohup python -m core.card_client \
--mcu-debug \
--labels '["note_c_card_binary_test"]' \
--res-file ./reservation.json &> card_client.log &
--notestation los-angeles-notestation-1 \
--work-dir /tmp &> card_client.log &

PID=$!
RES_FILE=/tmp/ns_reservation.json

timeout=600 # 10 minutes in seconds
interval=1 # Check every second
elapsed=0

# If we aren't able to reserve a Notestation after 10 minutes, or if
# the card_client fails, bail.
while [ ! -f ./reservation.json ]; do
while [ ! -f $RES_FILE ]; do
sleep $interval
elapsed=$((elapsed + interval))

Expand All @@ -215,7 +216,7 @@ jobs:
fi

if [ $elapsed -ge $timeout ]; then
echo "Timeout reached: reservation.json did not appear."
echo "Timeout reached: $RES_FILE did not appear."
kill $PID 2>/dev/null
exit 1
fi
Expand All @@ -225,17 +226,19 @@ jobs:

# Set these environment variables, which are read in platformio.ini in
# order to flash the Swan with the test firmware.
export MCU_GDB_SERVER_IP="$(jq -r '.notestation' ./reservation.json)"
export MCU_GDB_SERVER_PORT="$(jq -r '.mcu_openocd.gdb' ./reservation.json)"
export MCU_GDB_SERVER_IP="$(jq -r '.notestation' $RES_FILE)"
export MCU_GDB_SERVER_PORT="$(jq -r '.mcu_openocd.gdb' $RES_FILE)"
export GDB_CMD="gdb-multiarch"

if [ -z "$MCU_GDB_SERVER_IP" ] || [ "$MCU_GDB_SERVER_IP" == "null" ]; then
echo "Error: MCU_GDB_SERVER_IP is empty or not defined."
kill $PID 2>/dev/null
exit 1
fi

if [ -z "$MCU_GDB_SERVER_PORT" ] || [ "$MCU_GDB_SERVER_PORT" -eq 0 ]; then
echo "Error: MCU_GDB_SERVER_PORT is empty or zero."
kill $PID 2>/dev/null
exit 1
fi

Expand All @@ -256,6 +259,8 @@ jobs:
--json-output-path test.json \
--junit-output-path test.xml

kill $PID 2>/dev/null

- name: Publish test report
uses: mikepenz/action-junit-report@v3
env:
Expand Down
4 changes: 2 additions & 2 deletions test/hitl/card.binary/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ extra_scripts = post:wait_for_test_port.py
build_type = debug
debug_test = *
upload_protocol = custom
upload_command = ${sysenv.GDB_CMD} -ex "set confirm off" -ex "set pagination off" -ex "target extended-remote ${sysenv.MCU_GDB_SERVER_IP}:${sysenv.MCU_GDB_SERVER_PORT}" -ex "monitor reset halt" -ex "file .pio/build/debug/firmware.elf" -ex "load" -ex "monitor reset" -ex "quit"
test_port = /tmp/mcu_usb
upload_command = ${sysenv.GDB_CMD} -ex "set confirm off" -ex "set pagination off" -ex "file .pio/build/debug/firmware.elf" -ex "target extended-remote ${sysenv.MCU_GDB_SERVER_IP}:${sysenv.MCU_GDB_SERVER_PORT}" -ex "monitor reset halt" -ex "load" -ex "monitor reset" -ex "quit"
test_port = /tmp/ns_mcu_usb
Loading