THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Browse Source

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>
pull/636/head
Joe Groocock 3 months ago
parent
commit
169ebfa72c
No known key found for this signature in database GPG Key ID: E0B16BEACFBB6A86
  1. 11
      misc/make-deps.sh
  2. 16
      test.sh

11
misc/make-deps.sh

@ -44,6 +44,7 @@ if [ -n "$YUM" -a -n "$APT" ]; then
echo "You have both $APT and $YUM installed. Please check your deps manually."
fi
fold_start "Install dependencies"
if [ -n "$YUM" ]; then
$sudo_command $YUM install -y libvirt-devel
$sudo_command $YUM install -y augeas-devel
@ -78,6 +79,7 @@ fi
if [ -n "$PACMAN" ]; then
$sudo_command $PACMAN -S --noconfirm --asdeps --needed libvirt augeas rubygems libpcap
fi
fold_end "Install dependencies"
if ! in_ci; then
if [ -n "$YUM" ]; then
@ -118,11 +120,15 @@ if [ "$goversion" -lt "$mingoversion" ]; then
exit 1
fi
fold_start "Install Go dependencies"
echo "running 'go get -v -d ./...' from `pwd`"
go get -v -t -d ./... # get all the go dependencies
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
fold_start "Install Go tools"
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/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" && \
gometalinter --install # bonus
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 fpm &>/dev/null || gem install fpm --no-document || true # for cross distro packaging
fold_end "Install miscellaneous tools"
cd "$XPWD" >/dev/null

16
test.sh

@ -12,9 +12,9 @@
testsuite="$1"
# print environment when running all testsuites
fold_start env.1 "environment"
test -z "$testsuite" && (echo "ENV:"; env; echo; )
fold_end env.1
fold_start environment
test -z "$testsuite" && (echo "ENV:"; env | sort; echo;)
fold_end environment
# make it easy to split test into blocks
label-block() {
@ -26,18 +26,18 @@ label-block() {
}
# run a test and record failures
function run-testsuite()
{
function run-testsuite() {
testname="$(basename "$1" .sh)"
# if not running all tests or if this test is not explicitly selected, skip it
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
}
# only run test if it is explicitly selected, otherwise report it is skipped
function skip-testsuite()
{
function skip-testsuite() {
testname=$(basename "$1" .sh)
# show skip message only when running full suite
if test -z "$testsuite";then

Loading…
Cancel
Save