Skip to content

Commit 9c0bf3d

Browse files
[BOLT] Add Dockerfile for testing (#173066)
Add utils/docker-tests/Dockerfile to facilitate in-tre and out-of-tree testing. Builds perf from source to work around an Ubuntu 24.04 issue. To reproduce a specific issue adjust the Dockerfile like: ``` RUN git clone https://github.com/llvm/llvm-project RUN cd llvm-project && git checkout <SHA> ```
1 parent 6a7d550 commit 9c0bf3d

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

bolt/utils/docker-tests/Dockerfile

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
FROM docker.io/library/ubuntu:24.04 AS builder
2+
3+
# Perf package dropped for a range of Ubuntu releases, so we build it manually.
4+
# See Ubuntu bug tracker:
5+
# https://bugs.launchpad.net/ubuntu/+source/linux-hwe-6.14/+bug/2117147
6+
7+
# Download perf version 6.17 to guarantee it has all code we need to cover
8+
# AArch64 SPE and BRBE support. Can drop once perf is available in Ubuntu again
9+
# and sufficiently recent.
10+
ARG PERF_VER=6.17
11+
ARG PERF_SHA256="ee55669e1a580015925cf586d148f65aa4390213ba5d8377260a13878bc54c5c"
12+
13+
RUN set -eux; \
14+
apt-get update; \
15+
apt-get install -y --no-install-recommends ca-certificates wget; \
16+
wget -O /tmp/perf.tar.xz "https://mirrors.edge.kernel.org/pub/linux/kernel/tools/perf/v${PERF_VER}.0/perf-${PERF_VER}.0.tar.xz"; \
17+
echo "${PERF_SHA256} /tmp/perf.tar.xz" | sha256sum -c -;
18+
19+
# Compile perf.
20+
RUN set -eux; \
21+
apt-get update; \
22+
apt-get install -y --no-install-recommends \
23+
xz-utils libtraceevent-dev libtracefs-dev \
24+
build-essential flex bison \
25+
libelf-dev libdw-dev zlib1g-dev liblzma-dev libcap-dev libnuma-dev \
26+
python3 python3-dev python3-setuptools \
27+
pkg-config; \
28+
mkdir -p /src && tar -C /src -xf /tmp/perf.tar.xz; \
29+
cd "/src/perf-${PERF_VER}.0"; \
30+
make -C tools/perf -j"$(nproc)"; \
31+
install -m 0755 tools/perf/perf /usr/local/bin/perf; \
32+
/usr/local/bin/perf --version >&2
33+
34+
# Install tools for BOLT compilation.
35+
RUN apt-get update && \
36+
apt-get install -y --no-install-recommends git \
37+
build-essential cmake ninja-build python3 zstd ccache \
38+
python3-psutil && \
39+
rm -rf /var/lib/apt/lists
40+
41+
WORKDIR /home/bolt
42+
43+
# Get sources, compile BOLT, and run test suites.
44+
RUN git clone --depth 1 https://github.com/llvm/llvm-project
45+
RUN git clone --depth 1 https://github.com/rafaelauler/bolt-tests
46+
47+
RUN mkdir build && \
48+
cd build && \
49+
cmake -G Ninja ../llvm-project/llvm \
50+
-DLLVM_ENABLE_PROJECTS="bolt;clang;lld" \
51+
-DLLVM_TARGETS_TO_BUILD="AArch64;X86" \
52+
-DCMAKE_BUILD_TYPE=Release \
53+
-DLLVM_CCACHE_BUILD=ON \
54+
-DLLVM_ENABLE_ASSERTIONS=ON \
55+
-DLLVM_EXTERNAL_PROJECTS="bolttests" \
56+
-DLLVM_EXTERNAL_BOLTTESTS_SOURCE_DIR=../bolt-tests
57+
58+
RUN cd build && ninja check-bolt
59+
RUN cd build && ninja check-large-bolt

0 commit comments

Comments
 (0)