Commit 30c14893 authored by Mauritz Sundell's avatar Mauritz Sundell

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.
parent 51d04c4c
#!/usr/bin/perl
# -*- cperl -*-
# Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -201,6 +201,7 @@ our @opt_cases; # The test cases names in argv
our $opt_embedded_server;
# -1 indicates use default, override with env.var.
our $opt_ctest= env_or_val(MTR_UNIT_TESTS => -1);
our $opt_ctest_report;
# Unit test report stored here for delayed printing
my $ctest_report;
......@@ -1168,6 +1169,7 @@ sub command_line_setup {
'report-times' => \$opt_report_times,
'result-file' => \$opt_resfile,
'unit-tests!' => \$opt_ctest,
'unit-tests-report!' => \$opt_ctest_report,
'stress=s' => \$opt_stress,
'help|h' => \$opt_usage,
......@@ -1606,12 +1608,21 @@ sub command_line_setup {
}
# --------------------------------------------------------------------------
# Don't run ctest if tests or suites named
# Set default values for opt_ctest (--unit-tests)
# --------------------------------------------------------------------------
$opt_ctest= 0 if $opt_ctest == -1 && ($opt_suites || @opt_cases);
if ($opt_ctest == -1) {
if (defined $opt_ctest_report && $opt_ctest_report) {
# Turn on --unit-tests by default if --unit-tests-report is used
$opt_ctest= 1;
} elsif ($opt_suites || @opt_cases) {
# Don't run ctest if tests or suites named
$opt_ctest= 0;
} elsif (defined $ENV{PB2WORKDIR}) {
# Override: disable if running in the PB test environment
$opt_ctest= 0 if $opt_ctest == -1 && defined $ENV{PB2WORKDIR};
$opt_ctest= 0;
}
}
# --------------------------------------------------------------------------
# Check use of wait-all
......@@ -6079,6 +6090,8 @@ sub run_ctest() {
open (CTEST, " > $ctfile") or die ("Could not open output file $ctfile");
$ctest_report .= $ctest_out if $opt_ctest_report;
# Put ctest output in log file, while analyzing results
for (split ('\n', $ctest_out)) {
print CTEST "$_\n";
......@@ -6335,6 +6348,7 @@ Misc options
nounit-tests Do not run unit tests. Normally run if configured
and if not running named tests/suites
unit-tests Run unit tests even if they would otherwise not be run
unit-tests-report Include report of every test included in unit tests.
stress=ARGS Run stress test, providing options to
mysql-stress-test.pl. Options are separated by comma.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment