about summary refs log tree commit diff
path: root/src/ci/docker
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-04-13 16:28:57 +0000
committerbors <bors@rust-lang.org>2020-04-13 16:28:57 +0000
commitc58c53274401acdc739f177aa3e408241e2e52d8 (patch)
treef923c7b9b7852ed83e294cdb9932d0440cc8137f /src/ci/docker
parent5179ebe2064e15196c5be1f8df950736140b8fdd (diff)
parentcb6a5609b365779e62b404cbb730fa9e2a8e88b9 (diff)
downloadrust-c58c53274401acdc739f177aa3e408241e2e52d8.tar.gz
rust-c58c53274401acdc739f177aa3e408241e2e52d8.zip
Auto merge of #70989 - eddyb:mir-opt-32-pr-ci, r=Mark-Simulacrum
 ci: run mir-opt tests on PR CI also as 32-bit (for `EMIT_MIR_FOR_EACH_BIT_WIDTH`).

Background: #69916 and [`src/test/mir-opt/README.md`](https://github.com/rust-lang/rust/blob/master/src/test/mir-opt/README.md):
> By default 32 bit and 64 bit targets use the same dump files, which can be problematic in the
presence of pointers in constants or other bit width dependent things. In that case you can add
>
> ```
> // EMIT_MIR_FOR_EACH_BIT_WIDTH
> ```
>
> to your test, causing separate files to be generated for 32bit and 64bit systems.

However, if you change the output of such a test (intentionally or not), or if you add a test and it varies between 32-bit and 64-bit platforms, you have to run this command (for a x64 linux host):
`./x.py test --stage 1 --target x86_64-unknown-linux-gnu --target i686-unknown-linux-gnu --bless  src/test/mir-opt`

Otherwise, bors trying to merge the PR will fail, since we test 32-bit targets there.
But we don't on PR CI, which means there's no way the PR author would know (unless they were burnt by this already and know what to look for).

This PR resolves that by running `mir-opt` tests for ~~`i686-unknown-linux-gnu`~~, on PR CI.
**EDIT**: switched to `armv5te-unknown-linux-gnueabi` to work around LLVM 7 crashes (see https://github.com/rust-lang/compiler-builtins/pull/311#issuecomment-612270089), found during testing.

cc @rust-lang/wg-mir-opt @rust-lang/infra
Diffstat (limited to 'src/ci/docker')
-rw-r--r--src/ci/docker/x86_64-gnu-llvm-7/Dockerfile19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/ci/docker/x86_64-gnu-llvm-7/Dockerfile b/src/ci/docker/x86_64-gnu-llvm-7/Dockerfile
index 4b5d5cac516..f70c3de2ece 100644
--- a/src/ci/docker/x86_64-gnu-llvm-7/Dockerfile
+++ b/src/ci/docker/x86_64-gnu-llvm-7/Dockerfile
@@ -2,6 +2,7 @@ FROM ubuntu:18.04
 
 RUN apt-get update && apt-get install -y --no-install-recommends \
   g++ \
+  g++-arm-linux-gnueabi \
   make \
   file \
   curl \
@@ -29,7 +30,23 @@ ENV RUST_CONFIGURE_ARGS \
       --enable-llvm-link-shared \
       --set rust.thin-lto-import-instr-limit=10
 
-ENV SCRIPT python2.7 ../x.py test --exclude src/tools/tidy && python2.7 ../x.py test src/tools/tidy
+ENV SCRIPT python2.7 ../x.py 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.
+           #
+           # HACK(eddyb) `armv5te` is used (not `i686`) to support older LLVM than LLVM 9:
+           # https://github.com/rust-lang/compiler-builtins/pull/311#issuecomment-612270089.
+           # This also requires `--pass=build` because we can't execute the tests
+           # on the `x86_64` host when they're built as `armv5te` binaries.
+           # (we're only interested in the MIR output, so this doesn't matter)
+           python2.7 ../x.py test src/test/mir-opt --pass=build \
+                                  --target=armv5te-unknown-linux-gnueabi && \
+           # Run tidy at the very end, after all the other tests.
+           python2.7 ../x.py test src/tools/tidy
 
 # The purpose of this container isn't to test with debug assertions and
 # this is run on all PRs, so let's get speedier builds by disabling these extra