Skip to content

Commit af08a2f

Browse files
committed
CI/CD: Add aarch64-unknown-linux-gnu test code coverage.
aarch64-unknown-linux-musl doesn't have profiler_builtins enabled so use aarch64-unknown-linux-gnu instead. Work around an issue where the "%m" feature of the LLVM source-based code coverage doesn't work within QEMU.
1 parent 6314cc7 commit af08a2f

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

.github/workflows/ci.yml

+4
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ jobs:
265265

266266
# TODO: targets
267267
target:
268+
- aarch64-unknown-linux-gnu
268269
- i686-unknown-linux-gnu
269270
- x86_64-unknown-linux-musl
270271

@@ -277,6 +278,9 @@ jobs:
277278

278279
# TODO: targets
279280
include:
281+
- target: aarch64-unknown-linux-gnu
282+
host_os: ubuntu-18.04
283+
280284
- target: i686-unknown-linux-gnu
281285
host_os: ubuntu-18.04
282286

mk/cargo.sh

+6-3
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ case $target in
4545
export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=$android_tools/aarch64-linux-android21-clang
4646
;;
4747
aarch64-unknown-linux-gnu)
48-
export CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc
49-
export AR_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc-ar
48+
export CC_aarch64_unknown_linux_gnu=clang-10
49+
export AR_aarch64_unknown_linux_gnu=llvm-ar-10
50+
export CFLAGS_aarch64_unknown_linux_gnu="--sysroot=/usr/aarch64-linux-gnu"
5051
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc
5152
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER="$qemu_aarch64"
5253
;;
@@ -107,7 +108,9 @@ if [ -n "${RING_COVERAGE-}" ]; then
107108
export RING_BUILD_EXECUTABLE_LIST="$coverage_dir/executables"
108109
truncate --size=0 "$RING_BUILD_EXECUTABLE_LIST"
109110

110-
export LLVM_PROFILE_FILE="$coverage_dir/%m.profraw"
111+
# This doesn't work when profiling under QEMU. Instead mk/runner does
112+
# something similar but different.
113+
# export LLVM_PROFILE_FILE="$coverage_dir/%m.profraw"
111114

112115
# ${target} with hyphens replaced by underscores, lowercase and uppercase.
113116
target_lower=${target//-/_}

mk/install-build-tools.sh

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ esac
3838

3939
case $target in
4040
--target=aarch64-unknown-linux-gnu)
41+
# Clang is needed for code coverage.
42+
use_clang=1
4143
install_packages \
4244
qemu-user \
4345
gcc-aarch64-linux-gnu \

mk/runner

+13-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,20 @@
22
set -eux -o pipefail
33
IFS=$'\n\t'
44

5+
for arg in $*; do
6+
# There can be some arguments prefixed in front of the executable, e.g.
7+
# when qemu-user is used. There can be arguments after the executable,
8+
# e.g. `cargo test` arguments like `TESTNAME`.
9+
if [[ $arg = */deps/* ]]; then
10+
executable=$arg
11+
break
12+
fi
13+
done
14+
15+
export LLVM_PROFILE_FILE=$(dirname "$RING_BUILD_EXECUTABLE_LIST")/$(basename "$executable").profraw
16+
517
if [ -n "$RING_BUILD_EXECUTABLE_LIST" ]; then
6-
echo $1 >> "$RING_BUILD_EXECUTABLE_LIST"
18+
echo "$executable" >> "$RING_BUILD_EXECUTABLE_LIST"
719
fi
820

921
$*

0 commit comments

Comments
 (0)