Skip to content

Commit 30c1489

Browse files
committed
Bug#20814396 PB2 IS SECRET ABOUT WHAT UNIT TESTS IT RUN
One can not see in PB2 test logs which unit tests have been run and passed. This patchs adds an option --unit-tests-report to mtr which include the ctest report in mtr output. It will also turn on unit testing if not explicitly turned off with --no-unit-tests or equivalent. In manual runs one can always look in the ctest.log file in mtr vardir. --unit-tests are replaced with --unit-tests-report in files under mysql-test/collections/ to activate report in PB2.
1 parent 51d04c4 commit 30c1489

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

mysql-test/mysql-test-run.pl

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/perl
22
# -*- cperl -*-
33

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.
55
#
66
# This program is free software; you can redistribute it and/or modify
77
# it under the terms of the GNU General Public License as published by
@@ -201,6 +201,7 @@ END
201201
our $opt_embedded_server;
202202
# -1 indicates use default, override with env.var.
203203
our $opt_ctest= env_or_val(MTR_UNIT_TESTS => -1);
204+
our $opt_ctest_report;
204205
# Unit test report stored here for delayed printing
205206
my $ctest_report;
206207

@@ -1168,6 +1169,7 @@ sub command_line_setup {
11681169
'report-times' => \$opt_report_times,
11691170
'result-file' => \$opt_resfile,
11701171
'unit-tests!' => \$opt_ctest,
1172+
'unit-tests-report!'=> \$opt_ctest_report,
11711173
'stress=s' => \$opt_stress,
11721174

11731175
'help|h' => \$opt_usage,
@@ -1606,12 +1608,21 @@ sub command_line_setup {
16061608
}
16071609

16081610
# --------------------------------------------------------------------------
1609-
# Don't run ctest if tests or suites named
1611+
# Set default values for opt_ctest (--unit-tests)
16101612
# --------------------------------------------------------------------------
16111613

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+
}
16151626

16161627
# --------------------------------------------------------------------------
16171628
# Check use of wait-all
@@ -6079,6 +6090,8 @@ ()
60796090

60806091
open (CTEST, " > $ctfile") or die ("Could not open output file $ctfile");
60816092

6093+
$ctest_report .= $ctest_out if $opt_ctest_report;
6094+
60826095
# Put ctest output in log file, while analyzing results
60836096
for (split ('\n', $ctest_out)) {
60846097
print CTEST "$_\n";
@@ -6335,6 +6348,7 @@ ($)
63356348
nounit-tests Do not run unit tests. Normally run if configured
63366349
and if not running named tests/suites
63376350
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.
63386352
stress=ARGS Run stress test, providing options to
63396353
mysql-stress-test.pl. Options are separated by comma.
63406354

0 commit comments

Comments
 (0)