diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b37753e71..d21b85ab1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,6 +75,18 @@ jobs: os: ubuntu-latest rust: stable target: aarch64-unknown-linux-gnu + - build: stable-arm-gnueabihf + os: ubuntu-latest + rust: stable + target: armv7-unknown-linux-gnueabihf + - build: stable-arm-musleabihf + os: ubuntu-latest + rust: stable + target: armv7-unknown-linux-musleabihf + - build: stable-arm-musleabi + os: ubuntu-latest + rust: stable + target: armv7-unknown-linux-musleabi - build: stable-powerpc64 os: ubuntu-latest rust: stable diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b10c0761c..f6ea3d926 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -80,6 +80,24 @@ jobs: target: aarch64-unknown-linux-gnu strip: aarch64-linux-gnu-strip qemu: qemu-aarch64 + - build: stable-arm-gnueabihf + os: ubuntu-latest + rust: stable + target: armv7-unknown-linux-gnueabihf + strip: arm-linux-gnueabihf-strip + qemu: qemu-arm + - build: stable-arm-musleabihf + os: ubuntu-latest + rust: stable + target: armv7-unknown-linux-musleabihf + strip: arm-linux-musleabihf-strip + qemu: qemu-arm + - build: stable-arm-musleabi + os: ubuntu-latest + rust: stable + target: armv7-unknown-linux-musleabi + strip: arm-linux-musleabi-strip + qemu: qemu-arm - build: stable-powerpc64 os: ubuntu-latest rust: stable @@ -175,9 +193,9 @@ jobs: run: | docker run --rm -v \ "$PWD/target:/target:Z" \ - "rustembedded/cross:${{ matrix.target }}" \ + "ghcr.io/cross-rs/${{ matrix.target }}:main" \ "${{ matrix.strip }}" \ - "/target/${{ matrix.target }}/release/rg" + "/$BIN" - name: Determine archive name shell: bash @@ -210,31 +228,31 @@ jobs: run: | docker run --rm -v \ "$PWD/target:/target:Z" \ - "rustembedded/cross:${{ matrix.target }}" \ + "ghcr.io/cross-rs/${{ matrix.target }}:main" \ "${{ matrix.qemu }}" "/$BIN" --version docker run --rm -v \ "$PWD/target:/target:Z" \ - "rustembedded/cross:${{ matrix.target }}" \ + "ghcr.io/cross-rs/${{ matrix.target }}:main" \ "${{ matrix.qemu }}" "/$BIN" \ --generate complete-bash > "$ARCHIVE/complete/rg.bash" docker run --rm -v \ "$PWD/target:/target:Z" \ - "rustembedded/cross:${{ matrix.target }}" \ + "ghcr.io/cross-rs/${{ matrix.target }}:main" \ "${{ matrix.qemu }}" "/$BIN" \ --generate complete-fish > "$ARCHIVE/complete/rg.fish" docker run --rm -v \ "$PWD/target:/target:Z" \ - "rustembedded/cross:${{ matrix.target }}" \ + "ghcr.io/cross-rs/${{ matrix.target }}:main" \ "${{ matrix.qemu }}" "/$BIN" \ --generate complete-powershell > "$ARCHIVE/complete/_rg.ps1" docker run --rm -v \ "$PWD/target:/target:Z" \ - "rustembedded/cross:${{ matrix.target }}" \ + "ghcr.io/cross-rs/${{ matrix.target }}:main" \ "${{ matrix.qemu }}" "/$BIN" \ --generate complete-zsh > "$ARCHIVE/complete/_rg" docker run --rm -v \ "$PWD/target:/target:Z" \ - "rustembedded/cross:${{ matrix.target }}" \ + "ghcr.io/cross-rs/${{ matrix.target }}:main" \ "${{ matrix.qemu }}" "/$BIN" \ --generate man > "$ARCHIVE/doc/rg.1" diff --git a/Cross.toml b/Cross.toml deleted file mode 100644 index b334e5db2..000000000 --- a/Cross.toml +++ /dev/null @@ -1,14 +0,0 @@ -[target.x86_64-unknown-linux-musl] -image = "burntsushi/cross:x86_64-unknown-linux-musl" - -[target.i686-unknown-linux-gnu] -image = "burntsushi/cross:i686-unknown-linux-gnu" - -[target.aarch64-unknown-linux-gnu] -image = "burntsushi/cross:aarch64-unknown-linux-gnu" - -[target.powerpc64-unknown-linux-gnu] -image = "burntsushi/cross:powerpc64-unknown-linux-gnu" - -[target.s390x-unknown-linux-gnu] -image = "burntsushi/cross:s390x-unknown-linux-gnu" diff --git a/ci/docker/README.md b/ci/docker/README.md deleted file mode 100644 index 19913e029..000000000 --- a/ci/docker/README.md +++ /dev/null @@ -1,23 +0,0 @@ -These are Docker images used for cross compilation in CI builds (or locally) -via the [Cross](https://github.com/rust-embedded/cross) tool. - -The Cross tool actually provides its own Docker images, and all Docker images -in this directory are derived from one of them. We provide our own in order to -customize the environment. For example, we need to install compression tools -like `xz` so that tests for the `-z/--search-zip` flag are run. - -If you make a change to a Docker image, then you can re-build it. `cd` into the -directory containing the `Dockerfile` and run: - - $ cd x86_64-unknown-linux-musl - $ ./build - -At this point, subsequent uses of `cross` will now use your built image since -Docker prefers local images over remote images. In order to make these changes -stick, they need to be pushed to Docker Hub: - - $ docker push burntsushi/cross:x86_64-unknown-linux-musl - -Of course, only I (BurntSushi) can push to that location. To make `cross` use -a different location, then edit `Cross.toml` in the root of this repo to use -a different image name for the desired target. diff --git a/ci/docker/aarch64-unknown-linux-gnu/Dockerfile b/ci/docker/aarch64-unknown-linux-gnu/Dockerfile deleted file mode 100644 index 0b40440fa..000000000 --- a/ci/docker/aarch64-unknown-linux-gnu/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM rustembedded/cross:aarch64-unknown-linux-gnu - -COPY stage/ubuntu-install-packages / -RUN /ubuntu-install-packages diff --git a/ci/docker/aarch64-unknown-linux-gnu/build b/ci/docker/aarch64-unknown-linux-gnu/build deleted file mode 100755 index f32c31332..000000000 --- a/ci/docker/aarch64-unknown-linux-gnu/build +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -mkdir -p stage -cp ../../ubuntu-install-packages ./stage/ -docker build -t burntsushi/cross:aarch64-unknown-linux-gnu . diff --git a/ci/docker/i686-unknown-linux-gnu/Dockerfile b/ci/docker/i686-unknown-linux-gnu/Dockerfile deleted file mode 100644 index 9c9107ea5..000000000 --- a/ci/docker/i686-unknown-linux-gnu/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM rustembedded/cross:i686-unknown-linux-gnu - -COPY stage/ubuntu-install-packages / -RUN /ubuntu-install-packages diff --git a/ci/docker/i686-unknown-linux-gnu/build b/ci/docker/i686-unknown-linux-gnu/build deleted file mode 100755 index 5837c8281..000000000 --- a/ci/docker/i686-unknown-linux-gnu/build +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -mkdir -p stage -cp ../../ubuntu-install-packages ./stage/ -docker build -t burntsushi/cross:i686-unknown-linux-gnu . diff --git a/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile b/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile deleted file mode 100644 index 9489aa2cd..000000000 --- a/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM rustembedded/cross:powerpc64-unknown-linux-gnu - -COPY stage/ubuntu-install-packages / -RUN /ubuntu-install-packages diff --git a/ci/docker/powerpc64-unknown-linux-gnu/build b/ci/docker/powerpc64-unknown-linux-gnu/build deleted file mode 100755 index b25960c26..000000000 --- a/ci/docker/powerpc64-unknown-linux-gnu/build +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -mkdir -p stage -cp ../../ubuntu-install-packages ./stage/ -docker build -t burntsushi/cross:powerpc64-unknown-linux-gnu . diff --git a/ci/docker/s390x-unknown-linux-gnu/Dockerfile b/ci/docker/s390x-unknown-linux-gnu/Dockerfile deleted file mode 100644 index 65a20876e..000000000 --- a/ci/docker/s390x-unknown-linux-gnu/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM rustembedded/cross:s390x-unknown-linux-gnu - -COPY stage/ubuntu-install-packages / -RUN /ubuntu-install-packages diff --git a/ci/docker/s390x-unknown-linux-gnu/build b/ci/docker/s390x-unknown-linux-gnu/build deleted file mode 100755 index f2fcb4386..000000000 --- a/ci/docker/s390x-unknown-linux-gnu/build +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -mkdir -p stage -cp ../../ubuntu-install-packages ./stage/ -docker build -t burntsushi/cross:s390x-unknown-linux-gnu . diff --git a/ci/docker/x86_64-unknown-linux-musl/Dockerfile b/ci/docker/x86_64-unknown-linux-musl/Dockerfile deleted file mode 100644 index 8818b605c..000000000 --- a/ci/docker/x86_64-unknown-linux-musl/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM rustembedded/cross:x86_64-unknown-linux-musl - -COPY stage/ubuntu-install-packages / -RUN /ubuntu-install-packages diff --git a/ci/docker/x86_64-unknown-linux-musl/build b/ci/docker/x86_64-unknown-linux-musl/build deleted file mode 100755 index 7fce7c2a7..000000000 --- a/ci/docker/x86_64-unknown-linux-musl/build +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -mkdir -p stage -cp ../../ubuntu-install-packages ./stage/ -docker build -t burntsushi/cross:x86_64-unknown-linux-musl . diff --git a/tests/feature.rs b/tests/feature.rs index b0a70accf..5a2cff4fe 100644 --- a/tests/feature.rs +++ b/tests/feature.rs @@ -972,7 +972,7 @@ rgtest!(f1404_nothing_searched_warning, |dir: Dir, mut cmd: TestCommand| { cmd.assert_err(); // Test that we actually get an error message that we expect. - let output = cmd.cmd().output().unwrap(); + let output = cmd.raw_output(); let stderr = String::from_utf8_lossy(&output.stderr); let expected = "\ No files were searched, which means ripgrep probably applied \ @@ -995,7 +995,7 @@ rgtest!(f1404_nothing_searched_ignored, |dir: Dir, mut cmd: TestCommand| { // But since --no-messages is given, there should not be any error message // printed. - let output = cmd.cmd().output().unwrap(); + let output = cmd.raw_output(); let stderr = String::from_utf8_lossy(&output.stderr); let expected = ""; eqnice!(expected, stderr); diff --git a/tests/misc.rs b/tests/misc.rs index 407790566..f1091b924 100644 --- a/tests/misc.rs +++ b/tests/misc.rs @@ -411,7 +411,7 @@ rgtest!(include_zero, |dir: Dir, mut cmd: TestCommand| { cmd.args(&["--count", "--include-zero", "nada"]); cmd.assert_err(); - let output = cmd.cmd().output().unwrap(); + let output = cmd.raw_output(); let stdout = String::from_utf8_lossy(&output.stdout); let expected = "sherlock:0\n"; @@ -423,7 +423,7 @@ rgtest!(include_zero_override, |dir: Dir, mut cmd: TestCommand| { cmd.args(&["--count", "--include-zero", "--no-include-zero", "nada"]); cmd.assert_err(); - let output = cmd.cmd().output().unwrap(); + let output = cmd.raw_output(); let stdout = String::from_utf8_lossy(&output.stdout); assert!(stdout.is_empty()); }); diff --git a/tests/regression.rs b/tests/regression.rs index dc463aa31..ef0a3339e 100644 --- a/tests/regression.rs +++ b/tests/regression.rs @@ -399,7 +399,7 @@ rgtest!(r428_unrecognized_style, |dir: Dir, mut cmd: TestCommand| { cmd.arg("--colors=match:style:").arg("Sherlock"); cmd.assert_err(); - let output = cmd.cmd().output().unwrap(); + let output = cmd.raw_output(); let stderr = String::from_utf8_lossy(&output.stderr); let expected = "\ error parsing flag --colors: \ diff --git a/tests/util.rs b/tests/util.rs index b7fc9f789..bac5f2e6d 100644 --- a/tests/util.rs +++ b/tests/util.rs @@ -9,6 +9,8 @@ use std::sync::atomic::{AtomicUsize, Ordering}; use std::thread; use std::time::Duration; +use bstr::ByteSlice; + static TEST_DIR: &'static str = "ripgrep-tests"; static NEXT_ID: AtomicUsize = AtomicUsize::new(0); @@ -325,13 +327,21 @@ impl TestCommand { /// Gets the output of a command. If the command failed, then this panics. pub fn output(&mut self) -> process::Output { - let output = self.cmd.output().unwrap(); + let output = self.raw_output(); self.expect_success(output) } + /// Gets the raw output of a command after filtering nonsense like jemalloc + /// error messages from stderr. + pub fn raw_output(&mut self) -> process::Output { + let mut output = self.cmd.output().unwrap(); + output.stderr = strip_jemalloc_nonsense(&output.stderr); + output + } + /// Runs the command and asserts that it resulted in an error exit code. pub fn assert_err(&mut self) { - let o = self.cmd.output().unwrap(); + let o = self.raw_output(); if o.status.success() { panic!( "\n\n===== {:?} =====\n\ @@ -479,7 +489,7 @@ fn dir_list>(dir: P) -> Vec { /// So... we just manually handle these cases. So fucking fun. fn cross_runner() -> Option { let runner = std::env::var("CROSS_RUNNER").ok()?; - if runner.is_empty() { + if runner.is_empty() || runner == "empty" { return None; } if cfg!(target_arch = "powerpc64") { @@ -500,3 +510,17 @@ fn cross_runner() -> Option { pub fn is_cross() -> bool { std::env::var("CROSS_RUNNER").ok().map_or(false, |v| !v.is_empty()) } + +/// Strips absolutely fucked `:` lines from the output. +/// +/// In theory this only happens under qemu, which is where our tests run under +/// `cross`. But is messes with our tests, because... they don't expect the +/// allocator to fucking write to stderr. I mean, what the fuck? Who prints a +/// warning message with absolutely no instruction for what to do with it or +/// how to disable it. Absolutely fucking bonkers. +fn strip_jemalloc_nonsense(data: &[u8]) -> Vec { + let lines = data + .lines_with_terminator() + .filter(|line| !line.starts_with_str(":")); + bstr::concat(lines) +}