summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2003-05-13 10:54:07 +0300
committerunknown <monty@mashka.mysql.fi>2003-05-13 10:54:07 +0300
commit10c790eff016ff0fc779baeb7ebf94940d3544e7 (patch)
tree911f869319dc53526bc2bb909aa87944db9d2696 /tests
parent504fd4d43990e507b685eb336ee672c637ecf4cb (diff)
downloadmariadb-git-10c790eff016ff0fc779baeb7ebf94940d3544e7.tar.gz
Safety fix to enable RAID in max binaries
Better fix for format('nan') Fix for HAVING COUNT(DISTINCT...) myisam/mi_check.c: Better error message myisam/mi_dynrec.c: Simple code cleanup myisam/myisamchk.c: Better error messages mysql-test/r/func_misc.result: Added back test for format('nan') mysql-test/r/having.result: New test mysql-test/t/func_misc.test: Added back test for format('nan') mysql-test/t/having.test: Added test for count(distinct) in having mysys/raid.cc: Safety fix to enable RAID in max binaries scripts/mysql_install_db.sh: Create data directories even if --in-rpm is used (for MaxOSX) sql/item_strfunc.cc: Better fix for format('nan') sql/mysqld.cc: Give stacktrace on assert() sql/sql_yacc.yy: Fix for HAVING COUNT(DISTINCT...) tests/big_record.pl: Extend test to abuse packed MyISAM tables tests/table_types.pl: Fixed wrong merge
Diffstat (limited to 'tests')
-rwxr-xr-xtests/big_record.pl41
-rwxr-xr-xtests/table_types.pl35
2 files changed, 48 insertions, 28 deletions
diff --git a/tests/big_record.pl b/tests/big_record.pl
index 08547b50823..fbe94e3540f 100755
--- a/tests/big_record.pl
+++ b/tests/big_record.pl
@@ -11,12 +11,13 @@ use Getopt::Long;
$opt_host="";
$opt_user=$opt_password="";
$opt_db="test";
-$opt_rows=200; # Test of blobs up to ($rows-1)*100000+1 bytes
+$opt_rows=20; # Test of blobs up to ($rows-1)*100000+1 bytes
$opt_compress=0;
$opt_table="test_big_record";
+$opt_loop_count=100000; # Change this to make test harder/easier
GetOptions("host=s","db=s","user=s", "password=s", "table=s", "rows=i",
- "compress") || die "Aborted";
+ "compress", "loop-count=i") || die "Aborted";
print "Connection to database $test_db\n";
@@ -42,12 +43,12 @@ $|=1; # Flush output to stdout to be able to monitor process
for ($i=0 ; $i < $opt_rows ; $i++)
{
$tmp= chr(65+($i % 16)) x ($i*100000+1);
- print $i," ",length($tmp),"\n";
$tmp= $dbh->quote($tmp);
$dbh->do("insert into $opt_table (test) values ($tmp)") or die $DBI::errstr;
+ print ".";
}
-print "Reading records\n";
+print "\nReading records\n";
$sth=$dbh->prepare("select * from $opt_table", { "mysql_use_result" => 1}) or die $dbh->errstr;
@@ -56,14 +57,40 @@ $sth->execute() or die $sth->errstr;
$i=0;
while (($row = $sth->fetchrow_arrayref))
{
- print $row->[0]," ",length($row->[1]),"\n";
die "Record $i had wrong data in blob" if ($row->[1] ne (chr(65+($i % 16)) x ($i*100000+1)));
$i++;
}
die "Didn't get all rows from server" if ($i != $opt_rows);
-$dbh->do("drop table $opt_table") or die $DBI::errstr;
+#
+# Test by insert/updating/deleting random rows for a while
+#
-print "Test ok\n";
+print "Testing insert/update/delete\n";
+
+$max_row_id= $rows;
+for ($i= 0 ; $i < $opt_loop_count ; $i++)
+{
+ $length= int(rand 65535);
+ $tmp= chr(65+($i % 16)) x $length;
+ $tmp= $dbh->quote($tmp);
+ $dbh->do("insert into $opt_table (test) values ($tmp)") or die $DBI::errstr;
+ $max_row_id++;
+ $length=int(rand 65535);
+ $tmp= chr(65+($i % 16)) x $length;
+ $tmp= $dbh->quote($tmp);
+ $id= int(rand $max_row_id);
+ $dbh->do("update $opt_table set test= $tmp where auto= $id") or die $DBI::errstr;
+ if (($i % 2) == 1)
+ {
+ $id= int(rand $max_row_id);
+ $dbh->do("delete from $opt_table where auto= $id") or die $DBI::errstr;
+ }
+ print "." if ($i % ($opt_loop_count/100) == 1);
+}
+
+# $dbh->do("drop table $opt_table") or die $DBI::errstr;
+
+print "\nTest ok\n";
exit 0;
diff --git a/tests/table_types.pl b/tests/table_types.pl
index 8198cd9ba86..4dbcdcb975c 100755
--- a/tests/table_types.pl
+++ b/tests/table_types.pl
@@ -66,13 +66,6 @@ $dbh = $server->connect();
####
$table_name="bench1";
-<<<<<<< table_types.pl
-||||||| 1.2
-test("n","type=isam","char"); test("m","type=myisam pack_keys=1","char"); exit(1);
-
-=======
-
->>>>>>> /tmp/T4a17019
test($table_name,"type=isam","char");
test($table_name,"type=myisam pack_keys=0","char");
test($table_name,"type=myisam pack_keys=0","char");
@@ -91,7 +84,7 @@ exit (0);
sub test {
my ($name,$options,$chartype)=@_;
-
+
print "\nTesting with options: '$options'\n";
$dbh->do("drop table $name");
do_many($dbh,$server->create("$name",
@@ -102,23 +95,23 @@ sub test {
["primary key (id,id2)",
"index index_id3 (id3)"],
$options));
-
+
if ($opt_lock_tables)
{
$sth = $dbh->do("LOCK TABLES $name WRITE") || die $DBI::errstr;
}
-
+
if ($opt_fast && defined($server->{vacuum}))
{
$server->vacuum(\$dbh,1);
}
-
+
####
#### Insert $total_rows records in order, in reverse order and random.
####
-
+
$loop_time=new Benchmark;
-
+
if ($opt_fast_insert)
{
$query="insert into $name values ";
@@ -127,11 +120,11 @@ sub test {
{
$query="insert into $name (id,id2,id3,dummy1) values ";
}
-
+
if (($opt_fast || $opt_fast_insert) && $limits->{'multi_value_insert'})
{
$query_size=$server->{'limits'}->{'query_size'};
-
+
print "Inserting $opt_loop_count multiple-value rows in order\n";
$res=$query;
for ($i=0 ; $i < $opt_loop_count ; $i++)
@@ -186,7 +179,7 @@ sub test {
{
$sth = $dbh->do($query . "($i,$i,$i,'ABCDEFGHIJ')") or die $DBI::errstr;
}
-
+
print "Inserting $opt_loop_count rows in reverse order\n";
for ($i=0 ; $i < $opt_loop_count ; $i++)
{
@@ -195,25 +188,25 @@ sub test {
($total_rows-1-$i) . ",'BCDEFGHIJK')")
or die $DBI::errstr;
}
-
+
print "Inserting $opt_loop_count rows in random order\n";
-
+
for ($i=0 ; $i < $opt_loop_count ; $i++)
{
$sth = $dbh->do($query . "(". $random[$i] . "," . $random[$i] .
"," . $random[$i] . ",'CDEFGHIJKL')") or die $DBI::errstr;
}
}
-
+
$end_time=new Benchmark;
print "Time for insert (" . ($total_rows) . "): " .
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
-
+
if ($opt_fast && defined($server->{vacuum}))
{
$server->vacuum(\$dbh,1);
}
-
+
$sth=$dbh->prepare("show table status like '$name'");
$sth->execute || die "Show table status returned error: $DBI::errstr\n";
while (@row = $sth->fetchrow_array)