summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authormonty@mysql.com <>2005-11-24 04:08:07 +0200
committermonty@mysql.com <>2005-11-24 04:08:07 +0200
commita3436bd7de3bf1376a4cff23503a41d70ca84e73 (patch)
tree439a23033b6cb0f1815201ada8b600383b2c6aef /mysql-test
parent4575a662cb99b63ec4c790ed00ac6ec09deb7cc3 (diff)
parentaa37b75768eaea30a35b0e6e60185bbd95b7bada (diff)
downloadmariadb-git-a3436bd7de3bf1376a4cff23503a41d70ca84e73.tar.gz
Merge mysql.com:/home/my/mysql-5.1
into mysql.com:/home/my/mysql-5.1-TDC
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/lib/mtr_misc.pl4
-rw-r--r--mysql-test/lib/mtr_stress.pl172
-rwxr-xr-xmysql-test/mysql-test-run.pl26
-rw-r--r--mysql-test/r/csv.result24
-rw-r--r--mysql-test/r/federated.result4
-rw-r--r--mysql-test/r/grant.result4
-rw-r--r--mysql-test/r/grant2.result2
-rw-r--r--mysql-test/t/csv.test32
8 files changed, 261 insertions, 7 deletions
diff --git a/mysql-test/lib/mtr_misc.pl b/mysql-test/lib/mtr_misc.pl
index 9a12d842998..a76f1b2d7b1 100644
--- a/mysql-test/lib/mtr_misc.pl
+++ b/mysql-test/lib/mtr_misc.pl
@@ -9,7 +9,7 @@ use strict;
sub mtr_full_hostname ();
sub mtr_short_hostname ();
sub mtr_init_args ($);
-sub mtr_add_arg ($$);
+sub mtr_add_arg ($$@);
sub mtr_path_exists(@);
sub mtr_script_exists(@);
sub mtr_exe_exists(@);
@@ -51,7 +51,7 @@ sub mtr_init_args ($) {
$$args = []; # Empty list
}
-sub mtr_add_arg ($$) {
+sub mtr_add_arg ($$@) {
my $args= shift;
my $format= shift;
my @fargs = @_;
diff --git a/mysql-test/lib/mtr_stress.pl b/mysql-test/lib/mtr_stress.pl
new file mode 100644
index 00000000000..a57d94e8043
--- /dev/null
+++ b/mysql-test/lib/mtr_stress.pl
@@ -0,0 +1,172 @@
+# -*- cperl -*-
+
+# This is a library file used by the Perl version of mysql-test-run,
+# and is part of the translation of the Bourne shell script with the
+# same name.
+
+use strict;
+use File::Spec;
+
+# These are not to be prefixed with "mtr_"
+
+sub run_stress_test ();
+
+##############################################################################
+#
+# Run tests in the stress mode
+#
+##############################################################################
+
+sub run_stress_test ()
+{
+
+ my $args;
+ my $stress_basedir;
+ my $stress_suitedir;
+
+ mtr_report("Starting stress testing\n");
+
+ if ( ! $::glob_use_embedded_server and ! $::opt_local_master )
+ {
+ $::master->[0]->{'pid'}= mysqld_start('master',0,[],[]);
+ if ( ! $::master->[0]->{'pid'} )
+ {
+ mtr_error("Can't start the mysqld server");
+ }
+ }
+
+ my $stress_basedir=File::Spec->catdir($::opt_vardir, "stress");
+
+ #Clean up stress dir
+ if ( -d $stress_basedir )
+ {
+ rmtree($stress_basedir);
+ }
+ mkpath($stress_basedir);
+
+ if ($::opt_stress_suite ne 'main' && $::opt_stress_suite ne 'default' )
+ {
+ $stress_suitedir=File::Spec->catdir($::glob_mysql_test_dir, "suite",
+ $::opt_stress_suite);
+ }
+ else
+ {
+ $stress_suitedir=$::glob_mysql_test_dir;
+ }
+
+ if ( -d $stress_suitedir )
+ {
+ #$stress_suite_t_dir=File::Spec->catdir($stress_suitedir, "t");
+ #$stress_suite_r_dir=File::Spec->catdir($stress_suitedir, "r");
+ #FIXME: check dirs above for existence to ensure that test suite
+ # contains tests and results dirs
+ }
+ else
+ {
+ mtr_error("Specified test suite $::opt_stress_suite doesn't exist");
+ }
+
+ if ( @::opt_cases )
+ {
+ $::opt_stress_test_file=File::Spec->catfile($stress_basedir, "stress_tests.txt");
+ open(STRESS_FILE, ">$::opt_stress_test_file");
+ print STRESS_FILE join("\n",@::opt_cases),"\n";
+ close(STRESS_FILE);
+ }
+ elsif ( $::opt_stress_test_file )
+ {
+ $::opt_stress_test_file=File::Spec->catfile($stress_suitedir,
+ $::opt_stress_test_file);
+ if ( ! -f $::opt_stress_test_file )
+ {
+ mtr_error("Specified file $::opt_stress_test_file with list of tests does not exist\n",
+ "Please ensure that file exists and has proper permissions");
+ }
+ }
+ else
+ {
+ $::opt_stress_test_file=File::Spec->catfile($stress_suitedir,
+ "stress_tests.txt");
+ if ( ! -f $::opt_stress_test_file )
+ {
+ mtr_error("Default file $::opt_stress_test_file with list of tests does not exist\n",
+ "Please use --stress-test-file option to specify custom one or you can\n",
+ "just specify name of test for testing as last argument in command line");
+
+ }
+ }
+
+ if ( $::opt_stress_init_file )
+ {
+ $::opt_stress_init_file=File::Spec->catfile($stress_suitedir,
+ $::opt_stress_init_file);
+ if ( ! -f $::opt_stress_init_file )
+ {
+ mtr_error("Specified file $::opt_stress_init_file with list of tests does not exist\n",
+ "Please ensure that file exists and has proper permissions");
+ }
+ }
+ else
+ {
+ $::opt_stress_init_file=File::Spec->catfile($stress_suitedir,
+ "stress_init.txt");
+ if ( ! -f $::opt_stress_init_file )
+ {
+ $::opt_stress_init_file='';
+ }
+ }
+
+ if ( $::opt_stress_mode ne 'random' && $::opt_stress_mode ne 'seq' )
+ {
+ mtr_error("You specified wrong mode $::opt_stress_mode for stress test\n",
+ "Correct values are 'random' or 'seq'");
+ }
+
+ mtr_init_args(\$args);
+
+ mtr_add_arg($args, "--server-socket=%s", $::master->[0]->{'path_mysock'});
+ mtr_add_arg($args, "--server-user=%s", $::opt_user);
+ mtr_add_arg($args, "--server-database=%s", "test");
+ mtr_add_arg($args, "--stress-suite-basedir=%s", $::glob_mysql_test_dir);
+ mtr_add_arg($args, "--suite=%s", $::opt_stress_suite);
+ mtr_add_arg($args, "--stress-tests-file=%s", $::opt_stress_test_file);
+ mtr_add_arg($args, "--stress-basedir=%s", $stress_basedir);
+ mtr_add_arg($args, "--server-logs-dir=%s", $stress_basedir);
+ mtr_add_arg($args, "--stress-mode=%s", $::opt_stress_mode);
+ mtr_add_arg($args, "--mysqltest=%s", $::exe_mysqltest);
+ mtr_add_arg($args, "--threads=%s", $::opt_stress_threads);
+ mtr_add_arg($args, "--verbose");
+ mtr_add_arg($args, "--cleanup");
+ mtr_add_arg($args, "--log-error-details");
+ mtr_add_arg($args, "--abort-on-error");
+
+ if ( $::opt_stress_init_file )
+ {
+ mtr_add_arg($args, "--stress-init-file=%", $::opt_stress_init_file);
+ }
+
+ if ( $::opt_stress_loop_count )
+ {
+ mtr_add_arg($args, "--loop-count=%s", $::opt_stress_loop_count);
+ }
+
+ if ( $::opt_stress_test_count )
+ {
+ mtr_add_arg($args, "--test-count=%s", $::opt_stress_test_count);
+ }
+
+ if ( $::opt_stress_test_duration )
+ {
+ mtr_add_arg($args, "--test-duration=%s", $::opt_stress_test_duration);
+ }
+
+ #Run stress test
+ mtr_run("$::glob_mysql_test_dir/mysql-stress-test.pl", $args, "", "", "", "");
+
+ if ( ! $::glob_use_embedded_server )
+ {
+ stop_masters();
+ }
+}
+
+1;
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index e2168b7f273..b16d2a190c1 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -96,6 +96,7 @@ require "lib/mtr_report.pl";
require "lib/mtr_diff.pl";
require "lib/mtr_match.pl";
require "lib/mtr_misc.pl";
+require "lib/mtr_stress.pl";
$Devel::Trace::TRACE= 1;
@@ -271,6 +272,16 @@ our $opt_valgrind_mysqltest;
our $opt_valgrind_all;
our $opt_valgrind_options;
+our $opt_stress= "";
+our $opt_stress_suite= "main";
+our $opt_stress_mode= "random";
+our $opt_stress_threads= 5;
+our $opt_stress_test_count= 20;
+our $opt_stress_loop_count= "";
+our $opt_stress_test_duration= "";
+our $opt_stress_init_file= "";
+our $opt_stress_test_file= "";
+
our $opt_verbose;
our $opt_wait_for_master;
@@ -391,6 +402,10 @@ sub main () {
{
run_benchmarks(shift); # Shift what? Extra arguments?!
}
+ elsif ( $opt_stress )
+ {
+ run_stress_test()
+ }
else
{
run_tests();
@@ -547,6 +562,17 @@ sub command_line_setup () {
'valgrind-all:s' => \$opt_valgrind_all,
'valgrind-options=s' => \$opt_valgrind_options,
+ # Stress testing
+ 'stress' => \$opt_stress,
+ 'stress-suite=s' => \$opt_stress_suite,
+ 'stress-threads=i' => \$opt_stress_threads,
+ 'stress-test-file=s' => \$opt_stress_test_file,
+ 'stress-init-file=s' => \$opt_stress_init_file,
+ 'stress-mode=s' => \$opt_stress_mode,
+ 'stress-loop-count=i' => \$opt_stress_loop_count,
+ 'stress-test-count=i' => \$opt_stress_test_count,
+ 'stress-test-duration=i' => \$opt_stress_test_duration,
+
# Misc
'big-test' => \$opt_big_test,
'debug' => \$opt_debug,
diff --git a/mysql-test/r/csv.result b/mysql-test/r/csv.result
index 2e3d11ad461..3c87c1f4b92 100644
--- a/mysql-test/r/csv.result
+++ b/mysql-test/r/csv.result
@@ -4976,3 +4976,27 @@ c1
4
5
DROP TABLE bug14672;
+create table t1 (a int) engine=csv;
+insert t1 values (1);
+delete from t1;
+affected rows: 1
+delete from t1;
+affected rows: 0
+insert t1 values (1),(2);
+delete from t1;
+affected rows: 2
+insert t1 values (1),(2),(3);
+flush tables;
+delete from t1;
+affected rows: 3
+insert t1 values (1),(2),(3),(4);
+flush tables;
+select count(*) from t1;
+count(*)
+4
+delete from t1;
+affected rows: 4
+insert t1 values (1),(2),(3),(4),(5);
+truncate table t1;
+affected rows: 0
+drop table t1;
diff --git a/mysql-test/r/federated.result b/mysql-test/r/federated.result
index 7f53bd884ef..f9b13beb6e5 100644
--- a/mysql-test/r/federated.result
+++ b/mysql-test/r/federated.result
@@ -40,14 +40,14 @@ CREATE TABLE federated.t1 (
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t3';
-ERROR HY000: Can't create federated table. Foreign data src error : ': 1146 : Table 'federated.t3' doesn't exist'
+ERROR HY000: Can't create federated table. Foreign data src error: error: 1146 'Table 'federated.t3' doesn't exist'
CREATE TABLE federated.t1 (
`id` int(20) NOT NULL,
`name` varchar(32) NOT NULL default ''
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
CONNECTION='mysql://user:pass@127.0.0.1:SLAVE_PORT/federated/t1';
-ERROR HY000: Unable to connect to foreign data source - database ' database federated username user hostname 127.0.0.1'!
+ERROR HY000: Unable to connect to foreign data source: database: 'federated' username: 'user' hostname: '127.0.0.1'
DROP TABLE IF EXISTS federated.t1;
Warnings:
Note 1051 Unknown table 't1'
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
index 14393be1cc8..a9f90e24556 100644
--- a/mysql-test/r/grant.result
+++ b/mysql-test/r/grant.result
@@ -238,7 +238,7 @@ Grants for drop_user@localhost
GRANT USAGE ON *.* TO 'drop_user'@'localhost'
drop user drop_user@localhost;
revoke all privileges, grant option from drop_user@localhost;
-ERROR HY000: Can't revoke all privileges, grant for one or more of the requested users
+ERROR HY000: Can't revoke all privileges for one or more of the requested users
grant select(a) on test.t1 to drop_user1@localhost;
grant select on test.t1 to drop_user2@localhost;
grant select on test.* to drop_user3@localhost;
@@ -247,7 +247,7 @@ drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
drop_user4@localhost;
revoke all privileges, grant option from drop_user1@localhost, drop_user2@localhost,
drop_user3@localhost, drop_user4@localhost;
-ERROR HY000: Can't revoke all privileges, grant for one or more of the requested users
+ERROR HY000: Can't revoke all privileges for one or more of the requested users
drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
drop_user4@localhost;
ERROR HY000: Operation DROP USER failed for 'drop_user1'@'localhost','drop_user2'@'localhost','drop_user3'@'localhost','drop_user4'@'localhost'
diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result
index ca375ef5057..9c744396403 100644
--- a/mysql-test/r/grant2.result
+++ b/mysql-test/r/grant2.result
@@ -191,7 +191,7 @@ flush privileges;
show grants for 'mysqltest_1';
ERROR 42000: There is no such grant defined for user 'mysqltest_1' on host '%'
revoke all privileges, grant option from 'mysqltest_1';
-ERROR HY000: Can't revoke all privileges, grant for one or more of the requested users
+ERROR HY000: Can't revoke all privileges for one or more of the requested users
drop user 'mysqltest_1';
select host,db,user from mysql.db where user = 'mysqltest_1' order by host,db,user;
host db user
diff --git a/mysql-test/t/csv.test b/mysql-test/t/csv.test
index 5b693335a43..a028f6ced6d 100644
--- a/mysql-test/t/csv.test
+++ b/mysql-test/t/csv.test
@@ -1352,3 +1352,35 @@ SELECT * FROM bug14672;
DROP TABLE bug14672;
# End of 4.1 tests
+
+#
+# BUG#13406 - incorrect amount of "records deleted"
+#
+
+create table t1 (a int) engine=csv;
+insert t1 values (1);
+--enable_info
+delete from t1; -- delete_row
+delete from t1; -- delete_all_rows
+--disable_info
+insert t1 values (1),(2);
+--enable_info
+delete from t1; -- delete_all_rows
+--disable_info
+insert t1 values (1),(2),(3);
+flush tables;
+--enable_info
+delete from t1; -- delete_row
+--disable_info
+insert t1 values (1),(2),(3),(4);
+flush tables;
+select count(*) from t1;
+--enable_info
+delete from t1; -- delete_all_rows
+--disable_info
+insert t1 values (1),(2),(3),(4),(5);
+--enable_info
+truncate table t1; -- truncate
+--disable_info
+drop table t1;
+