Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add BPF GCC support for BPF CI #290

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions .github/scripts/matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ class Compiler(str, Enum):
class Toolchain:
compiler: Compiler
# This is relevant ONLY for LLVM and should not be required for GCC
version: int
version: int = 0
extra_name: str = ""

@property
def short_name(self) -> str:
Expand All @@ -48,9 +49,15 @@ def short_name(self) -> str:
@property
def full_name(self) -> str:
if self.compiler == Compiler.GCC:
return self.short_name
if self.extra_name != '':
return f"{self.short_name}-{self.extra_name}"
else:
return f"{self.short_name}"

return f"{self.short_name}-{self.version}"
if self.extra_name != '':
return f"{self.short_name}-{self.version}-{self.extra_name}"
else:
return f"{self.short_name}-{self.version}"

def to_dict(self) -> Dict[str, Union[str, int]]:
return {
Expand All @@ -64,6 +71,7 @@ def to_dict(self) -> Dict[str, Union[str, int]]:
class BuildConfig:
arch: Arch
toolchain: Toolchain
bpf_toolchain: Toolchain = dataclasses.field(default_factory=lambda: Toolchain(compiler=Compiler.LLVM, version=DEFAULT_LLVM_VERSION))
kernel: str = "LATEST"
run_veristat: bool = False
parallel_tests: bool = False
Expand Down Expand Up @@ -100,6 +108,9 @@ def tests(self) -> Dict[str, Any]:
if self.toolchain.version >= 18:
tests_list.append("test_progs_cpuv4")

if self.bpf_toolchain == "gcc":
tests_list = [ "test_progs-bpf_gcc" ]

if not self.parallel_tests:
tests_list = [test for test in tests_list if not test.endswith("parallel")]

Expand All @@ -109,6 +120,7 @@ def to_dict(self) -> Dict[str, Any]:
return {
"arch": self.arch.value,
"toolchain": self.toolchain.to_dict(),
"bpf_toolchain": self.bpf_toolchain.to_dict(),
"kernel": self.kernel,
"run_veristat": self.run_veristat,
"parallel_tests": self.parallel_tests,
Expand Down Expand Up @@ -185,6 +197,11 @@ def generate_test_config(test: str) -> Dict[str, Union[str, int]]:
arch=Arch.S390X,
toolchain=Toolchain(compiler=Compiler.GCC, version=DEFAULT_LLVM_VERSION),
),
BuildConfig(
arch=Arch.X86_64,
toolchain=Toolchain(compiler=Compiler.GCC, version=DEFAULT_LLVM_VERSION, extra_name="bpfgcc"),
bpf_toolchain=Toolchain(compiler=Compiler.GCC),
),
]

# Outside of those repositories we only run on x86_64
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/kernel-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ on:
required: true
type: string
description: The toolchain, e.g gcc, llvm
bpf-toolchain:
required: true
type: string
description: The toolchain, e.g gcc, llvm
runs_on:
required: true
type: string
Expand Down Expand Up @@ -65,6 +69,7 @@ jobs:
arch: ${{ inputs.arch }}
toolchain_full: ${{ inputs.toolchain_full }}
toolchain: ${{ inputs.toolchain }}
bpf-toolchain: ${{ inputs.bpf-toolchain }}
runs_on: ${{ inputs.build_runs_on }}
llvm-version: ${{ inputs.llvm-version }}
kernel: ${{ inputs.kernel }}
Expand All @@ -76,6 +81,7 @@ jobs:
arch: ${{ inputs.arch }}
toolchain_full: ${{ inputs.toolchain_full }}
toolchain: ${{ inputs.toolchain }}
bpf-toolchain: ${{ inputs.bpf-toolchain }}
runs_on: ${{ inputs.runs_on }}
llvm-version: ${{ inputs.llvm-version }}
kernel: ${{ inputs.kernel }}
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/kernel-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ on:
required: true
type: string
description: The toolchain, e.g gcc, llvm
bpf-toolchain:
required: true
type: string
description: The toolchain, e.g gcc, llvm
runs_on:
required: true
type: string
Expand Down Expand Up @@ -94,6 +98,7 @@ jobs:
arch: ${{ inputs.arch }}
llvm-version: ${{ inputs.llvm-version }}
pahole: c2f89dab3f2b0ebb53bab3ed8be32f41cb743c37
bpf-toolchain: ${{ inputs.bpf-toolchain }}
- name: Build kernel image
uses: libbpf/ci/build-linux@main
with:
Expand All @@ -107,6 +112,7 @@ jobs:
with:
arch: ${{ inputs.arch }}
toolchain: ${{ inputs.toolchain }}
bpf-toolchain: ${{ inputs.bpf-toolchain }}
kbuild-output: ${{ env.KBUILD_OUTPUT }}
max-make-jobs: 32
llvm-version: ${{ inputs.llvm-version }}
Expand All @@ -115,7 +121,7 @@ jobs:
# RELEASE=0 adds -O0 make flag
# RELEASE=1 adds -O2 make flag
RELEASE: ${{ inputs.release && '1' || '' }}
- if: ${{ github.event_name != 'push' }}
- if: ${{ inputs.bpf-toolchain != 'gcc' && github.event_name != 'push' }}
name: Build samples
uses: libbpf/ci/build-samples@main
with:
Expand All @@ -127,7 +133,7 @@ jobs:
- name: Tar artifacts
run: |
bash .github/scripts/tar-artifact.sh ${{ inputs.arch }} ${{ inputs.toolchain_full }}
- if: ${{ github.event_name != 'push' }}
- if: ${{ inputs.bpf-toolchain != 'gcc' && github.event_name != 'push' }}
name: Remove KBUILD_OUTPUT content
shell: bash
run: |
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@ jobs:
arch: ${{ matrix.arch }}
toolchain_full: ${{ matrix.toolchain.fullname }}
toolchain: ${{ matrix.toolchain.name }}
bpf-toolchain: ${{ matrix.bpf_toolchain.name }}
runs_on: ${{ toJSON(matrix.runs_on) }}
build_runs_on: ${{ toJSON(matrix.build_runs_on) }}
llvm-version: ${{ matrix.toolchain.version }}
kernel: ${{ matrix.kernel }}
tests: ${{ toJSON(matrix.tests) }}
run_veristat: ${{ matrix.run_veristat }}
# We only run tests on pull requests.
run_tests: ${{ github.event_name != 'push' }}
run_tests: ${{ matrix.bpf_toolchain.name != 'gcc' && github.event_name != 'push' }}
# Download sources
download_sources: ${{ github.repository == 'kernel-patches/vmtest' }}
build_release: ${{ matrix.build_release }}
Expand Down