mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-07-30 19:51:58 -07:00
ci: replace mips with powerpc64, aarch64 and s390x
We drop our MIPS target because it no longer works.[1] We were
previously using it as a means of testing ripgrep in a big endian
environment. So to achieve that without MIPS, we test on powerpc64 and
s390x. (No particular reason to do both, but why not.)
We also add aarch64 as a proxy for at least ensuring everything works
for the same architecture as Apple silicon. It's not a guarantee that
everything works, but it seems better than nothing until we can actually
test Apple silicon in CI.
[1]: c788378d6f
This commit is contained in:
@@ -791,6 +791,9 @@ rgtest!(f1466_no_ignore_files, |dir: Dir, mut cmd: TestCommand| {
|
||||
rgtest!(f2361_sort_nested_files, |dir: Dir, mut cmd: TestCommand| {
|
||||
use std::{thread::sleep, time::Duration};
|
||||
|
||||
if crate::util::is_cross() {
|
||||
return;
|
||||
}
|
||||
dir.create("foo", "1");
|
||||
sleep(Duration::from_millis(100));
|
||||
dir.create_dir("dir");
|
||||
|
@@ -1100,12 +1100,18 @@ rgtest!(sort_files, |dir: Dir, mut cmd: TestCommand| {
|
||||
});
|
||||
|
||||
rgtest!(sort_accessed, |dir: Dir, mut cmd: TestCommand| {
|
||||
if crate::util::is_cross() {
|
||||
return;
|
||||
}
|
||||
sort_setup(dir);
|
||||
let expected = "a:test\ndir/c:test\nb:test\ndir/d:test\n";
|
||||
eqnice!(expected, cmd.args(["--sort", "accessed", "test"]).stdout());
|
||||
});
|
||||
|
||||
rgtest!(sortr_accessed, |dir: Dir, mut cmd: TestCommand| {
|
||||
if crate::util::is_cross() {
|
||||
return;
|
||||
}
|
||||
sort_setup(dir);
|
||||
let expected = "dir/d:test\nb:test\ndir/c:test\na:test\n";
|
||||
eqnice!(expected, cmd.args(["--sortr", "accessed", "test"]).stdout());
|
||||
|
@@ -464,19 +464,39 @@ fn dir_list<P: AsRef<Path>>(dir: P) -> Vec<String> {
|
||||
/// will have setup qemu to run it. While this is integrated into the Rust
|
||||
/// testing by default, we need to handle it ourselves for integration tests.
|
||||
///
|
||||
/// Thankfully, cross sets an environment variable that points to the proper
|
||||
/// qemu binary that we want to run. So we just search for that env var and
|
||||
/// return its value if we could find it.
|
||||
/// Now thankfully, cross sets `CROSS_RUNNER` to point to the right qemu
|
||||
/// executable. Or so one thinks. But it seems to always be set to `qemu-user`
|
||||
/// and I cannot find `qemu-user` anywhere in the Docker image. Awesome.
|
||||
///
|
||||
/// Thers is `/linux-runner` which seems to work sometimes? But not always.
|
||||
///
|
||||
/// Instead, it looks like we have to use `qemu-aarch64` in the `aarch64`
|
||||
/// case. Perfect, so just get the current target architecture and append it
|
||||
/// to `qemu-`. Wrong. Cross (or qemu or whoever) uses `qemu-ppc64` for
|
||||
/// `powerpc64`, so we can't just use the target architecture as Rust knows
|
||||
/// it verbatim.
|
||||
///
|
||||
/// So... we just manually handle these cases. So fucking fun.
|
||||
fn cross_runner() -> Option<String> {
|
||||
for (k, v) in std::env::vars_os() {
|
||||
let (k, v) = (k.to_string_lossy(), v.to_string_lossy());
|
||||
if !k.starts_with("CARGO_TARGET_") && !k.ends_with("_RUNNER") {
|
||||
continue;
|
||||
}
|
||||
if !v.starts_with("qemu-") {
|
||||
continue;
|
||||
}
|
||||
return Some(v.into_owned());
|
||||
let runner = std::env::var("CROSS_RUNNER").ok()?;
|
||||
if runner.is_empty() {
|
||||
return None;
|
||||
}
|
||||
if cfg!(target_arch = "powerpc64") {
|
||||
Some("qemu-ppc64".to_string())
|
||||
} else if cfg!(target_arch = "x86") {
|
||||
Some("i386".to_string())
|
||||
} else {
|
||||
// Make a guess... Sigh.
|
||||
Some(format!("qemu-{}", std::env::consts::ARCH))
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
/// Returns true if the test setup believes Cross is running and `qemu` is
|
||||
/// needed to run ripgrep.
|
||||
///
|
||||
/// This is useful because it has been difficult to get some tests to pass
|
||||
/// under Cross.
|
||||
pub fn is_cross() -> bool {
|
||||
std::env::var("CROSS_RUNNER").ok().map_or(false, |v| !v.is_empty())
|
||||
}
|
||||
|
Reference in New Issue
Block a user