Commit 4bfd35c1 authored by unknown's avatar unknown

New version of ma_test_all


storage/maria/ma_test_all.sh:
  Added possibility to call ma_test_all-t directly with the old script.
  If any options were passed (such as --verbose) the script will
  be called directly.
storage/maria/unittest/ma_test_all-t:
  Added new options --number-of-tests and --run-tests=...
  
  More verbose output
parent b8416bce
...@@ -3,5 +3,17 @@ ...@@ -3,5 +3,17 @@
# This file is now deprecated and has been replaced by # This file is now deprecated and has been replaced by
# unittest/ma_test_all-t # unittest/ma_test_all-t
# #
#
#
#
if test -n "$1"; then
# unit.pl can't pass options to ma_test_all-t, so if anything
# was passed as an argument, assume the purpose was to pass
# them to ma_test_all-t and call it directly
perl ../../unittest/unit.pl run unittest/ma_test_all-t unittest/ma_test_all-t $@
else
perl ../../unittest/unit.pl run unittest/ma_test_all-t
fi
...@@ -6,21 +6,26 @@ ...@@ -6,21 +6,26 @@
use Getopt::Long; use Getopt::Long;
$|= 1; $|= 1;
$VER= "1.1"; $VER= "1.2";
$opt_version= 0; $opt_version= 0;
$opt_help= 0; $opt_help= 0;
$opt_verbose= 0; $opt_verbose= 0;
$opt_maria_path= undef(); $opt_maria_path= undef();
$opt_valgrind= "valgrind --alignment=8 --leak-check=yes"; $opt_valgrind= "valgrind --alignment=8 --leak-check=yes";
$opt_suffix= ""; $opt_suffix= "";
$opt_silent= "-s"; $opt_silent= "-s";
my $maria_path= $ENV{'maria_path'}; $opt_number_of_tests= 0;
$opt_run_tests= undef();
my $maria_path= $ENV{'maria_path'};
my $my_progname= $0; my $my_progname= $0;
$my_progname=~ s/.*[\/]//; $my_progname=~ s/.*[\/]//;
my $runtime_error= 0; # Return 1 if error(s) occur during run my $runtime_error= 0; # Return 1 if error(s) occur during run
my $NEW_TEST= 0; # Test group separator in an array of tests my $NEW_TEST= 0; # Test group separator in an array of tests
my $test_begin= 0;
my $test_end= 0;
my $test_counter= 0;
run_tests(); run_tests();
...@@ -34,7 +39,8 @@ sub run_tests ...@@ -34,7 +39,8 @@ sub run_tests
my $flag_exit= 0; my $flag_exit= 0;
if (!GetOptions("help", "version", "verbose", "maria-path=s", if (!GetOptions("help", "version", "verbose", "maria-path=s",
"valgrind=s", "suffix=s", "silent=s")) "valgrind=s", "suffix=s", "silent=s", "number-of-tests",
"run-tests=s"))
{ {
$flag_exit= 1; $flag_exit= 1;
} }
...@@ -54,12 +60,6 @@ sub run_tests ...@@ -54,12 +60,6 @@ sub run_tests
usage() if ($opt_help || $flag_exit); usage() if ($opt_help || $flag_exit);
#
# clean-up
#
unlink <*.TMD maria_log*>; # Delete temporary files
# #
# IMPORTANT: If you modify this file, please read this: # IMPORTANT: If you modify this file, please read this:
# #
...@@ -73,13 +73,59 @@ sub run_tests ...@@ -73,13 +73,59 @@ sub run_tests
# make the unit test fail during 'make test'. $nr_tests must be right. # make the unit test fail during 'make test'. $nr_tests must be right.
# #
$nr_tests+= run_check_tests(0, 0, 0, 0, 1) * 4; # $nr_tests+= run_check_tests(0, 0, 0, 0, 1) * 4; #
$nr_tests+= run_repair_tests(0, 0, 0, 0, 1) * 4; # called 4 times $nr_tests+= run_repair_tests(0, 0, 0, 0, 1) * 4; # called 4 times
$nr_tests+= run_pack_tests(0, 0, 0, 0, 1) * 4; # $nr_tests+= run_pack_tests(0, 0, 0, 0, 1) * 4; #
$nr_tests+= run_tests_on_warnings_and_errors(0, 0, 0, 1); $nr_tests+= run_tests_on_warnings_and_errors(0, 0, 0, 1);
$nr_tests+= run_ma_test_recovery(0, 1); $nr_tests+= run_ma_test_recovery(0, 1);
$nr_tests+= run_tests_on_clrs(0, 1); $nr_tests+= run_tests_on_clrs(0, 1);
if ($opt_number_of_tests)
{
print "Total number of tests is $nr_tests\n";
exit(0);
}
if (defined($opt_run_tests))
{
if ($opt_run_tests =~ m/^(\d+)$/)
{
$test_begin= $1;
}
elsif ($opt_run_tests =~ m/^(\d+)\.+(\d+)$/)
{
$test_begin= $1;
$test_end= $2;
}
else
{
print "Wrong syntax for option --run-tests=$opt_run_tests\n";
print "Please use --run-tests=<begin>..<end>\nwhere 'begin' is the ";
print "first test to be run and 'end' is the last.\n";
exit(1);
}
if ($test_end > $nr_tests)
{
print "Test range ($test_begin..$test_end) out of range. ";
print "There are only $nr_tests in the test suite.\n";
exit(1);
}
$test_begin++ if (!$test_begin); # Handle zero, if user gave that
if ($test_end && $test_begin > $test_end)
{
print "Bad test range ($test_begin..$test_end)\n";
exit(1);
}
# Now adjust number of tests
$nr_tests= ($test_end ? $test_end : $nr_tests) - $test_begin + 1;
}
#
# clean-up
#
unlink <*.TMD maria_log*>; # Delete temporary files
# #
# Run tests # Run tests
# #
...@@ -433,6 +479,16 @@ sub ok ...@@ -433,6 +479,16 @@ sub ok
my ($com, $verbose, $iteration, $expected_error)= @_; my ($com, $verbose, $iteration, $expected_error)= @_;
my ($msg, $output, $err, $len); my ($msg, $output, $err, $len);
$test_counter++;
if ($test_begin > $test_counter)
{
return 0;
}
if ($test_end && $test_end < $test_counter)
{
exit(0);
}
$msg= ""; $msg= "";
$expected_error= 0 if (!defined($expected_error)); $expected_error= 0 if (!defined($expected_error));
...@@ -444,7 +500,7 @@ sub ok ...@@ -444,7 +500,7 @@ sub ok
$len= length($com); $len= length($com);
if ($verbose) if ($verbose)
{ {
print " " x (65 - $len); print " " x (62 - $len);
print " "; print " ";
} }
$err= $?; $err= $?;
...@@ -453,7 +509,12 @@ sub ok ...@@ -453,7 +509,12 @@ sub ok
{ {
print "[ " if ($verbose); print "[ " if ($verbose);
print "ok"; print "ok";
print " ]" if ($verbose); if ($verbose)
{
print " ]";
print " " x (5 - length("$test_counter"));
print "$test_counter";
}
print "\n"; print "\n";
return 1; return 1;
} }
...@@ -476,7 +537,7 @@ sub ok ...@@ -476,7 +537,7 @@ sub ok
} }
$msg.= "at line "; $msg.= "at line ";
$msg.= (caller)[2]; $msg.= (caller)[2];
$msg.= " (errcode: $err)\n"; $msg.= "\n(errcode: $err, test: $test_counter)\n";
if ($expected_error) if ($expected_error)
{ {
$msg.= "Was expecting errcode: $expected_error\n"; $msg.= "Was expecting errcode: $expected_error\n";
...@@ -557,6 +618,11 @@ Options ...@@ -557,6 +618,11 @@ Options
--suffix=... Suffix for test files (ma_test1, ma_test2 etc.), --suffix=... Suffix for test files (ma_test1, ma_test2 etc.),
if they have one ('$opt_suffix') if they have one ('$opt_suffix')
--silent=... Silent option passed to ma_test* tests ('$opt_silent') --silent=... Silent option passed to ma_test* tests ('$opt_silent')
--number-of-tests Print the total number of tests and exit.
--run-tests=... Test number(s) that should be run. You can give just
one number or a range. For example 45..89
Use this with caution, because some of the tests
might depend on previous ones.
EOF EOF
exit(0); exit(0);
} }
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