Skip to content

Commit

Permalink
Move hardware-in-the-loop test into main binary.
Browse files Browse the repository at this point in the history
  • Loading branch information
martinling committed Jun 14, 2024
1 parent 2c3b681 commit b86d678
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
6 changes: 0 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,3 @@ record-ui-test = ["serde", "serde_json"]
test-ui-replay = ["serde", "serde_json"]
debug-region-map = []
test-cynthion = []

[[test]]
name = "test_cynthion"
path = "src/test_cynthion.rs"
harness = false
required-features = ["test-cynthion"]
19 changes: 12 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,19 @@ use packetry::ui::{
};

fn main() {
let application = gtk::Application::new(
Some("com.greatscottgadgets.packetry"),
ApplicationFlags::NON_UNIQUE
);
application.connect_activate(|app| display_error(activate(app)));
application.run_with_args::<&str>(&[]);
display_error(stop_cynthion());
if std::env::args().any(|arg| arg == "--test-cynthion") {
test_cynthion::run_test();
} else {
let application = gtk::Application::new(
Some("com.greatscottgadgets.packetry"),
ApplicationFlags::NON_UNIQUE
);
application.connect_activate(|app| display_error(activate(app)));
application.run_with_args::<&str>(&[]);
display_error(stop_cynthion());
}
}

mod test_cynthion;
#[cfg(test)]
mod test_replay;
2 changes: 1 addition & 1 deletion src/test_cynthion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use nusb::transfer::RequestBuffer;
use std::thread::sleep;
use std::time::Duration;

fn main() {
pub fn run_test() {
for (speed, ep_addr, length) in [
(Speed::High, 0x81, 4096),
(Speed::Full, 0x82, 512),
Expand Down

0 comments on commit b86d678

Please sign in to comment.