|
9 | 9 | jobs: |
10 | 10 | build: |
11 | 11 |
|
12 | | - runs-on: ubuntu-latest |
| 12 | + # ubuntu-latest runs a recent kernel with /dev/userfaultfd support whereas |
| 13 | + # ubuntu-20.04 has a 5.15 kernel. We run the job in both, so we can test |
| 14 | + # both paths for creating the file descriptor, i.e. /dev/userfaultfd ioctl |
| 15 | + # and userfaultfd syscall. |
| 16 | + runs-on: ${{ matrix.runner }} |
| 17 | + strategy: |
| 18 | + matrix: |
| 19 | + runner: [ ubuntu-latest, ubuntu-20.04 ] |
13 | 20 |
|
14 | 21 | steps: |
15 | 22 | - uses: actions/checkout@v2 |
| 23 | + |
| 24 | + # Keep this step, so that we can check that the Linux kernel is the one we |
| 25 | + # expect, depending on the runner kernel. |
| 26 | + - name: Check Linux version |
| 27 | + run: uname -r |
| 28 | + |
| 29 | + # /dev/userfaultfd is only present on ubuntu-latest. |
| 30 | + - name: Setup access to /dev/userfaultfd |
| 31 | + if: ${{ matrix.runner == 'ubuntu-latest' }} |
| 32 | + run: sudo setfacl -m u:${USER}:rw /dev/userfaultfd |
| 33 | + |
16 | 34 | - name: Build |
17 | 35 | run: cargo build --verbose |
18 | 36 |
|
19 | | - # The github ubuntu-latest is now on linux 5.11 kernel, |
20 | | - # so we can test the crate with support for each of the |
21 | | - # kernel featuresets: |
22 | | - |
23 | 37 | - name: Run tests (Linux 4.11 support) |
24 | 38 | run: cargo test --verbose |
25 | 39 | - name: Run tests (Linux 4.14 support) |
26 | 40 | run: cargo test --verbose --features linux4_14 |
| 41 | + |
27 | 42 | - name: Run tests (Linux 5.7 support) |
| 43 | + if: ${{ matrix.runner == 'ubuntu-latest' }} |
28 | 44 | run: cargo test --verbose --features linux5_7 |
29 | 45 |
|
| 46 | + # On ubuntu-20.04 runner we need to make sure we have the proper kernel |
| 47 | + # headers for building the correct bindings |
| 48 | + - name: Run tests (Linux 5.7 support) |
| 49 | + if: ${{ matrix.runner == 'ubuntu-20.04' }} |
| 50 | + run: |
| 51 | + sudo apt update && |
| 52 | + sudo apt install -y linux-headers-5.11.0-25-generic && |
| 53 | + export LINUX_HEADERS=/usr/src/linux-headers-5.11.0-25-generic && |
| 54 | + cargo test --verbose --features linux5_7 |
| 55 | + |
30 | 56 | audit: |
31 | 57 |
|
32 | 58 | runs-on: ubuntu-latest |
|
0 commit comments