Fix compression tests in QEMU cross-compilation environments (#3248)
Some checks failed
ci / test (stable-arm-gnueabihf, ubuntu-latest, stable, armv7-unknown-linux-gnueabihf) (push) Failing after 1m0s
ci / test (stable-arm-musleabi, ubuntu-latest, stable, armv7-unknown-linux-musleabi) (push) Failing after 50s
ci / test (stable-arm-musleabihf, ubuntu-latest, stable, armv7-unknown-linux-musleabihf) (push) Failing after 3s
ci / test (stable-aarch64, ubuntu-latest, stable, aarch64-unknown-linux-gnu) (push) Failing after 2m17s
ci / test (stable-powerpc64, ubuntu-latest, stable, powerpc64-unknown-linux-gnu) (push) Failing after 3s
ci / test (stable-riscv64, ubuntu-latest, stable, riscv64gc-unknown-linux-gnu) (push) Failing after 52s
ci / test (stable-s390x, ubuntu-latest, stable, s390x-unknown-linux-gnu) (push) Failing after 55s
ci / test (stable-x86, ubuntu-latest, stable, i686-unknown-linux-gnu) (push) Failing after 38m55s
ci / wasm (push) Failing after 6s
ci / test (stable-musl, ubuntu-latest, stable, x86_64-unknown-linux-musl) (push) Failing after 3h13m39s
ci / test (macos, macos-latest, nightly) (push) Has been cancelled
ci / test (win-gnu, windows-latest, nightly-x86_64-gnu) (push) Has been cancelled
ci / test (win-msvc, windows-latest, nightly) (push) Has been cancelled
ci / test (winaarch64-msvc, windows-11-arm, nightly) (push) Has been cancelled
ci / test (beta, ubuntu-latest, beta) (push) Has been cancelled
ci / test (nightly, ubuntu-latest, nightly) (push) Has been cancelled
ci / test (pinned, ubuntu-latest, 1.85.0) (push) Has been cancelled
ci / test (stable, ubuntu-latest, stable) (push) Has been cancelled
ci / rustfmt (push) Has been cancelled
ci / docs (push) Has been cancelled
ci / Compile Fuzz Test Targets (push) Has been cancelled
Some checks failed
ci / test (stable-arm-gnueabihf, ubuntu-latest, stable, armv7-unknown-linux-gnueabihf) (push) Failing after 1m0s
ci / test (stable-arm-musleabi, ubuntu-latest, stable, armv7-unknown-linux-musleabi) (push) Failing after 50s
ci / test (stable-arm-musleabihf, ubuntu-latest, stable, armv7-unknown-linux-musleabihf) (push) Failing after 3s
ci / test (stable-aarch64, ubuntu-latest, stable, aarch64-unknown-linux-gnu) (push) Failing after 2m17s
ci / test (stable-powerpc64, ubuntu-latest, stable, powerpc64-unknown-linux-gnu) (push) Failing after 3s
ci / test (stable-riscv64, ubuntu-latest, stable, riscv64gc-unknown-linux-gnu) (push) Failing after 52s
ci / test (stable-s390x, ubuntu-latest, stable, s390x-unknown-linux-gnu) (push) Failing after 55s
ci / test (stable-x86, ubuntu-latest, stable, i686-unknown-linux-gnu) (push) Failing after 38m55s
ci / wasm (push) Failing after 6s
ci / test (stable-musl, ubuntu-latest, stable, x86_64-unknown-linux-musl) (push) Failing after 3h13m39s
ci / test (macos, macos-latest, nightly) (push) Has been cancelled
ci / test (win-gnu, windows-latest, nightly-x86_64-gnu) (push) Has been cancelled
ci / test (win-msvc, windows-latest, nightly) (push) Has been cancelled
ci / test (winaarch64-msvc, windows-11-arm, nightly) (push) Has been cancelled
ci / test (beta, ubuntu-latest, beta) (push) Has been cancelled
ci / test (nightly, ubuntu-latest, nightly) (push) Has been cancelled
ci / test (pinned, ubuntu-latest, 1.85.0) (push) Has been cancelled
ci / test (stable, ubuntu-latest, stable) (push) Has been cancelled
ci / rustfmt (push) Has been cancelled
ci / docs (push) Has been cancelled
ci / Compile Fuzz Test Targets (push) Has been cancelled
* tests: fix cmd_exists for QEMU environments QEMU user-mode has a bug where posix_spawn returns success even when the command doesn't exist. The child exits with 127, but the parent thinks it succeeded. Change cmd_exists to check if the command actually ran successfully (exit code 0), not just if spawn returned Ok. This fixes compression tests on riscv64 and other QEMU-emulated architectures. Ref https://github.com/rust-lang/rust/issues/90825 * tests: remove riscv64 skip for compression tests Remove the cfg guards that disabled lz4, brotli, and zstd tests on riscv64. These now work with the QEMU fix.
This commit is contained in:
@@ -922,8 +922,6 @@ be, to a very large extent, the result of luck. Sherlock Holmes
|
||||
eqnice!(expected, cmd.stdout());
|
||||
});
|
||||
|
||||
// lz4 decompression tool doesn't work under RISC-V QEMU emulation in CI
|
||||
#[cfg(not(target_arch = "riscv64"))]
|
||||
rgtest!(compressed_lz4, |dir: Dir, mut cmd: TestCommand| {
|
||||
if !cmd_exists("lz4") {
|
||||
return;
|
||||
@@ -954,8 +952,6 @@ be, to a very large extent, the result of luck. Sherlock Holmes
|
||||
eqnice!(expected, cmd.stdout());
|
||||
});
|
||||
|
||||
// brotli decompression tool doesn't work under RISC-V QEMU emulation in CI
|
||||
#[cfg(not(target_arch = "riscv64"))]
|
||||
rgtest!(compressed_brotli, |dir: Dir, mut cmd: TestCommand| {
|
||||
if !cmd_exists("brotli") {
|
||||
return;
|
||||
@@ -971,8 +967,6 @@ be, to a very large extent, the result of luck. Sherlock Holmes
|
||||
eqnice!(expected, cmd.stdout());
|
||||
});
|
||||
|
||||
// zstd decompression tool doesn't work under RISC-V QEMU emulation in CI
|
||||
#[cfg(not(target_arch = "riscv64"))]
|
||||
rgtest!(compressed_zstd, |dir: Dir, mut cmd: TestCommand| {
|
||||
if !cmd_exists("zstd") {
|
||||
return;
|
||||
|
||||
@@ -45,7 +45,10 @@ pub fn sort_lines(lines: &str) -> String {
|
||||
/// Returns true if and only if the given program can be successfully executed
|
||||
/// with a `--help` flag.
|
||||
pub fn cmd_exists(program: &str) -> bool {
|
||||
Command::new(program).arg("--help").output().is_ok()
|
||||
match Command::new(program).arg("--help").output() {
|
||||
Ok(output) => output.status.success(),
|
||||
Err(_) => false,
|
||||
}
|
||||
}
|
||||
|
||||
/// Dir represents a directory in which tests should be run.
|
||||
|
||||
Reference in New Issue
Block a user