aboutsummaryrefslogtreecommitdiff
path: root/lang/perl/files/perl-run_tests.sh
diff options
context:
space:
mode:
authorMarcel Denia <naoir@gmx.net>2015-07-01 15:58:49 +0200
committerMarcel Denia <naoir@gmx.net>2015-09-01 09:23:24 +0200
commitdf26e427f97d4f81fe69f1595417ed1728dc66f9 (patch)
tree9c9e8d377523597a88c8b50a6b98e15ba883801c /lang/perl/files/perl-run_tests.sh
parent88800d31ee8e8e95e583a659605c426a842bea7d (diff)
perl: Improve run_tests.sh
- Add some useful options for debugging tests and test failures - Properly handle tests located in lib/ Signed-off-by: Marcel Denia <naoir@gmx.net>
Diffstat (limited to 'lang/perl/files/perl-run_tests.sh')
-rwxr-xr-xlang/perl/files/perl-run_tests.sh63
1 files changed, 60 insertions, 3 deletions
diff --git a/lang/perl/files/perl-run_tests.sh b/lang/perl/files/perl-run_tests.sh
index 288191b43..bf83c0a3d 100755
--- a/lang/perl/files/perl-run_tests.sh
+++ b/lang/perl/files/perl-run_tests.sh
@@ -4,8 +4,52 @@ PERL_TESTSDIR="/usr/share/perl/perl-tests"
PERL_LIBDIR="/usr/lib/perl5/%%PERL_VERSION%%/"
PERL_DISABLEDTESTS="%%PERL_DISABLEDTESTS%%"
+no_run=""
+manual_run=""
+manual_run_no_base=""
+
+while [ ! -z "$1" ]; do
+ case $1 in
+ -n)
+ no_run="yes"
+ ;;
+ -m)
+ manual_run="yes"
+ ;;
+ -mb)
+ manual_run="yes"
+ manual_run_no_base="yes"
+ ;;
+ --help)
+ echo "run_tests.sh [-n|-m|-mb|--help]"
+ echo ""
+ echo "Options:"
+ echo " -n Just prepare the environment. Don't actually run any tests"
+ echo " -m Run tests manually according to MANIFEST, instead of whatever t/TEST chooses"
+ echo " -mb Don't run base tests. Implies -m"
+ echo " --help Print this help ;)"
+ echo ""
+ exit 0
+ ;;
+ *)
+ echo "Invalid argument: $1"
+ ;;
+ esac
+ shift
+done
+
if [ ! -f "$PERL_TESTSDIR/__prepared" ]; then
- ln -s "$PERL_LIBDIR" "$PERL_TESTSDIR/lib"
+ # Many tests insist on having PERL5LIB in $PERL_TESTSDIR/lib. However,
+ # that directory may also contain tests. Some of them(FindBin.t in particular)
+ # also demand being located in a directory ending with "lib". So we can't do symlink
+ # trickery here.
+ # Our solution is to just copy PERL5LIB over.
+ if [ -d "$PERL_TESTSDIR/lib" ]; then
+ cp -a "$PERL_LIBDIR/"* "$PERL_TESTSDIR/lib/"
+ else
+ ln -s "$PERL_LIBDIR" "$PERL_TESTSDIR/lib"
+ fi
+
ln -s /usr/bin/perl "$PERL_TESTSDIR/perl"
ln -s /usr/bin/perl "$PERL_TESTSDIR/t/perl"
touch "$PERL_TESTSDIR/__prepared"
@@ -20,5 +64,18 @@ if [ ! -f "$PERL_TESTSDIR/__prepared" ]; then
mv $PERL_TESTSDIR/MANIFEST_NEW $PERL_TESTSDIR/MANIFEST
fi
-cd "$PERL_TESTSDIR/t"
-./perl TEST
+if [ -z "$no_run" ]; then
+ cd "$PERL_TESTSDIR/t"
+ if [ ! -z "$manual_run" ]; then
+ for i in $(cat ../MANIFEST | sed 's/\t.*$//g' | grep '\.t$'); do
+ if [ ! -z "$manual_run_no_base" ] && [ ! -z "$(echo $i | grep '^t/')" ]; then
+ continue;
+ fi
+ echo "Running $i"
+ ./TEST ../$i
+ echo ""
+ done
+ else
+ ./perl TEST
+ fi
+fi