This repository has been archived by the owner on Sep 2, 2021. It is now read-only.
forked from coreos/ignition
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build_blackbox_tests
executable file
·42 lines (33 loc) · 1.71 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
42
#!/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 "
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..."
for p in ${PKG}; do
go test -c $p
done
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"