mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-12-23 06:30:57 +00:00
Fix compression tests in QEMU cross-compilation environments (#3248)
* 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:
parent
cd1f981bea
commit
0a88cccd51
2 changed files with 4 additions and 7 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue