Skip to content

Commit b06ebbb

Browse files
committed
Bug #11751927 42960: MTR2: NO MORE --STRESS PARAMETERS
Quick fix: run mysql-stress-test.pl via a wrapper test Amend mtr to run just that test when using --stress Updated mysql-stress-test.pl to exit(1) if wrong options
1 parent 50f05fa commit b06ebbb

File tree

3 files changed

+56
-5
lines changed

3 files changed

+56
-5
lines changed

mysql-test/mysql-stress-test.pl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,9 @@ sub set_exit_code {
238238
"test-duration=i", "test-suffix=s", "check-tests-file",
239239
"verbose", "log-error-details", "cleanup", "mysqltest=s",
240240
# OBN: (changing 'abort-on-error' to numberic for WL-4626/4685)
241-
"abort-on-error=i" => \$opt_abort_on_error, "help") || usage();
241+
"abort-on-error=i" => \$opt_abort_on_error, "help") || usage(1);
242242

243-
usage() if ($opt_help);
243+
usage(0) if ($opt_help);
244244

245245
#$opt_abort_on_error=1;
246246

@@ -1131,6 +1131,7 @@ sub sig_TERM_handler
11311131

11321132
sub usage
11331133
{
1134+
my $retcode= shift;
11341135
print <<EOF;
11351136
11361137
The MySQL Stress suite Ver $stress_suite_version
@@ -1234,7 +1235,7 @@ sub usage
12341235
--cleanup \
12351236
12361237
EOF
1237-
exit(0);
1238+
exit($retcode);
12381239
}
12391240

12401241

mysql-test/mysql-test-run.pl

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ END
181181
our @opt_extra_mysqld_opt;
182182
our @opt_mysqld_envs;
183183

184+
my $opt_stress;
185+
184186
my $opt_compress;
185187
my $opt_ssl;
186188
my $opt_skip_ssl;
@@ -423,8 +425,8 @@ sub main {
423425
}
424426
$ENV{MTR_PARALLEL} = $opt_parallel;
425427

426-
if ($opt_parallel > 1 && $opt_start_exit) {
427-
mtr_warning("Parallel and --start-and-exit cannot be combined\n" .
428+
if ($opt_parallel > 1 && ($opt_start_exit || $opt_stress)) {
429+
mtr_warning("Parallel cannot be used with --start-and-exit or --stress\n" .
428430
"Setting parallel to 1");
429431
$opt_parallel= 1;
430432
}
@@ -1174,6 +1176,7 @@ sub command_line_setup {
11741176
'report-times' => \$opt_report_times,
11751177
'result-file' => \$opt_resfile,
11761178
'unit-tests!' => \$opt_ctest,
1179+
'stress=s' => \$opt_stress,
11771180

11781181
'help|h' => \$opt_usage,
11791182
# list-options is internal, not listed in help
@@ -1627,6 +1630,22 @@ sub command_line_setup {
16271630
mtr_error("--wait-all can only be used with --start options");
16281631
}
16291632

1633+
# --------------------------------------------------------------------------
1634+
# Gather stress-test options and modify behavior
1635+
# --------------------------------------------------------------------------
1636+
1637+
if ($opt_stress)
1638+
{
1639+
$opt_stress=~ s/,/ /g;
1640+
$opt_user_args= 1;
1641+
mtr_error("--stress cannot be combined with named ordinary suites or tests")
1642+
if $opt_suites || @opt_cases;
1643+
$opt_suites="stress";
1644+
@opt_cases= ("wrapper");
1645+
$ENV{MST_OPTIONS}= $opt_stress;
1646+
$opt_ctest= 0;
1647+
}
1648+
16301649
# --------------------------------------------------------------------------
16311650
# Check timeout arguments
16321651
# --------------------------------------------------------------------------
@@ -6128,6 +6147,8 @@ ($)
61286147
nounit-tests Do not run unit tests. Normally run if configured
61296148
and if not running named tests/suites
61306149
unit-tests Run unit tests even if they would otherwise not be run
6150+
stress=ARGS Run stress test, providing options to
6151+
mysql-stress-test.pl. Options are separated by comma.
61316152
61326153
Some options that control enabling a feature for normal test runs,
61336154
can be turned off by prepending 'no' to the option, e.g. --notimer.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#
2+
# This is a wrapper "pseudo" test for mtr --stress execution.
3+
# It should not be run directly (will be skipped)
4+
# Do not create a result file!
5+
#
6+
7+
if (!$MST_OPTIONS) {
8+
skip Only to be run with mtr --stress;
9+
}
10+
11+
# echo Running MST with options $MST_OPTIONS;
12+
13+
perl;
14+
my ($mtest)= split " ", $ENV{MYSQL_TEST};
15+
open(FILE, ">", "$ENV{MYSQL_TMP_DIR}/mtest.inc") or die;
16+
print FILE "let \$MYSQLTEST_BIN= $mtest;\n";
17+
close FILE;
18+
EOF
19+
20+
--source $MYSQL_TMP_DIR/mtest.inc
21+
--remove_file $MYSQL_TMP_DIR/mtest.inc
22+
23+
exec perl mysql-stress-test.pl --mysqltest=$MYSQLTEST_BIN
24+
--server-port=$MASTER_MYPORT --server-socket=$MASTER_MYSOCK
25+
--server-user=root --cleanup
26+
--server-logs-dir=$MYSQLTEST_VARDIR/log
27+
--stress-basedir=$MYSQLTEST_VARDIR
28+
$MST_OPTIONS
29+
;

0 commit comments

Comments
 (0)