Skip to content

Commit d027ba1

Browse files
committed
tests(wifi): Fix argument passing
1 parent d1270e5 commit d027ba1

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

.github/scripts/tests_run.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ function run_test {
9292
if [[ -f "$sketchdir/diagram.$target.json" ]]; then
9393
extra_args+=("--wokwi-diagram" "$sketchdir/diagram.$target.json")
9494
fi
95-
9695
elif [ $platform == "qemu" ]; then
9796
PATH=$HOME/qemu/bin:$PATH
9897
extra_args=("--embedded-services" "qemu" "--qemu-image-path" "$build_dir/$sketchname.ino.merged.bin")
@@ -161,7 +160,6 @@ while [ -n "$1" ]; do
161160
platform="qemu"
162161
;;
163162
-W )
164-
shift
165163
if [[ -z $WOKWI_CLI_TOKEN ]]; then
166164
echo "Wokwi CLI token is not set"
167165
exit 1

.gitlab/workflows/hw_test_template.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ include:
1212
hw-test-template:
1313
stage: test
1414
image: python:3.12-bookworm
15+
timeout: 5h
1516

1617
rules:
1718
- when: on_success
1819

1920
variables:
2021
RUNNER_SCRIPT_TIMEOUT: 4h
21-
RUNNER_AFTER_SCRIPT_TIMEOUT: 2h
2222
DEBIAN_FRONTEND: "noninteractive"
2323
TEST_TYPE: $TEST_TYPE
2424
TEST_CHIP: $TEST_CHIP

tests/validation/wifi/test_wifi.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ def test_wifi(dut, wifi_ssid, wifi_pass):
1515

1616
dut.expect_exact("Send SSID:")
1717
LOGGER.info(f"Sending WiFi credentials: SSID={wifi_ssid}")
18-
dut.write(f"{wifi_ssid}")
18+
dut.write(f"{wifi_ssid}\n")
1919

2020
dut.expect_exact("Send Password:")
2121
LOGGER.info(f"Sending WiFi password: Password={wifi_pass}")
22-
dut.write(f"{wifi_pass or ''}")
22+
dut.write(f"{wifi_pass or ''}\n")
2323

2424
# Verify credentials were received
2525
dut.expect_exact(f"SSID: {wifi_ssid}")

tests/validation/wifi/wifi.ino

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ void WiFiGotIP(WiFiEvent_t event, WiFiEventInfo_t info) {
8989

9090
void readWiFiCredentials() {
9191
Serial.println("Waiting for WiFi credentials...");
92+
93+
// Flush any existing data in serial buffer
94+
while (Serial.available()) {
95+
Serial.read();
96+
}
97+
9298
Serial.println("Send SSID:");
9399

94100
// Wait for SSID
@@ -100,11 +106,17 @@ void readWiFiCredentials() {
100106
delay(100);
101107
}
102108

109+
// Flush any remaining data from SSID input
110+
while (Serial.available()) {
111+
Serial.read();
112+
}
113+
103114
Serial.println("Send Password:");
104115

105116
// Wait for password (allow empty password)
106117
bool password_received = false;
107-
while (!password_received) {
118+
unsigned long timeout = millis() + 10000; // 10 second timeout
119+
while (!password_received && millis() < timeout) {
108120
if (Serial.available()) {
109121
password = Serial.readStringUntil('\n');
110122
password.trim();
@@ -113,6 +125,11 @@ void readWiFiCredentials() {
113125
delay(100);
114126
}
115127

128+
// Flush any remaining data
129+
while (Serial.available()) {
130+
Serial.read();
131+
}
132+
116133
Serial.print("SSID: ");
117134
Serial.println(ssid);
118135
Serial.print("Password: ");

0 commit comments

Comments
 (0)