Skip to content

Commit

Permalink
Fix testing for s390x
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Nov 5, 2024
1 parent 5b11cae commit 2b63fba
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ jobs:
features: ""
target: "s390x-unknown-linux-gnu"
gcc: "s390x-linux-gnu-gcc"
runner: "qemu-s390x -L /usr/s390x-linux-gnu"
- rust: stable
os: ubuntu-latest
features: ""
Expand Down Expand Up @@ -140,7 +141,7 @@ jobs:
- name: cargo build
run: cargo build --target ${{matrix.target}} ${{ matrix.features }}
- name: cargo nextest # reports segfaults in a helpful way
run: cargo nextest run --target ${{matrix.target}} ${{ matrix.features }}
run: RUNNER="${{ matrix.runner }}" cargo nextest run --target ${{matrix.target}} ${{ matrix.features }}
env:
RUST_BACKTRACE: 1
CC: ${{matrix.gcc}}
Expand Down
22 changes: 19 additions & 3 deletions tests/quick.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
use std::env;
use std::process::{Command, Stdio};

fn run_test(compressed: &str, expected: &[u8]) {
let output = std::process::Command::new(env!("CARGO_BIN_EXE_bzip2"))
let mut cmd;
match env::var("RUNNER") {
Ok(runner) if !runner.is_empty() => {
let mut runner_args = runner.split(' ');
cmd = Command::new(runner_args.next().unwrap());
cmd.args(runner_args);
cmd.arg(env!("CARGO_BIN_EXE_bzip2"));
}
_ => cmd = Command::new(env!("CARGO_BIN_EXE_bzip2")),
}
let output = match cmd
.arg("-d")
.arg(compressed)
.arg("-c")
.stdout(std::process::Stdio::piped())
.stdout(Stdio::piped())
.output()
.unwrap();
{
Ok(output) => output,
Err(err) => panic!("Running {cmd:?} failed with {err:?}"),
};
assert!(
output.status.success(),
"status: {:?} stderr: {:?}",
Expand Down

0 comments on commit 2b63fba

Please sign in to comment.