• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: 'vmtest'
2description: 'Build + run vmtest'
3inputs:
4  kernel:
5    description: 'kernel version or LATEST'
6    required: true
7    default: 'LATEST'
8  arch:
9    description: 'what arch to test'
10    required: true
11    default: 'x86_64'
12  pahole:
13    description: 'pahole rev or master'
14    required: true
15    default: 'master'
16runs:
17  using: "composite"
18  steps:
19    # setup envinronment
20    - name: Setup environment
21      uses: libbpf/ci/setup-build-env@master
22      with:
23        pahole: ${{ inputs.pahole }}
24    # 1. download CHECKPOINT kernel source
25    - name: Get checkpoint commit
26      shell: bash
27      run: |
28        cat CHECKPOINT-COMMIT
29        echo "CHECKPOINT=$(cat CHECKPOINT-COMMIT)" >> $GITHUB_ENV
30    - name: Get kernel source at checkpoint
31      uses: libbpf/ci/get-linux-source@master
32      with:
33        repo: 'https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git'
34        rev: ${{ env.CHECKPOINT }}
35        dest: '${{ github.workspace }}/.kernel'
36    - name: Patch kernel source
37      uses: libbpf/ci/patch-kernel@master
38      with:
39        patches-root: '${{ github.workspace }}/travis-ci/diffs'
40        repo-root: '.kernel'
41    - name: Prepare to build BPF selftests
42      shell: bash
43      run: |
44        echo "::group::Prepare buidling selftest"
45        cd .kernel
46        cp ${{ github.workspace }}/travis-ci/vmtest/configs/config-latest.${{ inputs.arch }} .config
47        make olddefconfig && make prepare
48        cd -
49        echo "::endgroup::"
50    # 2. if kernel == LATEST, build kernel image from tree
51    - name: Build kernel image
52      if: ${{ inputs.kernel == 'LATEST' }}
53      shell: bash
54      run: |
55        echo "::group::Build Kernel Image"
56        cd .kernel
57        make -j $((4*$(nproc))) all > /dev/null
58        cp vmlinux ${{ github.workspace }}
59        cd -
60        echo "::endgroup::"
61    # else, just download prebuilt kernel image
62    - name: Download prebuilt kernel
63      if: ${{ inputs.kernel != 'LATEST' }}
64      uses: libbpf/ci/download-vmlinux@master
65      with:
66        kernel: ${{ inputs.kernel }}
67        arch: ${{ inputs.arch }}
68    # 3. build selftests
69    - name: Build BPF selftests
70      uses: ./.github/actions/build-selftests
71      with:
72        repo-path: '.kernel'
73        kernel: ${{ inputs.kernel }}
74    # 4. prepare rootfs
75    - name: prepare rootfs
76      uses: libbpf/ci/prepare-rootfs@master
77      with:
78        kernel: ${{ inputs.kernel }}
79        project-name: 'libbpf'
80        arch: ${{ inputs.arch }}
81    # 5. run selftest in QEMU
82    - name: Run selftests
83      uses: libbpf/ci/run-qemu@master
84      with:
85        img: '/tmp/root.img'
86        vmlinuz: 'vmlinuz'
87        arch: ${{ inputs.arch }}
88