#!/bin/bash -e
list="Algorithm-Diff-1.1902 \
Archive-Zip-1.45 \
Module-ConfigureRequires-0.03 \
Scalar-List-Utils-1.42 \
Spiffy-0.30 \
Test-Pod-1.49 \
Devel-Symdump-2.14 \
Pod-Coverage-0.23 \
Test-Pod-Coverage-1.08 \
Text-Diff-0.35 \
Try-Tiny-0.09 \
Capture-Tiny-0.30 \
Test-Base-0.60 \
Test-Simple-1.001014 \
Test-Command-0.11 \
Test-NoWarnings-1.04 \
Test-Warnings-0.020 \
Test-Inter-1.05 \
Sub-Uplevel-0.25 \
Test-Warn-0.30 \
Test-Exception-0.38 \
Test-Deep-0.115 \
JSON-PP-2.27300 \
JSON-PP-Compat5006-1.09 \
File-Copy-Recursive-0.38 \
CPAN-Meta-YAML-0.011 \
ExtUtils-MakeMaker-6.66 \
Test-Requires-0.08 \
Test-Fatal-0.014 \
Parse-CPAN-Meta-1.4414 \
CPAN-Meta-Requirements-2.133 \
CPAN-Meta-2.150001 \
CPAN-Meta-Check-0.007 \
Compress-Raw-Zlib-2.068 \
Compress-Raw-Bzip2-2.068 \
HTTP-Date-6.02 \
File-Listing-6.04 \
Encode-Locale-1.04 \
IO-HTML-1.001 \
LWP-MediaTypes-6.02 \
URI-1.65 \
HTTP-Message-6.06 \
HTTP-Cookies-6.01 \
HTTP-Negotiate-6.01 \
HTTP-Daemon-6.01 \
Net-HTTP-6.07 \
WWW-RobotRules-6.01 \
HTML-Tagset-3.10 \
HTML-Parser-3.71 \
Mozilla-CA-20141217 \
Net-SSLeay-1.68 \
IO-Socket-IP-0.37 \
Socket6-0.25 \
IO-Socket-INET6-2.72 \
IO-Socket-SSL-2.015 \
libwww-perl-6.05 \
IO-Compress-Base-2.005 \
LWP-Protocol-https-6.02 \
Crypt-SSLeay-0.64 \
Text-Glob-0.09 \
Number-Compare-0.03 \
File-Find-Rule-0.33 \
Scalar-Properties-1.100860 \
Data-Compare-1.25 \
IPC-Run3-0.048 \
Date-Manip-6.41 \
Probe-Perl-0.03 \
Test-Script-1.10 \
Date-Simple-3.03 \
Devel-Symdump-2.08 \
Digest-BubbleBabble-0.01 \
Digest-SHA1-2.11 \
Digest-HMAC-1.01 \
Digest-SHA-5.45 \
Encode-EUCJPASCII-0.03 \
Encode-HanExtra-0.23 \
Encode-JIS2K-0.02 \
ExtUtils-CBuilder-0.19 \
ExtUtils-Depends-0.304 \
ExtUtils-ParseXS-2.2206 \
ExtUtils-PkgConfig-1.13 \
ExtUtils-Helpers-0.020 \
ExtUtils-Config-0.007 \
ExtUtils-InstallPaths-0.009 \
File-Slurp-9999.19 \
File-Which-1.09 \
Devel-Cover-1.18 \
ExtUtils-MakeMaker-Coverage-0.05 \
Exporter-Tiny-0.042 \
List-MoreUtils-0.28 \
List-AllUtils-0.09 \
HTML-Tree-3.23 \
HTML-TableExtract-2.11 \
Text-CSV-1.33 \
Finance-Quote-1.18 \
Date-Manip-5.56 \
Regexp-Common-0.01 \
Finance-QuoteHist-1.20 \
Glib-1.280 \
Parse-RecDescent-1.80 \
Inline-Files-0.69 \
Inline-0.77 \
Log-Log4perl-1.46 \
YAML-0.84 \
IO-String-1.08 \
Class-Method-Modifiers-2.11 \
CPAN-Changes-0.30 \
Params-Util-1.07 \
Sub-Install-0.928 \
Data-OptList-0.109 \
Sub-Exporter-0.987 \
Sub-Identify-0.10 \
Test-Output-1.03 \
Module-Runtime-0.014 \
Module-Implementation-0.06 \
Params-Validate-1.18 \
Getopt-Long-Descriptive-0.099 \
Role-Tiny-2.000001 \
Sub-Exporter-Progressive-0.001011 \
Devel-GlobalDestruction-0.13 \
Moo-2.000001 \
strictures-1.001000 \
Data-Perl-0.002009 \
MooX-Types-MooseLike-0.28 \
MooX-HandlesVia-0.001008 \
Dist-CheckConflicts-0.11 \
Package-Stash-XS-0.28 \
Package-Stash-0.37 \
ExtUtils-CBuilder-0.280220
Variable-Magic-0.57 \
B-Hooks-EndOfScope-0.15 \
namespace-clean-0.25 \
ExtUtils-BuildRC-0.005 \
Test-Harness-3.35 \
Module-Build-Tiny-0.039 \
namespace-autoclean-0.24 \
PathTools-3.47 \
Path-Tiny-0.068 \
Type-Tiny-1.000005 \
Pod-Readme-v1.1.2 \
IO-Tty-1.08 \
IPC-Run-0.94 \
Module-Signature-0.79 \
Module-Build-0.4200 \
Module-CoreList-2.12 \
Module-Info-0.32 \
IPC-Run3-0.048 \
Net-DNS-0.81 \
Net-IP-1.24 \
PAR-Dist-0.31 \
Parse-RecDescent-1.94 \
Pod-Escapes-1.04 \
Pod-Simple-3.05 \
Readonly-1.02 \
Readonly-XS-1.05 \
Regexp-Common-2013031301 \
Tie-IxHash-1.22 \
Tk-804.032 \
Unicode-Collate-1.10 \
MIME-Charset-1.006.2
Unicode-LineBreak-2014.06 \
XML-NamespaceSupport-1.11 \
XML-Writer-0.625 \
autovivification-0.14 "

