From 330d73a80453c4ba76f58cdae4c72f60b3dad38f Mon Sep 17 00:00:00 2001 From: jyn Date: Sun, 4 Jun 2023 21:15:38 -0500 Subject: [PATCH 1/2] Test `x86_64-gnu` in PR CI, not x86_64-gnu-llvm-14 This is a pre-requisite for https://github.com/rust-lang/rust/pull/112143, which wants to start using download-rustc in PRs. download-rustc doesn't allow providing an external LLVM. --- .github/workflows/ci.yml | 2 +- .../host-x86_64/x86_64-gnu-llvm-14/Dockerfile | 24 +------------------ .../docker/host-x86_64/x86_64-gnu/Dockerfile | 24 ++++++++++++++++++- src/ci/github-actions/ci.yml | 2 +- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 210ec72a11e0b..ea4f3461f53eb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,7 +52,7 @@ jobs: - name: mingw-check-tidy os: ubuntu-20.04-16core-64gb env: {} - - name: x86_64-gnu-llvm-14 + - name: x86_64-gnu os: ubuntu-20.04-16core-64gb env: {} - name: x86_64-gnu-tools diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-14/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-14/Dockerfile index 1f28b93977800..c7ac93d7378e0 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-14/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-14/Dockerfile @@ -4,7 +4,6 @@ ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y --no-install-recommends \ g++ \ - gcc-multilib \ make \ ninja-build \ file \ @@ -26,11 +25,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ mingw-w64 \ && rm -rf /var/lib/apt/lists/* -# Install powershell (universal package) so we can test x.ps1 on Linux -RUN curl -sL "https://github.com/PowerShell/PowerShell/releases/download/v7.3.1/powershell_7.3.1-1.deb_amd64.deb" > powershell.deb && \ - dpkg -i powershell.deb && \ - rm -f powershell.deb - COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh @@ -49,20 +43,4 @@ ENV RUST_CONFIGURE_ARGS \ --enable-llvm-link-shared \ --set rust.thin-lto-import-instr-limit=10 -# NOTE: intentionally uses all of `x.py`, `x`, and `x.ps1` to make sure they all work on Linux. -ENV SCRIPT ../x.py --stage 2 test --exclude src/tools/tidy && \ - # Run the `mir-opt` tests again but this time for a 32-bit target. - # This enforces that tests using `// EMIT_MIR_FOR_EACH_BIT_WIDTH` have - # both 32-bit and 64-bit outputs updated by the PR author, before - # the PR is approved and tested for merging. - # It will also detect tests lacking `// EMIT_MIR_FOR_EACH_BIT_WIDTH`, - # despite having different output on 32-bit vs 64-bit targets. - ../x --stage 2 test tests/mir-opt \ - --host='' --target=i686-unknown-linux-gnu && \ - # Run the UI test suite again, but in `--pass=check` mode - # - # This is intended to make sure that both `--pass=check` continues to - # work. - # - ../x.ps1 --stage 2 test tests/ui --pass=check \ - --host='' --target=i686-unknown-linux-gnu +ENV SCRIPT ../x.py --stage 2 test diff --git a/src/ci/docker/host-x86_64/x86_64-gnu/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu/Dockerfile index fbec368c9ee55..313a602d0c3bc 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu/Dockerfile @@ -3,6 +3,7 @@ FROM ubuntu:20.04 ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y --no-install-recommends \ g++ \ + gcc-multilib \ make \ ninja-build \ file \ @@ -19,6 +20,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ mingw-w64 \ && rm -rf /var/lib/apt/lists/* +# Install powershell (universal package) so we can test x.ps1 on Linux +RUN curl -sL "https://github.com/PowerShell/PowerShell/releases/download/v7.3.1/powershell_7.3.1-1.deb_amd64.deb" > powershell.deb && \ + dpkg -i powershell.deb && \ + rm -f powershell.deb + COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh @@ -27,4 +33,20 @@ ENV RUST_CONFIGURE_ARGS \ --enable-sanitizers \ --enable-profiler \ --enable-compiler-docs -ENV SCRIPT python3 ../x.py --stage 2 test + +# NOTE: intentionally uses all of `x.py`, `x`, and `x.ps1` to make sure they all work on Linux. +ENV SCRIPT ../x.py --stage 2 test --exclude src/tools/tidy && \ + # Run the `mir-opt` tests again but this time for a 32-bit target. + # This enforces that tests using `// EMIT_MIR_FOR_EACH_BIT_WIDTH` have + # both 32-bit and 64-bit outputs updated by the PR author, before + # the PR is approved and tested for merging. + # It will also detect tests lacking `// EMIT_MIR_FOR_EACH_BIT_WIDTH`, + # despite having different output on 32-bit vs 64-bit targets. + ../x --stage 2 test tests/mir-opt \ + --host='' --target=i686-unknown-linux-gnu && \ + # Run the UI test suite again, but in `--pass=check` mode + # + # This is intended to make sure that both `--pass=check` continues to + # work. + ../x.ps1 --stage 2 test tests/ui --pass=check \ + --host='' --target=i686-unknown-linux-gnu diff --git a/src/ci/github-actions/ci.yml b/src/ci/github-actions/ci.yml index d3cb6b6ed5220..c9520feb33514 100644 --- a/src/ci/github-actions/ci.yml +++ b/src/ci/github-actions/ci.yml @@ -308,7 +308,7 @@ jobs: - name: mingw-check-tidy <<: *job-linux-16c - - name: x86_64-gnu-llvm-14 + - name: x86_64-gnu <<: *job-linux-16c - name: x86_64-gnu-tools From 7fd7243ed77af4d2a6cc267cf3630895d26c0909 Mon Sep 17 00:00:00 2001 From: jyn Date: Sun, 4 Jun 2023 23:22:17 -0500 Subject: [PATCH 2/2] don't try to cross-compile sanitizer tests this was a pre-existing latent bug, we just didn't have any CI builders exercising it. fixes the following errors: ``` ---- [ui] tests/ui/sanitize/new-llvm-pass-manager-thin-lto.rs#opt1 stdout ---- error in revision `opt1`: test compilation failed although it shouldn't! status: exit status: 1 command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/sanitize/new-llvm-pass-manager-thin-lto.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=i686-unknown-linux-gnu" "--cfg" "opt1" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Cstrip=debuginfo" "--remap-path-prefix=/checkout/tests/ui=fake-test-src-base" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/sanitize/new-llvm-pass-manager-thin-lto.opt1/a" "-A" "unused" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/i686-unknown-linux-gnu/native/rust-test-helpers" "-Clinker=x86_64-linux-gnu-gcc" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/sanitize/new-llvm-pass-manager-thin-lto.opt1/auxiliary" "-Zsanitizer=address" "-Clto=thin" "-Copt-level=1" --- stderr ------------------------------- error: linking with `x86_64-linux-gnu-gcc` failed: exit status: 1 = note: x86_64-linux-gnu-gcc: error: /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/i686-unknown-linux-gnu/lib/librustc-nightly_rt.asan.a: No such file or directory failures: [ui] tests/ui/sanitize/badfree.rs [ui] tests/ui/sanitize/address.rs [ui] tests/ui/sanitize/use-after-scope.rs [ui] tests/ui/sanitize/new-llvm-pass-manager-thin-lto.rs#opt0 [ui] tests/ui/sanitize/new-llvm-pass-manager-thin-lto.rs#opt1 ``` --- tests/ui/sanitize/address.rs | 3 ++- tests/ui/sanitize/badfree.rs | 1 + tests/ui/sanitize/issue-72154-lifetime-markers.rs | 1 + tests/ui/sanitize/new-llvm-pass-manager-thin-lto.rs | 1 + tests/ui/sanitize/use-after-scope.rs | 1 + 5 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/ui/sanitize/address.rs b/tests/ui/sanitize/address.rs index 5b2cea87560fd..1faab1fd2fce1 100644 --- a/tests/ui/sanitize/address.rs +++ b/tests/ui/sanitize/address.rs @@ -1,11 +1,12 @@ // needs-sanitizer-support // needs-sanitizer-address +// ignore-cross-compile // // compile-flags: -Z sanitizer=address -O -g // // run-fail // error-pattern: AddressSanitizer: stack-buffer-overflow -// error-pattern: 'xs' (line 13) <== Memory access at offset +// error-pattern: 'xs' (line 14) <== Memory access at offset use std::hint::black_box; diff --git a/tests/ui/sanitize/badfree.rs b/tests/ui/sanitize/badfree.rs index 095a6f4697b1c..c8d1ce7dff25d 100644 --- a/tests/ui/sanitize/badfree.rs +++ b/tests/ui/sanitize/badfree.rs @@ -1,5 +1,6 @@ // needs-sanitizer-support // needs-sanitizer-address +// ignore-cross-compile // // compile-flags: -Z sanitizer=address -O // diff --git a/tests/ui/sanitize/issue-72154-lifetime-markers.rs b/tests/ui/sanitize/issue-72154-lifetime-markers.rs index b2e182238ce28..3d9c51daa6505 100644 --- a/tests/ui/sanitize/issue-72154-lifetime-markers.rs +++ b/tests/ui/sanitize/issue-72154-lifetime-markers.rs @@ -5,6 +5,7 @@ // // needs-sanitizer-support // needs-sanitizer-address +// ignore-cross-compile // // compile-flags: -Copt-level=0 -Zsanitizer=address // run-pass diff --git a/tests/ui/sanitize/new-llvm-pass-manager-thin-lto.rs b/tests/ui/sanitize/new-llvm-pass-manager-thin-lto.rs index 33e18e35522ec..052a40598a856 100644 --- a/tests/ui/sanitize/new-llvm-pass-manager-thin-lto.rs +++ b/tests/ui/sanitize/new-llvm-pass-manager-thin-lto.rs @@ -4,6 +4,7 @@ // // needs-sanitizer-support // needs-sanitizer-address +// ignore-cross-compile // // no-prefer-dynamic // revisions: opt0 opt1 diff --git a/tests/ui/sanitize/use-after-scope.rs b/tests/ui/sanitize/use-after-scope.rs index 30be2ae6f0906..de63eea194ba9 100644 --- a/tests/ui/sanitize/use-after-scope.rs +++ b/tests/ui/sanitize/use-after-scope.rs @@ -1,5 +1,6 @@ // needs-sanitizer-support // needs-sanitizer-address +// ignore-cross-compile // // compile-flags: -Zsanitizer=address // run-fail