summaryrefslogtreecommitdiff
path: root/sql-bench
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2010-02-09 19:17:04 +0200
committerMichael Widenius <monty@askmonty.org>2010-02-09 19:17:04 +0200
commitd474428c9aef708a4d2af049efcca4886911126f (patch)
treeb6b92a750c09df613ced927c6f77253083302890 /sql-bench
parent7bd147960606a8c44cbdb9f7b08bba4887a37f18 (diff)
downloadmariadb-git-d474428c9aef708a4d2af049efcca4886911126f.tar.gz
Added --connect-command="sql-string" to sql-bench test suite.
This allows one to send an extra command to the mysql server to setup the environment before starting tests.
Diffstat (limited to 'sql-bench')
-rw-r--r--sql-bench/bench-init.pl.sh8
-rw-r--r--sql-bench/server-cfg.sh5
2 files changed, 11 insertions, 2 deletions
diff --git a/sql-bench/bench-init.pl.sh b/sql-bench/bench-init.pl.sh
index 919ddcedf16..2d9927947d2 100644
--- a/sql-bench/bench-init.pl.sh
+++ b/sql-bench/bench-init.pl.sh
@@ -40,7 +40,7 @@ require "$pwd/server-cfg" || die "Can't read Configuration file: $!\n";
$|=1; # Output data immediately
$opt_skip_test=$opt_skip_create=$opt_skip_delete=$opt_verbose=$opt_fast_insert=$opt_lock_tables=$opt_debug=$opt_skip_delete=$opt_fast=$opt_force=$opt_log=$opt_use_old_results=$opt_help=$opt_odbc=$opt_small_test=$opt_small_tables=$opt_samll_key_tables=$opt_stage=$opt_old_headers=$opt_die_on_errors=$opt_tcpip=$opt_random=$opt_only_missing_tests=0;
-$opt_cmp=$opt_user=$opt_password=$opt_connect_options="";
+$opt_cmp=$opt_user=$opt_password=$opt_connect_options=$opt_connect_command= "";
$opt_server="mysql"; $opt_dir="output";
$opt_host="localhost";$opt_database="test";
$opt_machine=""; $opt_suffix="";
@@ -59,7 +59,7 @@ $log_prog_args=join(" ", skip_arguments(\@ARGV,"comments","cmp","server",
"use-old-results","skip-test",
"optimization","hw",
"machine", "dir", "suffix", "log"));
-GetOptions("skip-test=s","comments=s","cmp=s","server=s","user=s","host=s","database=s","password=s","loop-count=i","row-count=i","skip-create","skip-delete","verbose","fast-insert","lock-tables","debug","fast","force","field-count=i","regions=i","groups=i","time-limit=i","log","use-old-results","machine=s","dir=s","suffix=s","help","odbc","small-test","small-tables","small-key-tables","stage=i","threads=i","random","old-headers","die-on-errors","create-options=s","hires","tcpip","silent","optimization=s","hw=s","socket=s","connect-options=s","only-missing-tests") || usage();
+GetOptions("skip-test=s","comments=s","cmp=s","server=s","user=s","host=s","database=s","password=s","loop-count=i","row-count=i","skip-create","skip-delete","verbose","fast-insert","lock-tables","debug","fast","force","field-count=i","regions=i","groups=i","time-limit=i","log","use-old-results","machine=s","dir=s","suffix=s","help","odbc","small-test","small-tables","small-key-tables","stage=i","threads=i","random","old-headers","die-on-errors","create-options=s","hires","tcpip","silent","optimization=s","hw=s","socket=s","connect-options=s","connect-command=s","only-missing-tests") || usage();
usage() if ($opt_help);
$server=get_server($opt_server,$opt_host,$opt_database,$opt_odbc,
@@ -595,6 +595,10 @@ All benchmarks takes the following options:
Add options, which uses at DBI connect.
For example --connect-options=mysql_read_default_file=/etc/my.cnf.
+--connect-command='SQL command'
+ Initialization command to execute when logged in. Useful for setting
+ up the environment.
+
EOF
exit(0);
}
diff --git a/sql-bench/server-cfg.sh b/sql-bench/server-cfg.sh
index 5ed7fdf482c..3ff1ce99659 100644
--- a/sql-bench/server-cfg.sh
+++ b/sql-bench/server-cfg.sh
@@ -249,6 +249,11 @@ sub connect
die "Got error: '$DBI::errstr' when connecting to " . $self->{'data_source'} ." with user: '$main::opt_user' password: '$main::opt_password'\n";
$dbh->do("SET OPTION LOG_OFF=1,UPDATE_LOG=0");
+ if ($main::opt_connect_command ne "")
+ {
+ $dbh->do($main::opt_connect_command) or
+ die "Can't execute connect_command: $main::opt_connect_command error: $DBI::errstr\n";
+ }
return $dbh;
}