|
| 1 | +name: test_progs with ASAN |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + arch: |
| 7 | + required: true |
| 8 | + type: string |
| 9 | + description: The architecture to build against, e.g x86_64, aarch64, s390x... |
| 10 | + toolchain_full: |
| 11 | + required: true |
| 12 | + type: string |
| 13 | + description: The toolchain and for llvm, its version, e.g gcc, llvm-15 |
| 14 | + toolchain: |
| 15 | + required: true |
| 16 | + type: string |
| 17 | + description: The toolchain, e.g gcc, llvm |
| 18 | + runs_on: |
| 19 | + required: true |
| 20 | + type: string |
| 21 | + description: The runners to run the test on. This is a json string representing an array of labels. |
| 22 | + gcc_version: |
| 23 | + required: true |
| 24 | + type: string |
| 25 | + description: GCC version to install |
| 26 | + llvm_version: |
| 27 | + required: true |
| 28 | + type: string |
| 29 | + description: LLVM version to install |
| 30 | + |
| 31 | +jobs: |
| 32 | + build: |
| 33 | + name: build test_progs with ASAN |
| 34 | + runs-on: |
| 35 | + - ${{ format('codebuild-bpf-ci-{0}-{1}', github.run_id, github.run_attempt) }} |
| 36 | + - image:${{ inputs.arch == 'aarch64' && 'custom-arm-ghcr.io/kernel-patches/runner:kbuilder-debian-aarch64' |
| 37 | + || 'custom-linux-ghcr.io/kernel-patches/runner:kbuilder-debian-x86_64' }} |
| 38 | + env: |
| 39 | + ARCH: ${{ inputs.arch }} |
| 40 | + ARTIFACTS_ARCHIVE: ${{ github.workspace }}/selftests-bpf-asan-${{ inputs.arch }}-${{ inputs.toolchain_full }}.tar.zst |
| 41 | + KERNEL_ORIGIN: ${{ github.repository == 'kernel-patches/bpf-rc' && 'https://github.com/kernel-patches/bpf-rc.git' |
| 42 | + || 'https://github.com/kernel-patches/bpf.git' |
| 43 | + }} |
| 44 | + KERNEL_REVISION: ${{ inputs.download_sources && 'bpf-next' || github.sha }} |
| 45 | + REPO_ROOT: ${{ github.workspace }}/src |
| 46 | + steps: |
| 47 | + |
| 48 | + - uses: actions/checkout@v6 |
| 49 | + with: |
| 50 | + sparse-checkout: | |
| 51 | + .github |
| 52 | + ci |
| 53 | +
|
| 54 | + - name: Download bpf-next tree @ ${{ env.KERNEL_REVISION }} |
| 55 | + uses: libbpf/ci/get-linux-source@v4 |
| 56 | + with: |
| 57 | + dest: ${{ env.REPO_ROOT }} |
| 58 | + repo: ${{ env.KERNEL_ORIGIN }} |
| 59 | + rev: ${{ env.KERNEL_REVISION }} |
| 60 | + |
| 61 | + - uses: libbpf/ci/patch-kernel@v4 |
| 62 | + with: |
| 63 | + patches-root: '${{ github.workspace }}/ci/diffs' |
| 64 | + repo-root: ${{ env.REPO_ROOT }} |
| 65 | + |
| 66 | + - name: Setup build environment |
| 67 | + uses: libbpf/ci/setup-build-env@v4 |
| 68 | + with: |
| 69 | + arch: ${{ inputs.arch }} |
| 70 | + gcc-version: ${{ inputs.gcc_version }} |
| 71 | + llvm-version: ${{ inputs.llvm_version }} |
| 72 | + |
| 73 | + - uses: actions/download-artifact@v4 |
| 74 | + with: |
| 75 | + name: vmlinux-${{ inputs.arch }}-${{ inputs.toolchain_full }} |
| 76 | + path: ${{ env.REPO_ROOT }} |
| 77 | + |
| 78 | + - name: Untar artifacts |
| 79 | + working-directory: ${{ env.REPO_ROOT }} |
| 80 | + run: zstd -d -T0 vmlinux-${{ inputs.arch }}-${{ inputs.toolchain_full }}.tar.zst --stdout | tar -xf - |
| 81 | + |
| 82 | + - name: Build selftests/bpf/test_progs with ASAN |
| 83 | + uses: libbpf/ci/build-selftests@v4 |
| 84 | + env: |
| 85 | + KBUILD_OUTPUT: ${{ env.REPO_ROOT }}/kbuild-output |
| 86 | + SELFTESTS_BPF_ASAN: 'true' |
| 87 | + SELFTESTS_BPF_TARGETS: 'test_progs' |
| 88 | + with: |
| 89 | + arch: ${{ inputs.arch }} |
| 90 | + kernel-root: ${{ env.REPO_ROOT }} |
| 91 | + llvm-version: ${{ inputs.llvm_version }} |
| 92 | + toolchain: ${{ inputs.toolchain }} |
| 93 | + |
| 94 | + - name: Tar artifacts |
| 95 | + id: tar-artifacts |
| 96 | + uses: libbpf/ci/tar-artifacts@v4 |
| 97 | + env: |
| 98 | + ARCHIVE_BPF_SELFTESTS: 'true' |
| 99 | + ARCHIVE_KBUILD_OUTPUT: '' # emptystring means false |
| 100 | + with: |
| 101 | + arch: ${{ inputs.arch }} |
| 102 | + archive: ${{ env.ARTIFACTS_ARCHIVE }} |
| 103 | + kbuild-output: ${{ env.REPO_ROOT }}/kbuild-output |
| 104 | + repo-root: ${{ env.REPO_ROOT }} |
| 105 | + |
| 106 | + - uses: actions/upload-artifact@v4 |
| 107 | + with: |
| 108 | + name: selftests-bpf-asan-${{ inputs.arch }}-${{ inputs.toolchain_full }} |
| 109 | + if-no-files-found: error |
| 110 | + path: ${{ env.ARTIFACTS_ARCHIVE }} |
| 111 | + |
| 112 | + test: |
| 113 | + name: test_progs ASAN |
| 114 | + runs-on: ${{ fromJSON(inputs.runs_on) }} |
| 115 | + needs: [build] |
| 116 | + timeout-minutes: 100 |
| 117 | + env: |
| 118 | + ARCH: ${{ inputs.arch }} |
| 119 | + REPO_ROOT: ${{ github.workspace }} |
| 120 | + REPO_PATH: "" |
| 121 | + DEPLOYMENT: ${{ github.repository == 'kernel-patches/bpf' && 'prod' || 'rc' }} |
| 122 | + ALLOWLIST_FILE: /tmp/allowlist |
| 123 | + DENYLIST_FILE: /tmp/denylist |
| 124 | + steps: |
| 125 | + - uses: actions/checkout@v4 |
| 126 | + with: |
| 127 | + sparse-checkout: | |
| 128 | + .github |
| 129 | + ci |
| 130 | +
|
| 131 | + - uses: actions/download-artifact@v4 |
| 132 | + with: |
| 133 | + name: vmlinux-${{ inputs.arch }}-${{ inputs.toolchain_full }} |
| 134 | + path: ${{ env.REPO_ROOT }} |
| 135 | + |
| 136 | + - name: Untar vmlinux |
| 137 | + working-directory: ${{ env.REPO_ROOT }} |
| 138 | + run: zstd -d -T0 vmlinux-${{ inputs.arch }}-${{ inputs.toolchain_full }}.tar.zst --stdout | tar -xf - |
| 139 | + |
| 140 | + - uses: actions/download-artifact@v4 |
| 141 | + with: |
| 142 | + name: selftests-bpf-asan-${{ inputs.arch }}-${{ inputs.toolchain_full }} |
| 143 | + path: ${{ env.REPO_ROOT }} |
| 144 | + |
| 145 | + - name: Untar test_progs ASAN |
| 146 | + working-directory: ${{ env.REPO_ROOT }} |
| 147 | + run: zstd -d -T0 selftests-bpf-asan-${{ inputs.arch }}-${{ inputs.toolchain_full }}.tar.zst --stdout | tar -xf - |
| 148 | + |
| 149 | + - name: Run selftests |
| 150 | + uses: libbpf/ci/run-vmtest@v4 |
| 151 | + env: |
| 152 | + ARCH: ${{ inputs.arch }} |
| 153 | + DEPLOYMENT: ${{ env.DEPLOYMENT }} |
| 154 | + LLVM_VERSION: ${{ inputs.llvm_version }} |
| 155 | + SELFTESTS_BPF: ${{ github.workspace }}/selftests/bpf |
| 156 | + SELFTESTS_BPF_ASAN: 'true' |
| 157 | + VMTEST_CONFIGS: ${{ github.workspace }}/ci/vmtest/configs |
| 158 | + VMTEST_MEMORY: 5G |
| 159 | + VMTEST_NUM_CPUS: 4 |
| 160 | + TEST_PROGS_WATCHDOG_TIMEOUT: 600 |
| 161 | + with: |
| 162 | + arch: ${{ inputs.arch }} |
| 163 | + vmlinuz: '${{ github.workspace }}/vmlinuz' |
| 164 | + kernel-root: ${{ env.REPO_ROOT }} |
| 165 | + kernel-test: test_progs |
| 166 | + kbuild-output: ${{ env.REPO_ROOT }}/kbuild-output |
0 commit comments