aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/zfs-tests-sanity.yml
blob: ef2c0a8695a7c9eae975d57ca6e60e908163a43a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: zfs-tests-sanity

on:
  push:
  pull_request:

jobs:
  tests:
    runs-on: ubuntu-22.04
    steps:
    - uses: actions/checkout@v3
      with:
        ref: ${{ github.event.pull_request.head.sha }}
    - name: Install dependencies
      run: |
        # https://github.com/orgs/community/discussions/47863
        sudo apt-mark hold grub-efi-amd64-signed
        sudo apt-get update --fix-missing
        sudo apt-get upgrade
        sudo xargs --arg-file=${{ github.workspace }}/.github/workflows/build-dependencies.txt apt-get install -qq
        sudo apt-get clean
    - name: Autogen.sh
      run: |
        ./autogen.sh
    - name: Configure
      run: |
        ./configure --enable-debug --enable-debuginfo --enable-asan --enable-ubsan
    - name: Make
      run: |
        make --no-print-directory --silent native-deb-utils native-deb-kmod
        mv ../*.deb .
        rm ./openzfs-zfs-dkms*.deb ./openzfs-zfs-dracut*.deb
    - name: Install
      run: |
        # Update order of directories to search for modules, otherwise
        #   Ubuntu will load kernel-shipped ones.
        sudo sed -i.bak 's/updates/extra updates/' /etc/depmod.d/ubuntu.conf
        sudo dpkg -i *.deb
        # Native Debian packages enable and start the services
        # Stop zfs-zed daemon, as it may interfere with some ZTS test cases
        sudo systemctl stop zfs-zed
        # Workaround for cloud-init bug
        # see https://github.com/openzfs/zfs/issues/12644
        FILE=/lib/udev/rules.d/10-cloud-init-hook-hotplug.rules
        if [ -r "${FILE}" ]; then
          HASH=$(md5sum "${FILE}" | awk '{ print $1 }')
          if [ "${HASH}" = "121ff0ef1936cd2ef65aec0458a35772" ]; then
            # Just shove a zd* exclusion right above the hotplug hook...
            sudo sed -i -e s/'LABEL="cloudinit_hook"'/'KERNEL=="zd*", GOTO="cloudinit_end"\n&'/ "${FILE}"
            sudo udevadm control --reload-rules
          fi
        fi
    - name: Clear the kernel ring buffer
      run: |
        sudo dmesg -c >/var/tmp/dmesg-prerun
    - name: Reclaim and report disk space
      run: |
        ${{ github.workspace }}/.github/workflows/scripts/reclaim_disk_space.sh
        df -h /
    - name: Tests
      run: |
        set -o pipefail
        /usr/share/zfs/zfs-tests.sh -vKR -s 3G -r sanity | scripts/zfs-tests-color.sh
      shell: bash
      timeout-minutes: 330
    - name: Prepare artifacts
      if: failure()
      run: |
        RESULTS_PATH=$(readlink -f /var/tmp/test_results/current)
        sudo dmesg > $RESULTS_PATH/dmesg
        sudo cp /var/log/syslog /var/tmp/dmesg-prerun $RESULTS_PATH/
        sudo chmod +r $RESULTS_PATH/*
        # Replace ':' in dir names, actions/upload-artifact doesn't support it
        for f in $(find /var/tmp/test_results -name '*:*'); do mv "$f" "${f//:/__}"; done
    - uses: actions/upload-artifact@v3
      if: failure()
      with:
        name: Test logs Ubuntu-${{ matrix.os }}
        path: |
          /var/tmp/test_results/*
          !/var/tmp/test_results/current
        if-no-files-found: ignore