test: make-deps: Add folds around tests and dep blocks
Improves readability of CI test output and hides away the complexity when in most cases it is not required. Retain fold behaviour for both Travis and GitHub Actions in case both are used in any capacity. Signed-off-by: Joe Groocock <me@frebib.net>
This commit is contained in:
@@ -44,6 +44,7 @@ if [ -n "$YUM" -a -n "$APT" ]; then
|
|||||||
echo "You have both $APT and $YUM installed. Please check your deps manually."
|
echo "You have both $APT and $YUM installed. Please check your deps manually."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
fold_start "Install dependencies"
|
||||||
if [ -n "$YUM" ]; then
|
if [ -n "$YUM" ]; then
|
||||||
$sudo_command $YUM install -y libvirt-devel
|
$sudo_command $YUM install -y libvirt-devel
|
||||||
$sudo_command $YUM install -y augeas-devel
|
$sudo_command $YUM install -y augeas-devel
|
||||||
@@ -78,6 +79,7 @@ fi
|
|||||||
if [ -n "$PACMAN" ]; then
|
if [ -n "$PACMAN" ]; then
|
||||||
$sudo_command $PACMAN -S --noconfirm --asdeps --needed libvirt augeas rubygems libpcap
|
$sudo_command $PACMAN -S --noconfirm --asdeps --needed libvirt augeas rubygems libpcap
|
||||||
fi
|
fi
|
||||||
|
fold_end "Install dependencies"
|
||||||
|
|
||||||
if ! in_ci; then
|
if ! in_ci; then
|
||||||
if [ -n "$YUM" ]; then
|
if [ -n "$YUM" ]; then
|
||||||
@@ -118,11 +120,15 @@ if [ "$goversion" -lt "$mingoversion" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
fold_start "Install Go dependencies"
|
||||||
echo "running 'go get -v -d ./...' from `pwd`"
|
echo "running 'go get -v -d ./...' from `pwd`"
|
||||||
go get -v -t -d ./... # get all the go dependencies
|
go get -v -t -d ./... # get all the go dependencies
|
||||||
echo "done running 'go get -v -t -d ./...'"
|
echo "done running 'go get -v -t -d ./...'"
|
||||||
|
fold_end "Install Go dependencies"
|
||||||
|
|
||||||
[ -e "$GOBIN/mgmt" ] && rm -f "$GOBIN/mgmt" # the `go get` version has no -X
|
[ -e "$GOBIN/mgmt" ] && rm -f "$GOBIN/mgmt" # the `go get` version has no -X
|
||||||
|
|
||||||
|
fold_start "Install Go tools"
|
||||||
go get github.com/blynn/nex # for lexing
|
go get github.com/blynn/nex # for lexing
|
||||||
go get golang.org/x/tools/cmd/goyacc # formerly `go tool yacc`
|
go get golang.org/x/tools/cmd/goyacc # formerly `go tool yacc`
|
||||||
go get golang.org/x/tools/cmd/stringer # for automatic stringer-ing
|
go get golang.org/x/tools/cmd/stringer # for automatic stringer-ing
|
||||||
@@ -135,6 +141,11 @@ if in_ci; then
|
|||||||
mv "$(dirname $(command -v gometalinter.v1))/gometalinter.v1" "$(dirname $(command -v gometalinter.v1))/gometalinter" && \
|
mv "$(dirname $(command -v gometalinter.v1))/gometalinter.v1" "$(dirname $(command -v gometalinter.v1))/gometalinter" && \
|
||||||
gometalinter --install # bonus
|
gometalinter --install # bonus
|
||||||
fi
|
fi
|
||||||
|
fold_end "Install Go tools"
|
||||||
|
|
||||||
|
fold_start "Install miscellaneous tools"
|
||||||
command -v mdl &>/dev/null || gem install mdl --no-document || true # for linting markdown files
|
command -v mdl &>/dev/null || gem install mdl --no-document || true # for linting markdown files
|
||||||
command -v fpm &>/dev/null || gem install fpm --no-document || true # for cross distro packaging
|
command -v fpm &>/dev/null || gem install fpm --no-document || true # for cross distro packaging
|
||||||
|
fold_end "Install miscellaneous tools"
|
||||||
|
|
||||||
cd "$XPWD" >/dev/null
|
cd "$XPWD" >/dev/null
|
||||||
|
|||||||
16
test.sh
16
test.sh
@@ -12,9 +12,9 @@
|
|||||||
testsuite="$1"
|
testsuite="$1"
|
||||||
|
|
||||||
# print environment when running all testsuites
|
# print environment when running all testsuites
|
||||||
fold_start env.1 "environment"
|
fold_start environment
|
||||||
test -z "$testsuite" && (echo "ENV:"; env; echo; )
|
test -z "$testsuite" && (echo "ENV:"; env | sort; echo;)
|
||||||
fold_end env.1
|
fold_end environment
|
||||||
|
|
||||||
# make it easy to split test into blocks
|
# make it easy to split test into blocks
|
||||||
label-block() {
|
label-block() {
|
||||||
@@ -26,18 +26,18 @@ label-block() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# run a test and record failures
|
# run a test and record failures
|
||||||
function run-testsuite()
|
function run-testsuite() {
|
||||||
{
|
|
||||||
testname="$(basename "$1" .sh)"
|
testname="$(basename "$1" .sh)"
|
||||||
# if not running all tests or if this test is not explicitly selected, skip it
|
# if not running all tests or if this test is not explicitly selected, skip it
|
||||||
if test -z "$testsuite" || test "test-$testsuite" = "$testname";then
|
if test -z "$testsuite" || test "test-$testsuite" = "$testname";then
|
||||||
$@ || failures=$( [ -n "$failures" ] && echo "$failures\\n$@" || echo "$@" )
|
fold_start "$testname"
|
||||||
|
"$@" || failures=$([ -n "$failures" ] && echo "$failures\\n$@" || echo "$@")
|
||||||
|
fold_end "$testname"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# only run test if it is explicitly selected, otherwise report it is skipped
|
# only run test if it is explicitly selected, otherwise report it is skipped
|
||||||
function skip-testsuite()
|
function skip-testsuite() {
|
||||||
{
|
|
||||||
testname=$(basename "$1" .sh)
|
testname=$(basename "$1" .sh)
|
||||||
# show skip message only when running full suite
|
# show skip message only when running full suite
|
||||||
if test -z "$testsuite";then
|
if test -z "$testsuite";then
|
||||||
|
|||||||
Reference in New Issue
Block a user