Dockerfile: fix whitespace inconsistencies
[gnu-stow.git] / docker / run-stow-tests.sh
blob121542cd3c74b01cb20597afd2113a985a2a8399
1 #!/bin/bash
3 # This file is part of GNU Stow.
5 # GNU Stow is free software: you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # GNU Stow is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see https://www.gnu.org/licenses/.
18 # Load perlbrew environment
19 # Load before setting safety to keep
20 # perlbrew scripts from breaking due to
21 # unset variables.
22 . /usr/local/perlbrew/etc/bashrc
24 # Standard safety protocol
25 set -ef -o pipefail
26 IFS=$'\n\t'
28 test_perl_version () {
29 perl_version="$1"
30 perlbrew use $perl_version
32 echo $(perl --version)
34 # Install stow
35 autoreconf --install
36 eval `perl -V:siteprefix`
37 ./configure --prefix=$siteprefix && make
38 make cpanm
40 # Run tests
41 make distcheck
42 perl Build.PL && ./Build build && cover -test
43 ./Build distcheck
46 if [[ -n "$LIST_PERL_VERSIONS" ]]; then
47 echo "Listing Perl versions available from perlbrew ..."
48 perlbrew list
49 elif [[ -z "$PERL_VERSION" ]]; then
50 echo "Testing all versions ..."
51 for perl_version in $(perlbrew list | sed 's/ //g'); do
52 test_perl_version $perl_version
53 done
54 make distclean
55 else
56 echo "Testing with Perl $PERL_VERSION"
57 # Test a specific version requested via $PERL_VERSION environment
58 # variable. Make sure set -e doesn't cause us to bail on failure
59 # before we start an interactive shell.
60 test_perl_version $PERL_VERSION || :
61 # N.B. Don't distclean since we probably want to debug this Perl
62 # version interactively.
63 cat <<EOF
64 To run a specific test, type something like:
66 perl -Ilib -Ibin -It t/cli_options.t
68 Code can be edited on the host and will immediately take effect inside
69 this container.
71 EOF
72 bash