Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
86d065f5
Commit
86d065f5
authored
Feb 04, 2008
by
msvensson@pilot.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make mtr_report.pl into it's own package
Remove mtr_log_*
parent
c10fb20d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
84 deletions
+50
-84
mysql-test/lib/mtr_cases.pm
mysql-test/lib/mtr_cases.pm
+2
-2
mysql-test/lib/mtr_report.pm
mysql-test/lib/mtr_report.pm
+41
-57
mysql-test/lib/mtr_settings.pl
mysql-test/lib/mtr_settings.pl
+0
-16
mysql-test/mysql-test-run.pl
mysql-test/mysql-test-run.pl
+7
-9
No files found.
mysql-test/lib/mtr_cases.pm
View file @
86d065f5
...
@@ -24,6 +24,8 @@ use strict;
...
@@ -24,6 +24,8 @@ use strict;
use
base
qw(Exporter)
;
use
base
qw(Exporter)
;
our
@EXPORT
=
qw(collect_option collect_test_cases)
;
our
@EXPORT
=
qw(collect_option collect_test_cases)
;
use
mtr_report
;
# Options used for the collect phase
# Options used for the collect phase
our
$start_from
;
our
$start_from
;
our
$print_testcases
;
our
$print_testcases
;
...
@@ -52,8 +54,6 @@ use File::Basename;
...
@@ -52,8 +54,6 @@ use File::Basename;
use
IO::
File
();
use
IO::
File
();
use
My::
Config
;
use
My::
Config
;
require
"
mtr_settings.pl
";
require
"
mtr_report.pl
";
require
"
mtr_match.pl
";
require
"
mtr_match.pl
";
require
"
mtr_misc.pl
";
require
"
mtr_misc.pl
";
...
...
mysql-test/lib/mtr_report.p
l
→
mysql-test/lib/mtr_report.p
m
View file @
86d065f5
...
@@ -18,30 +18,38 @@
...
@@ -18,30 +18,38 @@
# and is part of the translation of the Bourne shell script with the
# and is part of the translation of the Bourne shell script with the
# same name.
# same name.
package
mtr_report
;
use
strict
;
use
strict
;
use
warnings
;
use
base
qw(Exporter)
;
sub
mtr_report_test_passed
($$);
our
@EXPORT
=
qw(report_option mtr_print_line mtr_print_thick_line
sub
mtr_report_test_failed
($$);
mtr_print_header mtr_report mtr_report_stats
sub
mtr_report_test_skipped
($);
mtr_warning mtr_error mtr_debug mtr_verbose
sub
mtr_report_stats
($);
mtr_verbose_restart mtr_report_test_passed
mtr_report_test_failed mtr_report_test_skipped
sub
mtr_print_line
();
mtr_report_stats)
;
sub
mtr_print_thick_line
($);
sub
mtr_print_header
();
require
"
mtr_io.pl
";
sub
mtr_report
(@);
sub
mtr_warning
(@);
sub
mtr_error
(@);
sub
mtr_debug
(@);
sub
mtr_verbose
(@);
my
$tot_real_time
=
0
;
my
$tot_real_time
=
0
;
sub
mtr_report_test_name
($)
{
our
$timestamp
=
0
;
sub
report_option
{
my
(
$opt
,
$value
)
=
@_
;
# Convert - to _ in option name
$opt
=~
s/-/_/
;
no
strict
'
refs
';
$
{
$opt
}
=
$value
;
}
sub
SHOW_SUITE_NAME
()
{
return
1
;
};
sub
_mtr_report_test_name
($)
{
my
$tinfo
=
shift
;
my
$tinfo
=
shift
;
my
$tname
=
$tinfo
->
{
name
};
my
$tname
=
$tinfo
->
{
name
};
# Remove suite part of name
# Remove suite part of name
$tname
=~
s/.*\.//
unless
SHOW_SUITE_NAME
;
$tname
=~
s/.*\.//
unless
SHOW_SUITE_NAME
;
...
@@ -49,14 +57,14 @@ sub mtr_report_test_name ($) {
...
@@ -49,14 +57,14 @@ sub mtr_report_test_name ($) {
$tname
.=
"
'
$tinfo
->{combination}'
"
$tname
.=
"
'
$tinfo
->{combination}'
"
if
defined
$tinfo
->
{
combination
};
if
defined
$tinfo
->
{
combination
};
_mtr_log
("
$tname
"
);
print
_timestamp
(
);
printf
"
%-30s
",
$tname
;
printf
"
%-30s
",
$tname
;
}
}
sub
mtr_report_test_skipped
($)
{
sub
mtr_report_test_skipped
($)
{
my
$tinfo
=
shift
;
my
$tinfo
=
shift
;
mtr_report_test_name
(
$tinfo
);
_
mtr_report_test_name
(
$tinfo
);
$tinfo
->
{'
result
'}
=
'
MTR_RES_SKIPPED
';
$tinfo
->
{'
result
'}
=
'
MTR_RES_SKIPPED
';
if
(
$tinfo
->
{'
disable
'}
)
if
(
$tinfo
->
{'
disable
'}
)
...
@@ -83,7 +91,7 @@ sub mtr_report_test_skipped ($) {
...
@@ -83,7 +91,7 @@ sub mtr_report_test_skipped ($) {
sub
mtr_report_test_passed
($$)
{
sub
mtr_report_test_passed
($$)
{
my
(
$tinfo
,
$use_timer
)
=
@_
;
my
(
$tinfo
,
$use_timer
)
=
@_
;
mtr_report_test_name
(
$tinfo
);
_
mtr_report_test_name
(
$tinfo
);
my
$timer
=
"";
my
$timer
=
"";
if
(
$use_timer
and
-
f
"
$::opt_vardir/log/timer
"
)
if
(
$use_timer
and
-
f
"
$::opt_vardir/log/timer
"
)
...
@@ -102,7 +110,7 @@ sub mtr_report_test_passed ($$) {
...
@@ -102,7 +110,7 @@ sub mtr_report_test_passed ($$) {
sub
mtr_report_test_failed
($$)
{
sub
mtr_report_test_failed
($$)
{
my
(
$tinfo
,
$logfile
)
=
@_
;
my
(
$tinfo
,
$logfile
)
=
@_
;
mtr_report_test_name
(
$tinfo
);
_
mtr_report_test_name
(
$tinfo
);
$tinfo
->
{'
result
'}
=
'
MTR_RES_FAILED
';
$tinfo
->
{'
result
'}
=
'
MTR_RES_FAILED
';
my
$test_failures
=
$tinfo
->
{'
failures
'}
||
0
;
my
$test_failures
=
$tinfo
->
{'
failures
'}
||
0
;
...
@@ -440,7 +448,7 @@ sub mtr_print_line () {
...
@@ -440,7 +448,7 @@ sub mtr_print_line () {
}
}
sub
mtr_print_thick_line
($)
{
sub
mtr_print_thick_line
{
my
$char
=
shift
||
'
=
';
my
$char
=
shift
||
'
=
';
print
$char
x
60
,
"
\n
";
print
$char
x
60
,
"
\n
";
}
}
...
@@ -467,52 +475,33 @@ sub mtr_print_header () {
...
@@ -467,52 +475,33 @@ sub mtr_print_header () {
#
#
##############################################################################
##############################################################################
use
IO::
File
;
use
Time::
localtime
;
use
Time::
localtime
;
sub
_timestamp
{
sub
_timestamp
{
return
""
unless
$timestamp
;
my
$tm
=
localtime
();
my
$tm
=
localtime
();
return
sprintf
("
%02d%02d%02d %2d:%02d:%02d
",
return
sprintf
("
%02d%02d%02d %2d:%02d:%02d
",
$tm
->
year
%
100
,
$tm
->
mon
+
1
,
$tm
->
mday
,
$tm
->
year
%
100
,
$tm
->
mon
+
1
,
$tm
->
mday
,
$tm
->
hour
,
$tm
->
min
,
$tm
->
sec
);
$tm
->
hour
,
$tm
->
min
,
$tm
->
sec
);
}
}
my
$log_file_ref
=
undef
;
sub
mtr_log_init
($)
{
my
(
$filename
)
=
@_
;
mtr_error
("
Log is already open
")
if
defined
$log_file_ref
;
$log_file_ref
=
IO::
File
->
new
(
$filename
,
"
a
")
or
mtr_warning
("
Could not create logfile
$filename
: $!
");
}
sub
_mtr_log
(@)
{
print
$log_file_ref
join
("
",
_timestamp
(),
@_
),"
\n
"
if
defined
$log_file_ref
;
}
# Print message to screen
sub
mtr_report
(@)
{
sub
mtr_report
(@)
{
# Print message to screen and log
print
join
("
",
@_
),
"
\n
";
_mtr_log
(
@_
);
print
join
("
",
@_
),"
\n
";
}
}
# Print warning to screen
sub
mtr_warning
(@)
{
sub
mtr_warning
(@)
{
# Print message to screen and log
print
STDERR
_timestamp
(),
"
mysql-test-run: WARNING:
",
join
("
",
@_
),
"
\n
";
_mtr_log
("
WARNING:
",
@_
);
print
STDERR
"
mysql-test-run: WARNING:
",
join
("
",
@_
),"
\n
";
}
}
# Print error to screen and then exit
sub
mtr_error
(@)
{
sub
mtr_error
(@)
{
# Print message to screen and log
print
STDERR
_timestamp
(),
"
mysql-test-run: *** ERROR:
",
join
("
",
@_
),
"
\n
";
_mtr_log
("
ERROR:
",
@_
);
print
STDERR
"
mysql-test-run: *** ERROR:
",
join
("
",
@_
),"
\n
";
exit
(
1
);
exit
(
1
);
}
}
...
@@ -520,18 +509,15 @@ sub mtr_error (@) {
...
@@ -520,18 +509,15 @@ sub mtr_error (@) {
sub
mtr_debug
(@)
{
sub
mtr_debug
(@)
{
if
(
$::opt_verbose
>
1
)
if
(
$::opt_verbose
>
1
)
{
{
_mtr_log
("
###:
",
@_
);
print
STDERR
_timestamp
(),
"
####:
",
join
("
",
@_
),
"
\n
";
print
STDERR
"
####:
",
join
("
",
@_
),"
\n
";
}
}
}
}
sub
mtr_verbose
(@)
{
sub
mtr_verbose
(@)
{
# Always print to log, print to screen only when --verbose is used
_mtr_log
("
>
",
@_
);
if
(
$::opt_verbose
)
if
(
$::opt_verbose
)
{
{
print
STDERR
"
>
",
join
("
",
@_
),"
\n
";
print
STDERR
_timestamp
(),
"
>
",
join
("
",
@_
),"
\n
";
}
}
}
}
...
@@ -539,11 +525,9 @@ sub mtr_verbose (@) {
...
@@ -539,11 +525,9 @@ sub mtr_verbose (@) {
sub
mtr_verbose_restart
(@)
{
sub
mtr_verbose_restart
(@)
{
my
(
$server
,
@args
)
=
@_
;
my
(
$server
,
@args
)
=
@_
;
my
$proc
=
$server
->
{
proc
};
my
$proc
=
$server
->
{
proc
};
# Always print to log, print to screen only when --verbose is used
_mtr_log
("
> Restart:
$proc
-
",
@args
);
if
(
$::opt_verbose_restart
)
if
(
$::opt_verbose_restart
)
{
{
print
STDERR
"
> Restart
$proc
-
",
join
("
",
@args
),"
\n
";
print
STDERR
_timestamp
(),
"
> Restart
$proc
-
",
join
("
",
@args
),"
\n
";
}
}
}
}
...
...
mysql-test/lib/mtr_settings.pl
deleted
100644 → 0
View file @
c10fb20d
#
# Defines used to control how mysql-test-run.pl
# should work in the current version of MySQL
#
# Control if the suite name should be output before testname
sub
SHOW_SUITE_NAME
{
return
1
;
};
# Control which suites are run by default
sub
DEFAULT_SUITES
{
return
"
main,binlog,federated,rpl,rpl_ndb,ndb
";
};
1
;
mysql-test/mysql-test-run.pl
View file @
86d065f5
...
@@ -33,9 +33,6 @@ BEGIN {
...
@@ -33,9 +33,6 @@ BEGIN {
"
Could not find the lib/ directory
\n
";
"
Could not find the lib/ directory
\n
";
exit
(
1
);
exit
(
1
);
}
}
# Include settings that control how the script behaves
require
"
lib/mtr_settings.pl
";
}
}
...
@@ -50,6 +47,7 @@ use My::SafeProcess;
...
@@ -50,6 +47,7 @@ use My::SafeProcess;
use
My::
ConfigFactory
;
use
My::
ConfigFactory
;
use
My::
Options
;
use
My::
Options
;
use
mtr_cases
;
use
mtr_cases
;
use
mtr_report
;
our
$is_win32_perl
=
(
$^O
eq
"
MSWin32
");
# ActiveState Win32 Perl
our
$is_win32_perl
=
(
$^O
eq
"
MSWin32
");
# ActiveState Win32 Perl
our
$is_cygwin
=
(
$^O
eq
"
cygwin
");
# Cygwin Perl
our
$is_cygwin
=
(
$^O
eq
"
cygwin
");
# Cygwin Perl
...
@@ -58,7 +56,6 @@ our $is_win32= ($is_win32_perl or $is_cygwin);
...
@@ -58,7 +56,6 @@ our $is_win32= ($is_win32_perl or $is_cygwin);
require
"
lib/mtr_process.pl
";
require
"
lib/mtr_process.pl
";
require
"
lib/mtr_io.pl
";
require
"
lib/mtr_io.pl
";
require
"
lib/mtr_gcov.pl
";
require
"
lib/mtr_gcov.pl
";
require
"
lib/mtr_report.pl
";
require
"
lib/mtr_match.pl
";
require
"
lib/mtr_match.pl
";
require
"
lib/mtr_misc.pl
";
require
"
lib/mtr_misc.pl
";
require
"
lib/mtr_unique.pl
";
require
"
lib/mtr_unique.pl
";
...
@@ -87,7 +84,8 @@ my $path_config_file; # The generated config file, var/my.cnf
...
@@ -87,7 +84,8 @@ my $path_config_file; # The generated config file, var/my.cnf
# executables will be used by the test suite.
# executables will be used by the test suite.
our
$opt_vs_config
=
$ENV
{'
MTR_VS_CONFIG
'};
our
$opt_vs_config
=
$ENV
{'
MTR_VS_CONFIG
'};
our
$opt_suites
=
DEFAULT_SUITES
;
my
$DEFAULT_SUITES
=
"
main,binlog,federated,rpl,rpl_ndb,ndb
";
our
$opt_suites
=
$DEFAULT_SUITES
;
our
$opt_verbose
=
0
;
# Verbose output, enable with --verbose
our
$opt_verbose
=
0
;
# Verbose output, enable with --verbose
our
$opt_verbose_restart
=
0
;
# Verbose output for restarts
our
$opt_verbose_restart
=
0
;
# Verbose output for restarts
...
@@ -100,7 +98,7 @@ our $exe_ndbd;
...
@@ -100,7 +98,7 @@ our $exe_ndbd;
our
$exe_ndb_mgmd
=
"";
our
$exe_ndb_mgmd
=
"";
our
$exe_libtool
;
our
$exe_libtool
;
our
$opt_big_test
=
0
;
my
$opt_big_test
=
0
;
our
@opt_combinations
;
our
@opt_combinations
;
...
@@ -384,6 +382,7 @@ sub command_line_setup {
...
@@ -384,6 +382,7 @@ sub command_line_setup {
'
suite-timeout=i
'
=>
\
$opt_suite_timeout
,
'
suite-timeout=i
'
=>
\
$opt_suite_timeout
,
'
shutdown-timeout=i
'
=>
\
$opt_shutdown_timeout
,
'
shutdown-timeout=i
'
=>
\
$opt_shutdown_timeout
,
'
warnings!
'
=>
\
$opt_warnings
,
'
warnings!
'
=>
\
$opt_warnings
,
'
timestamp
'
=>
\&
report_option
,
'
help|h
'
=>
\
$opt_usage
,
'
help|h
'
=>
\
$opt_usage
,
)
or
usage
("
Can't read options
");
)
or
usage
("
Can't read options
");
...
@@ -1946,8 +1945,6 @@ sub initialize_servers {
...
@@ -1946,8 +1945,6 @@ sub initialize_servers {
}
}
}
}
check_running_as_root
();
check_running_as_root
();
mtr_log_init
("
$opt_vardir
/log/mysql-test-run.log
");
}
}
...
@@ -2090,7 +2087,7 @@ sub run_testcase_check_skip_test($)
...
@@ -2090,7 +2087,7 @@ sub run_testcase_check_skip_test($)
{
{
$tinfo
->
{
comment
}
=
$tinfo
->
{
comment
}
=
"
Failed to find cluster binaries
";
"
Failed to find cluster binaries
";
mtr_report_test_failed
(
$tinfo
);
mtr_report_test_failed
(
$tinfo
,
undef
);
return
1
;
return
1
;
}
}
}
}
...
@@ -2357,6 +2354,7 @@ sub run_testcase ($) {
...
@@ -2357,6 +2354,7 @@ sub run_testcase ($) {
{
{
# Stop all servers that are known to be running
# Stop all servers that are known to be running
stop_all_servers
();
stop_all_servers
();
after_test_failure
(
$tinfo
->
{'
name
'});
mtr_report
("
Resuming tests...
\n
");
mtr_report
("
Resuming tests...
\n
");
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment