mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 04:53:01 +01:00
5933619ceb
aria_chk now returns 1 if one got any warnings during check and 2 if one got errors. lp:728919 maria_chk should fail on all detected corruptions mysql-test/lib/My/SafeProcess.pm: Removed ^M lines from the file storage/maria/ma_check.c: Fixed indentation storage/maria/maria_chk.c: aria_chk now returns 1 if one got any warnings during check and 2 if one got errors. storage/maria/unittest/ma_control_file-t.c: Use unique sub directory for test results storage/maria/unittest/ma_maria_log_cleanup.c: Added help function create_tmpdir() storage/maria/unittest/ma_pagecache_consist.c: Use unique sub directory for test results storage/maria/unittest/ma_pagecache_rwconsist.c: Use unique sub directory for test results storage/maria/unittest/ma_pagecache_rwconsist2.c: Use unique sub directory for test results storage/maria/unittest/ma_pagecache_single.c: Use unique sub directory for test results storage/maria/unittest/ma_test_all-t: Use unique sub directory for test results storage/maria/unittest/ma_test_loghandler-t.c: Use unique sub directory for test results storage/maria/unittest/ma_test_loghandler_first_lsn-t.c: Use unique sub directory for test results remove delete of files that are already deleted by maria_log_remove() storage/maria/unittest/ma_test_loghandler_max_lsn-t.c: Use unique sub directory for test results storage/maria/unittest/ma_test_loghandler_multigroup-t.c: Use unique sub directory for test results storage/maria/unittest/ma_test_loghandler_multithread-t.c: Use unique sub directory for test results storage/maria/unittest/ma_test_loghandler_noflush-t.c: Use unique sub directory for test results remove delete of files that are already deleted by maria_log_remove() storage/maria/unittest/ma_test_loghandler_nologs-t.c: Use unique sub directory for test results storage/maria/unittest/ma_test_loghandler_pagecache-t.c: Use unique sub directory for test results remove delete of files that are already deleted by maria_log_remove() storage/maria/unittest/ma_test_loghandler_purge-t.c: Use unique sub directory for test results support-files/compiler_warnings.supp: Supress some warnings unittest/unit.pl: Run 4 unittests in parallel
110 lines
2.8 KiB
Perl
110 lines
2.8 KiB
Perl
#!/usr/bin/perl
|
|
# Copyright (C) 2006 MySQL AB
|
|
#
|
|
# 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
|
|
# the Free Software Foundation; version 2 of the License.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write to the Free Software
|
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
use Test::Harness;
|
|
use File::Find;
|
|
use Getopt::Long;
|
|
|
|
use strict;
|
|
|
|
sub run_cmd (@);
|
|
|
|
my %dispatch = (
|
|
"run" => \&run_cmd,
|
|
);
|
|
|
|
=head1 NAME
|
|
|
|
unit - Run unit tests in directory
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
unit [--[no]big] [--[no]verbose] run [tests to run]
|
|
|
|
=cut
|
|
|
|
my $big= $ENV{'MYTAP_CONFIG'} eq 'big';
|
|
|
|
my $result = GetOptions (
|
|
"big!" => \$big,
|
|
"verbose!" => \$Test::Harness::verbose,
|
|
);
|
|
|
|
$ENV{'MYTAP_CONFIG'} = $big ? 'big' : '';
|
|
|
|
my $cmd = shift;
|
|
|
|
if (defined $cmd && exists $dispatch{$cmd}) {
|
|
$dispatch{$cmd}->(@ARGV);
|
|
} else {
|
|
print "Unknown command", (defined $cmd ? " $cmd" : ""), ".\n";
|
|
print "Available commands are: ", join(", ", keys %dispatch), "\n";
|
|
}
|
|
|
|
=head2 run
|
|
|
|
Run all unit tests in the current directory and all subdirectories.
|
|
|
|
=cut
|
|
|
|
|
|
sub _find_test_files (@) {
|
|
my @dirs = @_;
|
|
my @files;
|
|
find sub {
|
|
$File::Find::prune = 1 if /^(SCCS|\.libs)$/;
|
|
push(@files, $File::Find::name) if -x _ && (/-t\z/ || /-t\.exe\z/);
|
|
}, @dirs;
|
|
return @files;
|
|
}
|
|
|
|
sub run_cmd (@) {
|
|
my @files;
|
|
|
|
# If no directories were supplied, we add all directories in the
|
|
# current directory except 'mytap' since it is not part of the
|
|
# test suite.
|
|
if (@_ == 0) {
|
|
# Ignore these directories
|
|
my @ignore = qw(mytap SCCS);
|
|
|
|
# Build an expression from the directories above that tests if a
|
|
# directory should be included in the list or not.
|
|
my $ignore = join(' && ', map { '$_ ne ' . "'$_'"} @ignore);
|
|
|
|
# Open and read the directory. Filter out all files, hidden
|
|
# directories, and directories named above.
|
|
opendir(DIR, ".") or die "Cannot open '.': $!\n";
|
|
@_ = grep { -d $_ && $_ !~ /^\..*/ && eval $ignore } readdir(DIR);
|
|
closedir(DIR);
|
|
}
|
|
|
|
print "Running tests: @_\n";
|
|
|
|
foreach my $name (@_) {
|
|
push(@files, _find_test_files $name) if -d $name;
|
|
push(@files, $name) if -f $name;
|
|
}
|
|
|
|
if (@files > 0) {
|
|
# Removing the first './' from the file names
|
|
foreach (@files) { s!^\./!! }
|
|
$ENV{'HARNESS_PERL_SWITCHES'} .= ' -e "exec @ARGV"';
|
|
$ENV{'HARNESS_OPTIONS'}="j4";
|
|
$Test::Harness::Timer = 1;
|
|
runtests @files;
|
|
}
|
|
}
|