Skip to content

Commit

Permalink
Tests: Final cleanup and added some edge case handling
Browse files Browse the repository at this point in the history
  • Loading branch information
SteelPh0enix committed Aug 16, 2023
1 parent 45c5074 commit 69910f3
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 21 deletions.
4 changes: 4 additions & 0 deletions calldwell/gdb_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,10 @@ def _handle_async_events(self, responses: GDBResponsesList):
self._program_state.last_stop_reason = stop_reason
self._program_state.program_frame = current_program_frame

if stop_reason == "signal-received":
# temporary fix for not detecting watchdog reset
self.program_state.was_reset = True

self._logger.info(
f"Program has stopped at {current_program_frame}, reason: {stop_reason}"
)
Expand Down
1 change: 1 addition & 0 deletions tests/requirements/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ mod test_boolean_condition;
mod test_event_cancellation;
mod test_event_clear_queue;
mod test_events;
mod test_hal_timer;
mod test_hal_watchdog;
mod test_message_queue;
mod test_tasklet_priority;
Expand Down
4 changes: 3 additions & 1 deletion tests/requirements/test_hal_timer.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ def init_test() -> Tuple[GDBClient, RTTClient, SSHClient]:
ssh.execute("./setup_debugging_sam_clean.sh")

gdb = GDBClient(GDB_EXECUTABLE, log_responses=False, log_execution=False)
gdb.connect_to_remote(f"{BOARD_HOSTNAME}:{BOARD_GDB_PORT}")
if not gdb.connect_to_remote(f"{BOARD_HOSTNAME}:{BOARD_GDB_PORT}"):
print(f"Could not connect to board @ {BOARD_HOSTNAME:{BOARD_GDB_PORT}}")
exit(1)
gdb.start_rtt_server(int(BOARD_RTT_PORT), 0)

rtt = RTTClient(BOARD_HOSTNAME, port=int(BOARD_RTT_PORT))
Expand Down
12 changes: 3 additions & 9 deletions tests/requirements/test_hal_timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,14 @@ use assert_cmd::Command;
/// @SRS{ROS-FUN-BSP-TIC-070}
#[cfg_attr(not(doc), test)]
#[ignore]
fn req_test_hal_watchdog() {
fn req_test_hal_timer() {
// TODO: Fix building the binary
// build_test_binary("test-hal-timer", "testbins").expect("error building test binary");

Command::new("python")
.arg("tests/requirements/test_hal_timer.py")
.timeout(std::time::Duration::from_secs(30))
.timeout(std::time::Duration::from_secs(60))
.assert()
.success()
.code(0)
.stdout(
r#"short task started
short task ended
long task started
"#,
);
.code(0);
}
6 changes: 3 additions & 3 deletions tests/requirements/test_hal_watchdog.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os

# import logging
import logging
from typing import Tuple
from calldwell.gdb_client import GDBClient
from calldwell.ssh_client import SSHClient
Expand Down Expand Up @@ -77,11 +77,11 @@ def main():

# Default watchdog timeout is 16s. Watchdog in this test is set to 3s, but timeout must be
# few seconds higher to compensate for communication delays and MCU clock inaccuracies.
gdb.wait_for_reset(timeout=5)
gdb.wait_for_reset(timeout=10)

finish_test(ssh)


if __name__ == "__main__":
# logging.basicConfig(level=logging.INFO)
logging.basicConfig(level=logging.INFO)
main()
10 changes: 2 additions & 8 deletions tests/requirements/test_hal_watchdog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,8 @@ fn req_test_hal_watchdog() {

Command::new("python")
.arg("tests/requirements/test_hal_watchdog.py")
.timeout(std::time::Duration::from_secs(30))
.timeout(std::time::Duration::from_secs(60))
.assert()
.success()
.code(0)
.stdout(
r#"short task started
short task ended
long task started
"#,
);
.code(0);
}

0 comments on commit 69910f3

Please sign in to comment.