# We're not stopping on errors, log and keep going
rm -f log.run			# purge log
for mod in $list
do
 echo "==============================================" >>log.run
 echo $mod >>log.run
 echo "==============================================" >>log.run
 tar -xf $mod.tar.gz
 cd $mod			# counting on file name matching directory
 if [ -f Build.PL ]; then
  # chain these four steps together
  (perl Build.PL 2>&1 | tee -a ../log.run && exit $PIPESTATUS) &&
  (./Build 2>&1 | tee -a ../log.run && exit $PIPESTATUS) &&
  (./Build test 2>&1 | tee -a ../log.run && exit $PIPESTATUS) &&
  (./Build install 2>&1 | tee -a ../log.run && exit $PIPESTATUS)
  # break the chain and continue
 elif [ -f Makefile.PL ]; then
  # Similar process
  (perl Makefile.PL 2>&1 | tee -a ../log.run && exit $PIPESTATUS) &&
  (make -j $MMPF 2>&1 | tee -a ../log.run && exit $PIPESTATUS) &&
  (make test 2>&1 | tee -a ../log.run && exit $PIPESTATUS) &&
  (make install 2>&1 | tee -a ../log.run && exit $PIPESTATUS)
 else
  echo Neither Build.PL not Makefile.PL found.  What to do?
  exit 1
 fi
 cd ..
 rm -rf $mod
done
# Let's do a little reporting.
ok=`grep ".. ok" log.run |wc -l`
skip=`grep ".. skipped" log.run |wc -l`
tt=0
for r in `grep "wallclock" log.run|awk '{print $2}'`
do
 n=${r#Tests=}
 n=${n%,*}
 let tt=tt+n
done
echo "Test files OK       (2692)" $ok
echo "Test files skipped   (332)" $skip
echo "Total tests run   (417197)" $tt
