From 5d667c3e71281068d7742f41cdfe13b53fd092d7 Mon Sep 17 00:00:00 2001 From: Adam Spiers Date: Fri, 28 Jun 2019 20:10:45 +0100 Subject: [PATCH] Make testing within Docker containers easier --- docker/run-stow-tests.sh | 38 +++++++++++++++++++++++++++++++++----- test-docker.sh | 31 ++++++++++++++++++++++++++++++- 2 files changed, 63 insertions(+), 6 deletions(-) diff --git a/docker/run-stow-tests.sh b/docker/run-stow-tests.sh index 416594c..121542c 100755 --- a/docker/run-stow-tests.sh +++ b/docker/run-stow-tests.sh @@ -22,11 +22,12 @@ . /usr/local/perlbrew/etc/bashrc # Standard safety protocol -set -euf -o pipefail +set -ef -o pipefail IFS=$'\n\t' -for p_version in $(perlbrew list | sed 's/ //g'); do - perlbrew use $p_version +test_perl_version () { + perl_version="$1" + perlbrew use $perl_version echo $(perl --version) @@ -40,6 +41,33 @@ for p_version in $(perlbrew list | sed 's/ //g'); do make distcheck perl Build.PL && ./Build build && cover -test ./Build distcheck -done +} -make distclean +if [[ -n "$LIST_PERL_VERSIONS" ]]; then + echo "Listing Perl versions available from perlbrew ..." + perlbrew list +elif [[ -z "$PERL_VERSION" ]]; then + echo "Testing all versions ..." + for perl_version in $(perlbrew list | sed 's/ //g'); do + test_perl_version $perl_version + done + make distclean +else + echo "Testing with Perl $PERL_VERSION" + # Test a specific version requested via $PERL_VERSION environment + # variable. Make sure set -e doesn't cause us to bail on failure + # before we start an interactive shell. + test_perl_version $PERL_VERSION || : + # N.B. Don't distclean since we probably want to debug this Perl + # version interactively. + cat <