Skip to content

Commit

Permalink
test: Adjust tests to result packaging to tar
Browse files Browse the repository at this point in the history
  • Loading branch information
zsofiak96 authored and Florian Guggi committed Dec 9, 2023
1 parent 51cccce commit 29beea3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/software_tests/return_result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fn returns_result_correctly() -> TestResult {
COBC(DATA(return_result(7, 3))),
EDU(ACK),
ACTION(Box::new(|bytes| {
std::fs::File::create("tests/tmp/7.zip").unwrap().write(&bytes).unwrap();
std::fs::File::create("tests/tmp/7.tar").unwrap().write(&bytes[3..bytes.len()-4]).unwrap();
})),
COBC(ACK),
EDU(EOF),
Expand All @@ -43,10 +43,10 @@ fn returns_result_correctly() -> TestResult {
command::handle_command(&mut com, &mut exec);
assert!(com.is_complete());

std::process::Command::new("unzip")
std::process::Command::new("tar")
.current_dir("./tests/tmp")
.arg("-o")
.arg("7.zip")
.arg("xf")
.arg("7.tar")
.status()?;

assert_eq!(std::fs::read("tests/tmp/3")?, vec![0xde, 0xad]);
Expand Down Expand Up @@ -77,7 +77,7 @@ fn truncate_result() -> TestResult {
command::handle_command(&mut com, &mut exec);
assert!(com.is_complete());

assert!(std::fs::File::open("./data/8_5.zip")?.metadata()?.len() < 1_001_000);
assert!(std::fs::File::open("./data/8_5.tar")?.metadata()?.len() < 1_005_000);

common::cleanup("8");
Ok(())
Expand Down Expand Up @@ -119,7 +119,7 @@ fn stopped_return() -> TestResult {
command::handle_command(&mut com, &mut exec);
assert!(com.is_complete());

assert!(std::fs::File::open("./data/9_5.zip").is_ok());
assert!(std::fs::File::open("./data/9_5.tar").is_ok());

common::cleanup("9");
Ok(())
Expand Down Expand Up @@ -159,7 +159,7 @@ fn result_is_not_deleted_after_corrupted_transfer() -> TestResult {
command::handle_command(&mut com, &mut exec);
assert!(com.is_complete());

assert!(std::fs::File::open("./data/50_0.zip").is_ok());
assert!(std::fs::File::open("./data/50_0.tar").is_ok());

common::cleanup("50");
Ok(())
Expand Down

0 comments on commit 29beea3

Please sign in to comment.