/[metamod]/trunk/run_automatic_tests.pl
ViewVC logotype

Contents of /trunk/run_automatic_tests.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2612 - (show annotations) (download)
Thu Jan 30 14:55:04 2014 UTC (6 years, 6 months ago) by geira
File MIME type: text/plain
File size: 2197 byte(s)
harmonizing test logging for both front- and backend
resetting test log before run
1 #!/usr/bin/perl
2
3 =head1 NAME
4
5 run_automatic_tests.pl - Run the automatic tests in the t/ directories
6
7 =head1 SYNOPSIS
8
9 run_automatic_tests.pl [options]
10
11 Options:
12 --smolder Send the test result to our Smolder server
13 --verbose Run the tests with verbose output
14 --coverage Turn on coverage reporting with Devel::Cover
15 --perf Turn on performance testing
16 --pod Turn on POD testing (default). Use --no-pod to turn of
17
18 =cut
19
20 use App::Prove;
21 use FindBin;
22 use Getopt::Long;
23 use Pod::Usage;
24
25 my $send_to_smolder = '';
26 my $send_to_jenkins = '';
27 my $verbose = '';
28 my $coverage = '';
29 my $performance = '';
30 my $pod = '';
31
32 GetOptions(
33 'smolder' => \$send_to_smolder,
34 'jenkins' => \$send_to_jenkins,
35 'verbose' => \$verbose,
36 'coverage' => \$coverage,
37 'performance' => \$performance,
38 'pod!' => \$pod,
39 ) or pod2usage(2);
40
41 if( !$pod ){
42 $ENV{NO_TEST_POD} = 1;
43 }
44
45 if( !$performance ){
46 $ENV{NO_PERF_TESTS} = 1;
47 }
48
49 my $output_file = $send_to_jenkins ? 'test_results' : 'auto_test_result.tar.gz';
50 mkdir $output_file if $send_to_jenkins && ! -d $output_file;
51 unlink 'log4perl-test.log';
52
53 # run Devel::Cover to get some information about the test coverage
54 if ($coverage) {
55
56 eval { require Devel::Cover; };
57
58 if ($@) {
59 print "Could not load Devel::Cover. Cannot run tests with coverage statistics\n";
60 print "$@";
61 exit 1;
62 }
63
64 $ENV{HARNESS_PERL_SWITCHES} = '-MDevel::Cover=-select,Metamod.*\.pm,Metno.*\.pm,+ignore,.*';
65 }
66
67 my $prove = App::Prove->new();
68
69 # setting lib using $prove->lib() does not work for some reason
70 $prove->process_args('-Ilocal/lib/perl5');
71
72 if ($verbose) {
73 $prove->verbose(1);
74 }
75
76 $prove->recurse(1);
77 $prove->archive($output_file);
78 $prove->argv( [ "$FindBin::Bin/common/lib/t", "$FindBin::Bin/catalyst/t" ] );
79 my $result = $prove->run();
80
81 if ($send_to_smolder) { # should be configurable... FIXME
82 system "$FindBin::Bin/test/smolder_smoke_signal.pl", '--server', 'dev-vm081', '--port', '8080', '--username',
83 'admin', '--password',
84 'qa_rocks', '--project', 'metamod', '--platform', $^O, '--file', $output_file;
85 }
86
87 exit( $result ? 0 : 1 );

Properties

Name Value
svn:executable *
svn:mime-type text/plain

svn@met.no
ViewVC Help
Powered by ViewVC 1.1.5