File: build_and_test.sh

package info (click to toggle)
golang-github-containers-storage 1.59.1%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 4,184 kB
  • sloc: sh: 630; ansic: 389; makefile: 143; awk: 12
file content (82 lines) | stat: -rwxr-xr-x 3,260 bytes parent folder | download | duplicates (4)
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
#!/usr/bin/env bash

set -e

source $(dirname $0)/lib.sh

cd $GOSRC
make install.tools
showrun make local-binary
showrun make local-cross

case $TEST_DRIVER in
    overlay)
        showrun make STORAGE_DRIVER=overlay local-test-integration local-test-unit
        ;;
    overlay-transient)
        showrun make STORAGE_DRIVER=overlay STORAGE_TRANSIENT=1 local-test-integration local-test-unit
        ;;
    fuse-overlay)
        showrun make STORAGE_DRIVER=overlay STORAGE_OPTION=overlay.mount_program=/usr/bin/fuse-overlayfs local-test-integration local-test-unit
        ;;
    fuse-overlay-whiteout)
        showrun make STORAGE_DRIVER=overlay FUSE_OVERLAYFS_DISABLE_OVL_WHITEOUT=1 STORAGE_OPTION=overlay.mount_program=/usr/bin/fuse-overlayfs local-test-integration local-test-unit
        ;;
    vfs)
        showrun make STORAGE_DRIVER=vfs local-test-integration local-test-unit
        ;;
    aufs)
        showrun make STORAGE_DRIVER=aufs local-test-integration local-test-unit
        ;;
    btrfs)
        # Fedora: Needs btrfs-progs, btrfs-progs-devel
        # Debian: Needs btrfs-progs, libbtrfs-dev
        if [[ "$(./hack/btrfs_tag.sh)" =~ exclude_graphdriver_btrfs ]]; then
            die "Built without btrfs, so we can't test it"
        fi
        if ! check_filesystem_supported $TEST_DRIVER ; then
            die "This CI VM does not support $TEST_DRIVER in its kernel"
        fi
        if test -z "$(which mkfs.btrfs 2> /dev/null)" ; then
            die "This CI VM does not have mkfs.btrfs installed"
        fi
        tmpdir=$(mktemp -d)
        if [ -z "$tmpdir" ]; then
            die "Error creating temporary directory"
        fi
        trap "umount -l $tmpdir; rm -f $GOSRC/$TEST_DRIVER.img" EXIT
        truncate -s 0 $GOSRC/$TEST_DRIVER.img
        fallocate -l 1G $GOSRC/$TEST_DRIVER.img
        mkfs.btrfs $GOSRC/$TEST_DRIVER.img
        mount -o loop $GOSRC/$TEST_DRIVER.img $tmpdir
        TMPDIR="$tmpdir" showrun make STORAGE_DRIVER=$TEST_DRIVER local-test-integration local-test-unit
        ;;
    zfs)
        # Debian: Needs zfsutils
        if ! check_filesystem_supported $TEST_DRIVER ; then
            die "This CI VM does not support $TEST_DRIVER in its kernel"
        fi
        if test -z "$(which zpool 2> /dev/null)" ; then
            die "This CI VM does not have zpool installed"
        fi
        if test -z "$(which zfs 2> /dev/null)" ; then
            die "This CI VM does not have zfs installed"
        fi
        tmpfile=$(mktemp -p $GOSRC)
        truncate -s 0 $tmpfile
        fallocate -l 1G $tmpfile
        zpool=$(basename $tmpfile)
        zpool create $zpool $tmpfile
        trap "zfs destroy -Rf $zpool/tmp; zpool destroy -f $zpool; rm -f $tmpfile" EXIT
        zfs create $zpool/tmp
        TMPDIR="/$zpool/tmp" showrun make STORAGE_DRIVER=$TEST_DRIVER local-test-integration local-test-unit
        # Ensure no datasets are held open prior to `zfs destroy` trap.
        datasets=$(lsns -J -t mnt --output-all | jq '.namespaces[]|select(.command=="sleep 1000s").pid')
        if [[ -n "$datasets" ]]; then
            kill $datasets
        fi
        ;;
    *)
        die "Unknown/Unsupported \$TEST_DRIVER=$TEST_DRIVER (see .cirrus.yml and $(basename $0))"
        ;;
esac