Avoid two 64-bit divisions per scanned block
[zfs.git] / .github / workflows / zfs-tests-sanity.yml
blob4c15cecf58d8dcf4a0372691a825ccf0bf4eda0d
1 name: zfs-tests-sanity
3 on:
4   push:
5   pull_request:
7 jobs:
8   tests:
9     runs-on: ubuntu-20.04
10     steps:
11     - uses: actions/checkout@v2
12       with:
13         ref: ${{ github.event.pull_request.head.sha }}
14     - name: Reclaim disk space
15       run: |
16         ${{ github.workspace }}/.github/workflows/scripts/reclaim_disk_space.sh
17     - name: Install dependencies
18       run: |
19         sudo apt-get update
20         xargs --arg-file=${{ github.workspace }}/.github/workflows/build-dependencies.txt sudo apt-get install -qq
21         sudo apt-get clean
22     - name: Autogen.sh
23       run: |
24         ./autogen.sh
25     - name: Configure
26       run: |
27         ./configure --enable-debug --enable-debuginfo --enable-asan --enable-ubsan --with-config=dist
28     - name: Make
29       run: |
30         make -j$(nproc) --no-print-directory --silent pkg-utils pkg-kmod
31     - name: Install
32       run: |
33         sudo dpkg -i *.deb
34         # Update order of directories to search for modules, otherwise
35         #   Ubuntu will load kernel-shipped ones.
36         sudo sed -i.bak 's/updates/extra updates/' /etc/depmod.d/ubuntu.conf
37         sudo depmod
38         sudo modprobe zfs
39         # Workaround for cloud-init bug
40         # see https://github.com/openzfs/zfs/issues/12644
41         FILE=/lib/udev/rules.d/10-cloud-init-hook-hotplug.rules
42         if [ -r "${FILE}" ]; then
43           HASH=$(md5sum "${FILE}" | awk '{ print $1 }')
44           if [ "${HASH}" = "121ff0ef1936cd2ef65aec0458a35772" ]; then
45             # Just shove a zd* exclusion right above the hotplug hook...
46             sudo sed -i -e s/'LABEL="cloudinit_hook"'/'KERNEL=="zd*", GOTO="cloudinit_end"\n&'/ "${FILE}"
47             sudo udevadm control --reload-rules
48           fi
49         fi
50     - name: Clear the kernel ring buffer
51       run: |
52         sudo dmesg -c >/var/tmp/dmesg-prerun
53     - name: Report disk space
54       run: |
55         df -h /
56     - name: Tests
57       run: |
58         set -o pipefail
59         /usr/share/zfs/zfs-tests.sh -vKR -s 3G -r sanity | scripts/zfs-tests-color.sh
60       shell: bash
61       timeout-minutes: 330
62     - name: Prepare artifacts
63       if: failure()
64       run: |
65         RESULTS_PATH=$(readlink -f /var/tmp/test_results/current)
66         sudo dmesg > $RESULTS_PATH/dmesg
67         sudo cp /var/log/syslog /var/tmp/dmesg-prerun $RESULTS_PATH/
68         sudo chmod +r $RESULTS_PATH/*
69         # Replace ':' in dir names, actions/upload-artifact doesn't support it
70         for f in $(find /var/tmp/test_results -name '*:*'); do mv "$f" "${f//:/__}"; done
71     - uses: actions/upload-artifact@v2
72       if: failure()
73       with:
74         name: Test logs Ubuntu-${{ matrix.os }}
75         path: |
76           /var/tmp/test_results/*
77           !/var/tmp/test_results/current
78         if-no-files-found: ignore