-
Notifications
You must be signed in to change notification settings - Fork 17
/
build_blackbox_tests
executable file
·41 lines (32 loc) · 1.76 KB
/
build_blackbox_tests
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
#!/usr/bin/env bash
set -eu
# Use the stubs, not the system user{mod,add} binaries. Since we don't know how exactly the bb
# tests will be run and where the stubs will be located, rely on the bb test caller setting up
# their PATH to include them. We don't need to include `id` because it gets copied into the
# system
GLDFLAGS="-X github.com/coreos/ignition/internal/distro.useraddCmd=useradd-stub "
GLDFLAGS+="-X github.com/coreos/ignition/internal/distro.usermodCmd=usermod-stub "
GLDFLAGS+="-X github.com/coreos/ignition/internal/distro.blackboxTesting=true "
if [ "${HELPERS:-CL}" == "HOST" ]; then
GLDFLAGS+="-X github.com/coreos/ignition/internal/distro.mdadmCmd=$(sudo which mdadm) "
GLDFLAGS+="-X github.com/coreos/ignition/internal/distro.mountCmd=$(sudo which mount) "
GLDFLAGS+="-X github.com/coreos/ignition/internal/distro.sgdiskCmd=$(sudo which sgdisk) "
GLDFLAGS+="-X github.com/coreos/ignition/internal/distro.udevadmCmd=$(sudo which udevadm) "
GLDFLAGS+="-X github.com/coreos/ignition/internal/distro.chrootCmd=$(sudo which chroot) "
GLDFLAGS+="-X github.com/coreos/ignition/internal/distro.btrfsMkfsCmd=$(sudo which mkfs.btrfs) "
GLDFLAGS+="-X github.com/coreos/ignition/internal/distro.ext4MkfsCmd=$(sudo which mkfs.ext4) "
GLDFLAGS+="-X github.com/coreos/ignition/internal/distro.swapMkfsCmd=$(sudo which mkswap) "
GLDFLAGS+="-X github.com/coreos/ignition/internal/distro.vfatMkfsCmd=$(sudo which mkfs.vfat) "
GLDFLAGS+="-X github.com/coreos/ignition/internal/distro.xfsMkfsCmd=$(sudo which mkfs.xfs) "
fi
. build
PKG=$(cd gopath/src/${REPO_PATH}; go list ./tests/)
echo "Compiling tests..."
go test -c $PKG
for D in tests/stubs/*; do
if [ -d "${D}" ]; then
echo "Building ${D}"
go build -o ${BIN_PATH}/$(basename ${D}) ${REPO_PATH}/${D}
fi
done
echo "Success"