Skip to content

Commit

Permalink
ci: add aarch64-gnu-debug job
Browse files Browse the repository at this point in the history
Adds a new CI job which checks that the compiler builds with
`--enable-debug` and tests that `needs-force-clang-based-tests` pass
(where cross-language LTO is tested).
  • Loading branch information
davidtwco committed Oct 22, 2024
1 parent 916e9ce commit 328e897
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 4 deletions.
58 changes: 58 additions & 0 deletions src/ci/docker/host-aarch64/aarch64-gnu-debug/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
FROM ubuntu:22.04

ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
make \
ninja-build \
file \
curl \
ca-certificates \
python3 \
python3-dev \
libxml2-dev \
libncurses-dev \
libedit-dev \
swig \
doxygen \
git \
cmake \
sudo \
gdb \
libssl-dev \
pkg-config \
xz-utils \
lld \
clang \
&& rm -rf /var/lib/apt/lists/*

COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh

ENV RUSTBUILD_FORCE_CLANG_BASED_TESTS 1
ENV RUN_CHECK_WITH_PARALLEL_QUERIES 1

# llvm.use-linker conflicts with downloading CI LLVM
ENV NO_DOWNLOAD_CI_LLVM 1

ENV RUST_CONFIGURE_ARGS \
--build=aarch64-unknown-linux-gnu \
--enable-debug \
--enable-lld \
--set llvm.use-linker=lld \
--set target.aarch64-unknown-linux-gnu.linker=clang \
--set target.aarch64-unknown-linux-gnu.cc=clang \
--set target.aarch64-unknown-linux-gnu.cxx=clang++

# This job appears to be checking two separate things:
# - That we can build the compiler with `--enable-debug`
# (without necessarily testing the result).
# - That the tests with `//@ needs-force-clang-based-tests` pass, since they
# don't run by default unless RUSTBUILD_FORCE_CLANG_BASED_TESTS is set.
# - FIXME(https://github.com/rust-lang/rust/pull/126155#issuecomment-2156314273):
# Currently we only run the subset of tests with "clang" in their name.
# - See also FIXME(#132034)

ENV SCRIPT \
python3 ../x.py --stage 2 build && \
python3 ../x.py --stage 2 test tests/run-make --test-args clang
3 changes: 3 additions & 0 deletions src/ci/github-actions/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ auto:
- image: aarch64-gnu
<<: *job-aarch64-linux

- image: aarch64-gnu-debug
<<: *job-aarch64-linux

- image: arm-android
<<: *job-linux-4c

Expand Down
18 changes: 14 additions & 4 deletions tests/run-make/cross-lang-lto-clang/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@

use run_make_support::{clang, env_var, llvm_ar, llvm_objdump, rustc, static_lib_name};

#[cfg(any(target_arch = "aarch64", target_arch = "arm"))]
static ALWAYS_INLINED_PATTERN: &'static str = "bl.*<rust_always_inlined>";
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
static ALWAYS_INLINED_PATTERN: &'static str = "call.*rust_always_inlined";

#[cfg(any(target_arch = "aarch64", target_arch = "arm"))]
static NEVER_INLINED_PATTERN: &'static str = "bl.*<rust_never_inlined>";
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
static NEVER_INLINED_PATTERN: &'static str = "call.*rust_never_inlined";

fn main() {
rustc()
.linker_plugin_lto("on")
Expand All @@ -31,14 +41,14 @@ fn main() {
.disassemble()
.input("cmain")
.run()
.assert_stdout_not_contains_regex("call.*rust_always_inlined");
.assert_stdout_not_contains_regex(ALWAYS_INLINED_PATTERN);
// As a sanity check, make sure we do find a call instruction to a
// non-inlined function
llvm_objdump()
.disassemble()
.input("cmain")
.run()
.assert_stdout_contains_regex("call.*rust_never_inlined");
.assert_stdout_contains_regex(NEVER_INLINED_PATTERN);
clang().input("clib.c").lto("thin").arg("-c").out_exe("clib.o").arg("-O2").run();
llvm_ar().obj_to_ar().output_input(static_lib_name("xyz"), "clib.o").run();
rustc()
Expand All @@ -53,10 +63,10 @@ fn main() {
.disassemble()
.input("rsmain")
.run()
.assert_stdout_not_contains_regex("call.*c_always_inlined");
.assert_stdout_not_contains_regex(ALWAYS_INLINED_PATTERN);
llvm_objdump()
.disassemble()
.input("rsmain")
.run()
.assert_stdout_contains_regex("call.*c_never_inlined");
.assert_stdout_contains_regex(NEVER_INLINED_PATTERN);
}

0 comments on commit 328e897

Please sign in to comment.