Skip to content

Commit 5e2b2c0

Browse files
committed
GCC BPF: factor out into a separate job
In order to test selftests/bpf build with GCC BPF, the latest snapshot of GCC BPF compiler has to built from source. We don't want this to be a dependency for all the test runners, so introduce a separate gcc-bpf workflow that executes the following: * checkout Linux source tree and patch it (as in kernel-build) * download relevant artifacts with the KBUILD_OUTPUT objects (as in kernel-test) * build/download GCC BPF compiler * build selftests/bpf/test_progs-bpf_gcc runner, hence the test BPF objects built with GCC The test_progs-bpf_gcc runner is not executed on BPF CI yet [1], so successful selftests build is a successful job run. [1] https://lore.kernel.org/bpf/87bjw6qpje.fsf@oracle.com/
1 parent e0831de commit 5e2b2c0

File tree

3 files changed

+100
-12
lines changed

3 files changed

+100
-12
lines changed

.github/workflows/gcc-bpf.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Testing GCC BPF compiler
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
runs_on:
7+
required: true
8+
type: string
9+
arch:
10+
required: true
11+
type: string
12+
llvm-version:
13+
required: true
14+
type: string
15+
toolchain:
16+
required: true
17+
type: string
18+
toolchain_full:
19+
required: true
20+
type: string
21+
download_sources:
22+
required: true
23+
type: boolean
24+
25+
jobs:
26+
test:
27+
name: GCC BPF
28+
runs-on: ${{ fromJSON(inputs.runs_on) }}
29+
timeout-minutes: 100
30+
env:
31+
ARCH: ${{ inputs.arch }}
32+
BPF_GCC_INSTALL_DIR: ${{ github.workspace }}/gcc-bpf
33+
BPF_NEXT_BASE_BRANCH: 'master'
34+
REPO_ROOT: ${{ github.workspace }}/src
35+
KBUILD_OUTPUT: ${{ github.workspace }}/src/kbuild-output
36+
37+
steps:
38+
39+
- uses: actions/checkout@v4
40+
41+
- if: ${{ inputs.download_sources }}
42+
name: Download bpf-next tree
43+
uses: libbpf/ci/get-linux-source@v3
44+
with:
45+
dest: ${{ env.REPO_ROOT }}
46+
rev: ${{ env.BPF_NEXT_BASE_BRANCH }}
47+
48+
- uses: ./patch-kernel
49+
with:
50+
patches-root: '${{ github.workspace }}/ci/diffs'
51+
repo-root: ${{ env.REPO_ROOT }}
52+
53+
- uses: actions/download-artifact@v4
54+
with:
55+
name: vmlinux-${{ inputs.arch }}-${{ inputs.toolchain_full }}
56+
path: ${{ env.REPO_ROOT }}
57+
58+
- name: Untar artifacts
59+
working-directory: ${{ env.REPO_ROOT }}
60+
run: zstd -d -T0 vmlinux-${{ inputs.arch }}-${{ inputs.toolchain_full }}.tar.zst --stdout | tar -xf -
61+
62+
- name: Setup build environment
63+
uses: ./setup-build-env
64+
with:
65+
arch: ${{ inputs.arch }}
66+
llvm-version: ${{ inputs.llvm-version }}
67+
68+
- name: Build GCC BPF compiler
69+
uses: ./build-bpf-gcc
70+
with:
71+
install-dir: ${{ env.BPF_GCC_INSTALL_DIR }}
72+
73+
- name: Build selftests/bpf/test_progs-bpf_gcc
74+
uses: ./build-selftests
75+
env:
76+
MAX_MAKE_JOBS: 32
77+
BPF_GCC: ${{ env.BPF_GCC_INSTALL_DIR }}
78+
SELFTESTS_BPF_TARGETS: 'test_progs-bpf_gcc'
79+
with:
80+
arch: ${{ inputs.arch }}
81+
kernel-root: ${{ env.REPO_ROOT }}
82+
llvm-version: ${{ inputs.llvm-version }}
83+
toolchain: ${{ inputs.toolchain }}
84+

.github/workflows/kernel-build-test.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ jobs:
6262
llvm-version: ${{ inputs.llvm-version }}
6363
kernel: ${{ inputs.kernel }}
6464
download_sources: ${{ inputs.download_sources }}
65+
6566
build-release:
6667
if: ${{ inputs.build_release }}
6768
uses: ./.github/workflows/kernel-build.yml
@@ -74,6 +75,7 @@ jobs:
7475
kernel: ${{ inputs.kernel }}
7576
download_sources: ${{ inputs.download_sources }}
7677
release: true
78+
7779
test:
7880
if: ${{ inputs.run_tests }}
7981
uses: ./.github/workflows/kernel-test.yml
@@ -91,4 +93,17 @@ jobs:
9193
kernel: ${{ inputs.kernel }}
9294
test: ${{ matrix.test }}
9395
continue_on_error: ${{ toJSON(matrix.continue_on_error) }}
94-
timeout_minutes: ${{ matrix.timeout_minutes }}
96+
timeout_minutes: ${{ matrix.timeout_minutes }}
97+
98+
gcc-bpf:
99+
if: ${{ inputs.arch == 'x86_64' }}
100+
uses: ./.github/workflows/gcc-bpf.yml
101+
needs: [build]
102+
with:
103+
runs_on: ${{ inputs.runs_on }}
104+
arch: ${{ inputs.arch }}
105+
llvm-version: ${{ inputs.llvm-version }}
106+
toolchain: ${{ inputs.toolchain }}
107+
toolchain_full: ${{ inputs.toolchain_full }}
108+
download_sources: ${{ inputs.download_sources }}
109+

.github/workflows/kernel-build.yml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ jobs:
4646
timeout-minutes: 100
4747
env:
4848
ARTIFACTS_ARCHIVE: "vmlinux-${{ inputs.arch }}-${{ inputs.toolchain_full }}.tar.zst"
49-
50-
BUILD_BPF_GCC: ${{ inputs.arch == 'x86_64' && 'true' || '' }}
51-
BPF_GCC_INSTALL_DIR: ${{ github.workspace }}/bpf-gcc
52-
5349
BPF_NEXT_BASE_BRANCH: 'master'
5450
BPF_NEXT_FETCH_DEPTH: 64 # A bit of history is needed to facilitate incremental builds
5551
# BUILD_SCHED_EXT_SELFTESTS: ${{ inputs.arch == 'x86_64' || inputs.arch == 'aarch64' && 'true' || '' }}
@@ -112,18 +108,11 @@ jobs:
112108
max-make-jobs: 32
113109
llvm-version: ${{ inputs.llvm-version }}
114110

115-
- if: ${{ env.BUILD_BPF_GCC }}
116-
name: Build GCC for BPF selftests
117-
uses: ./build-bpf-gcc
118-
with:
119-
install-dir: ${{ env.BPF_GCC_INSTALL_DIR }}
120-
121111
- name: Build selftests/bpf
122112
uses: ./build-selftests
123113
env:
124114
MAX_MAKE_JOBS: 32
125115
RELEASE: ${{ inputs.release && '1' || '' }}
126-
BPF_GCC: ${{ env.BUILD_BPF_GCC && env.BPF_GCC_INSTALL_DIR || '' }}
127116
with:
128117
arch: ${{ inputs.arch }}
129118
kernel-root: ${{ env.KERNEL_ROOT }}

0 commit comments

Comments
 (0)