|
1 | 1 | #!/usr/bin/perl |
2 | 2 | # -*- cperl -*- |
3 | 3 |
|
4 | | -# Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved. |
| 4 | +# Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved. |
5 | 5 | # |
6 | 6 | # This program is free software; you can redistribute it and/or modify |
7 | 7 | # it under the terms of the GNU General Public License as published by |
|
201 | 201 | our $opt_embedded_server; |
202 | 202 | # -1 indicates use default, override with env.var. |
203 | 203 | our $opt_ctest= env_or_val(MTR_UNIT_TESTS => -1); |
| 204 | +our $opt_ctest_report; |
204 | 205 | # Unit test report stored here for delayed printing |
205 | 206 | my $ctest_report; |
206 | 207 |
|
@@ -1168,6 +1169,7 @@ sub command_line_setup { |
1168 | 1169 | 'report-times' => \$opt_report_times, |
1169 | 1170 | 'result-file' => \$opt_resfile, |
1170 | 1171 | 'unit-tests!' => \$opt_ctest, |
| 1172 | + 'unit-tests-report!'=> \$opt_ctest_report, |
1171 | 1173 | 'stress=s' => \$opt_stress, |
1172 | 1174 |
|
1173 | 1175 | 'help|h' => \$opt_usage, |
@@ -1606,12 +1608,21 @@ sub command_line_setup { |
1606 | 1608 | } |
1607 | 1609 |
|
1608 | 1610 | # -------------------------------------------------------------------------- |
1609 | | - # Don't run ctest if tests or suites named |
| 1611 | + # Set default values for opt_ctest (--unit-tests) |
1610 | 1612 | # -------------------------------------------------------------------------- |
1611 | 1613 |
|
1612 | | - $opt_ctest= 0 if $opt_ctest == -1 && ($opt_suites || @opt_cases); |
1613 | | - # Override: disable if running in the PB test environment |
1614 | | - $opt_ctest= 0 if $opt_ctest == -1 && defined $ENV{PB2WORKDIR}; |
| 1614 | + if ($opt_ctest == -1) { |
| 1615 | + if (defined $opt_ctest_report && $opt_ctest_report) { |
| 1616 | + # Turn on --unit-tests by default if --unit-tests-report is used |
| 1617 | + $opt_ctest= 1; |
| 1618 | + } elsif ($opt_suites || @opt_cases) { |
| 1619 | + # Don't run ctest if tests or suites named |
| 1620 | + $opt_ctest= 0; |
| 1621 | + } elsif (defined $ENV{PB2WORKDIR}) { |
| 1622 | + # Override: disable if running in the PB test environment |
| 1623 | + $opt_ctest= 0; |
| 1624 | + } |
| 1625 | + } |
1615 | 1626 |
|
1616 | 1627 | # -------------------------------------------------------------------------- |
1617 | 1628 | # Check use of wait-all |
|
6079 | 6090 |
|
6080 | 6091 | open (CTEST, " > $ctfile") or die ("Could not open output file $ctfile"); |
6081 | 6092 |
|
| 6093 | + $ctest_report .= $ctest_out if $opt_ctest_report; |
| 6094 | + |
6082 | 6095 | # Put ctest output in log file, while analyzing results |
6083 | 6096 | for (split ('\n', $ctest_out)) { |
6084 | 6097 | print CTEST "$_\n"; |
@@ -6335,6 +6348,7 @@ ($) |
6335 | 6348 | nounit-tests Do not run unit tests. Normally run if configured |
6336 | 6349 | and if not running named tests/suites |
6337 | 6350 | unit-tests Run unit tests even if they would otherwise not be run |
| 6351 | + unit-tests-report Include report of every test included in unit tests. |
6338 | 6352 | stress=ARGS Run stress test, providing options to |
6339 | 6353 | mysql-stress-test.pl. Options are separated by comma. |
6340 | 6354 |
|
|
0 commit comments