From d21e7383d11f1417db77333bbdb33dd07998fc22 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 24 Apr 2008 14:14:11 +0200 Subject: [PATCH] Add support for bootstrapping from init_db.sql, which is used in early versions of 5.1 and 5.0 Fix usage instruction of defaults_extra_file --- mysql-test/mysql-test-run.pl | 51 +++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 16 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index ba776a781b4..f4f45c5a61a 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -2020,6 +2020,9 @@ sub sql_to_bootstrap { next; } + # Replace @HOSTNAME with localhost + $line=~ s/\'\@HOSTNAME\@\'/localhost/; + # Default, just add the line without newline # but with a space as separator $result.= "$line "; @@ -2071,24 +2074,40 @@ sub mysql_install_db { # ---------------------------------------------------------------------- my $bootstrap_sql_file= "$opt_vardir/tmp/bootstrap.sql"; - # Use the mysql database for system tables - mtr_tofile($bootstrap_sql_file, "use mysql\n"); + if (-f "$path_sql_dir/mysql_system_tables.sql") + { + # Use the mysql database for system tables + mtr_tofile($bootstrap_sql_file, "use mysql\n"); - # Add the offical mysql system tables - # for a production system - mtr_appendfile_to_file("$path_sql_dir/mysql_system_tables.sql", - $bootstrap_sql_file); + # Add the offical mysql system tables + # for a production system + mtr_appendfile_to_file("$path_sql_dir/mysql_system_tables.sql", + $bootstrap_sql_file); - # Add the mysql system tables initial data - # for a production system - mtr_appendfile_to_file("$path_sql_dir/mysql_system_tables_data.sql", - $bootstrap_sql_file); + # Add the mysql system tables initial data + # for a production system + mtr_appendfile_to_file("$path_sql_dir/mysql_system_tables_data.sql", + $bootstrap_sql_file); - # Add test data for timezone - this is just a subset, on a real - # system these tables will be populated either by mysql_tzinfo_to_sql - # or by downloading the timezone table package from our website - mtr_appendfile_to_file("$path_sql_dir/mysql_test_data_timezone.sql", - $bootstrap_sql_file); + # Add test data for timezone - this is just a subset, on a real + # system these tables will be populated either by mysql_tzinfo_to_sql + # or by downloading the timezone table package from our website + mtr_appendfile_to_file("$path_sql_dir/mysql_test_data_timezone.sql", + $bootstrap_sql_file); + + } + else + { + # Install db from init_db.sql that exist in early 5.1 and 5.0 + # versions of MySQL + my $init_file= "$basedir/mysql-test/lib/init_db.sql"; + mtr_report(" - from '$init_file'"); + my $text= mtr_grab_file($init_file) or + mtr_error("Can't open '$init_file': $!"); + + mtr_tofile($bootstrap_sql_file, + sql_to_bootstrap($text)); + } # Fill help tables, just an empty file when running from bk repo # but will be replaced by a real fill_help_tables.sql when @@ -3741,7 +3760,7 @@ Options to control what engine/variation to run config|defaults-file= Use fixed config template for all tests - extra_defaults_file= Extra config template to add to + defaults_extra_file= Extra config template to add to all generated configs Options to control directories to use