Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
02eee93f
Commit
02eee93f
authored
Sep 20, 2008
by
Magnus Svensson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Versional testing support
parent
67580cd2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
108 additions
and
45 deletions
+108
-45
mysql-test/lib/My/Find.pm
mysql-test/lib/My/Find.pm
+35
-1
mysql-test/mysql-test-run.pl
mysql-test/mysql-test-run.pl
+73
-44
No files found.
mysql-test/lib/My/Find.pm
View file @
02eee93f
...
@@ -26,7 +26,7 @@ use Carp;
...
@@ -26,7 +26,7 @@ use Carp;
use
My::
Platform
;
use
My::
Platform
;
use
base
qw(Exporter)
;
use
base
qw(Exporter)
;
our
@EXPORT
=
qw(my_find_bin my_find_dir NOT_REQUIRED)
;
our
@EXPORT
=
qw(my_find_bin my_find_dir
my_find_file
NOT_REQUIRED)
;
our
$vs_config_dir
;
our
$vs_config_dir
;
...
@@ -77,6 +77,40 @@ sub my_find_bin {
...
@@ -77,6 +77,40 @@ sub my_find_bin {
}
}
#
# my_find_file - find a file with "name_1...name_n" in
# paths "path_1...path_n" and return the full path
#
# Example:
# my $mysqld_exe= my_find_file($basedir.
# ["sql", "bin"],
# "filename");
#
#
# Also supports NOT_REQUIRED flag
#
# NOTE: The function honours MTR_VS_CONFIG environment variable
#
#
sub
my_find_file
{
my
(
$base
,
$paths
,
$names
,
$required
)
=
@_
;
croak
"
usage: my_find_file(<base>, <paths>, <names>, [<required>])
"
unless
@_
==
4
or
@_
==
3
;
# -------------------------------------------------------
# Find and return the first executable
# -------------------------------------------------------
foreach
my
$path
(
my_find_paths
(
$base
,
$paths
,
$names
,
$bin_extension
))
{
return
$path
if
(
-
f
$path
);
}
if
(
defined
$required
and
$required
==
NOT_REQUIRED
){
# Return empty string to indicate not found
return
"";
}
find_error
(
$base
,
$paths
,
$names
);
}
#
#
# my_find_dir - find the first existing directory in one of
# my_find_dir - find the first existing directory in one of
# the given paths
# the given paths
...
...
mysql-test/mysql-test-run.pl
View file @
02eee93f
...
@@ -188,8 +188,6 @@ my $exe_ndbd;
...
@@ -188,8 +188,6 @@ my $exe_ndbd;
my
$exe_ndb_mgmd
;
my
$exe_ndb_mgmd
;
my
$exe_ndb_waiter
;
my
$exe_ndb_waiter
;
our
$path_sql_dir
;
our
$debug_compiled_binaries
;
our
$debug_compiled_binaries
;
our
%
mysqld_variables
;
our
%
mysqld_variables
;
...
@@ -651,7 +649,6 @@ sub run_worker ($) {
...
@@ -651,7 +649,6 @@ sub run_worker ($) {
setup_vardir
();
setup_vardir
();
check_running_as_root
();
check_running_as_root
();
mysql_install_db
(
$thread_num
);
if
(
using_extern
()
)
{
if
(
using_extern
()
)
{
create_config_file_for_extern
(
%
opts_extern
);
create_config_file_for_extern
(
%
opts_extern
);
...
@@ -894,21 +891,10 @@ sub command_line_setup {
...
@@ -894,21 +891,10 @@ sub command_line_setup {
"
$basedir
/sql/share
",
"
$basedir
/sql/share
",
"
$basedir
/share
");
"
$basedir
/share
");
$path_language
=
mtr_path_exists
("
$path_share
/english
");
$path_language
=
mtr_path_exists
("
$path_share
/english
");
$path_charsetsdir
=
mtr_path_exists
("
$path_share
/charsets
");
$path_charsetsdir
=
mtr_path_exists
("
$path_share
/charsets
");
# Look for SQL scripts directory
if
(
mtr_file_exists
("
$path_share
/mysql_system_tables.sql
")
ne
"")
{
# The SQL scripts are in path_share
$path_sql_dir
=
$path_share
;
}
else
{
$path_sql_dir
=
mtr_path_exists
("
$basedir
/share
",
"
$basedir
/scripts
");
}
if
(
using_extern
())
if
(
using_extern
())
{
{
# Connect to the running mysqld and find out what it supports
# Connect to the running mysqld and find out what it supports
...
@@ -2419,7 +2405,7 @@ sub initialize_servers {
...
@@ -2419,7 +2405,7 @@ sub initialize_servers {
remove_stale_vardir
();
remove_stale_vardir
();
setup_vardir
();
setup_vardir
();
mysql_install_db
(
0
);
mysql_install_db
(
default_mysqld
(),
"
$opt_vardir
/install.db
"
);
}
}
}
}
}
}
...
@@ -2474,9 +2460,33 @@ sub sql_to_bootstrap {
...
@@ -2474,9 +2460,33 @@ sub sql_to_bootstrap {
}
}
sub
default_mysqld
{
# Generate new config file from template
my
$config
=
My::
ConfigFactory
->
new_config
(
{
basedir
=>
$basedir
,
template_path
=>
"
include/default_my.cnf
",
vardir
=>
$opt_vardir
,
tmpdir
=>
$opt_tmpdir
,
baseport
=>
0
,
user
=>
$opt_user
,
password
=>
'',
}
);
my
$mysqld
=
$config
->
group
('
mysqld.1
')
or
mtr_error
("
Couldn't find mysqld.1 in default config
");
return
$mysqld
;
}
sub
mysql_install_db
{
sub
mysql_install_db
{
my
(
$thread_num
)
=
@_
;
my
(
$mysqld
,
$datadir
)
=
@_
;
my
$data_dir
=
"
$opt_vardir
/install.db
";
my
$install_datadir
=
$datadir
||
$mysqld
->
value
('
datadir
');
my
$install_basedir
=
$mysqld
->
value
('
basedir
');
my
$install_lang
=
$mysqld
->
value
('
language
');
my
$install_chsdir
=
$mysqld
->
value
('
character-sets-dir
');
mtr_report
("
Installing system database...
");
mtr_report
("
Installing system database...
");
...
@@ -2484,8 +2494,8 @@ sub mysql_install_db {
...
@@ -2484,8 +2494,8 @@ sub mysql_install_db {
mtr_init_args
(
\
$args
);
mtr_init_args
(
\
$args
);
mtr_add_arg
(
$args
,
"
--no-defaults
");
mtr_add_arg
(
$args
,
"
--no-defaults
");
mtr_add_arg
(
$args
,
"
--bootstrap
");
mtr_add_arg
(
$args
,
"
--bootstrap
");
mtr_add_arg
(
$args
,
"
--basedir=%s
",
$basedir
);
mtr_add_arg
(
$args
,
"
--basedir=%s
",
$
install_
basedir
);
mtr_add_arg
(
$args
,
"
--datadir=%s
",
$
data_
dir
);
mtr_add_arg
(
$args
,
"
--datadir=%s
",
$
install_data
dir
);
mtr_add_arg
(
$args
,
"
--loose-skip-innodb
");
mtr_add_arg
(
$args
,
"
--loose-skip-innodb
");
mtr_add_arg
(
$args
,
"
--loose-skip-ndbcluster
");
mtr_add_arg
(
$args
,
"
--loose-skip-ndbcluster
");
mtr_add_arg
(
$args
,
"
--tmpdir=%s
",
"
$opt_vardir
/tmp/
");
mtr_add_arg
(
$args
,
"
--tmpdir=%s
",
"
$opt_vardir
/tmp/
");
...
@@ -2497,47 +2507,60 @@ sub mysql_install_db {
...
@@ -2497,47 +2507,60 @@ sub mysql_install_db {
$path_vardir_trace
);
$path_vardir_trace
);
}
}
mtr_add_arg
(
$args
,
"
--language=%s
",
$
path_language
);
mtr_add_arg
(
$args
,
"
--language=%s
",
$
install_lang
);
mtr_add_arg
(
$args
,
"
--character-sets-dir=%s
",
$
path_charset
sdir
);
mtr_add_arg
(
$args
,
"
--character-sets-dir=%s
",
$
install_ch
sdir
);
# If DISABLE_GRANT_OPTIONS is defined when the server is compiled (e.g.,
# If DISABLE_GRANT_OPTIONS is defined when the server is compiled (e.g.,
# configure --disable-grant-options), mysqld will not recognize the
# configure --disable-grant-options), mysqld will not recognize the
# --bootstrap or --skip-grant-tables options. The user can set
# --bootstrap or --skip-grant-tables options. The user can set
# MYSQLD_BOOTSTRAP to the full path to a mysqld which does accept
# MYSQLD_BOOTSTRAP to the full path to a mysqld which does accept
# --bootstrap, to accommodate this.
# --bootstrap, to accommodate this.
my
$exe_mysqld_bootstrap
=
$ENV
{'
MYSQLD_BOOTSTRAP
'}
||
find_mysqld
(
$basedir
);
my
$exe_mysqld_bootstrap
=
$ENV
{'
MYSQLD_BOOTSTRAP
'}
||
find_mysqld
(
$install_basedir
);
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# export MYSQLD_BOOTSTRAP_CMD variable containing <path>/mysqld <args>
# export MYSQLD_BOOTSTRAP_CMD variable containing <path>/mysqld <args>
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
$ENV
{'
MYSQLD_BOOTSTRAP_CMD
'}
=
"
$exe_mysqld_bootstrap
"
.
join
("
",
@$args
);
$ENV
{'
MYSQLD_BOOTSTRAP_CMD
'}
=
"
$exe_mysqld_bootstrap
"
.
join
("
",
@$args
);
return
if
$thread_num
>
0
;
# Only generate MYSQLD_BOOTSTRAP_CMD in workers
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# Create the bootstrap.sql file
# Create the bootstrap.sql file
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
my
$bootstrap_sql_file
=
"
$opt_vardir
/tmp/bootstrap.sql
";
my
$bootstrap_sql_file
=
"
$opt_vardir
/tmp/bootstrap.sql
";
if
(
-
f
"
$path_sql_dir
/mysql_system_tables.sql
")
my
$path_sql
=
my_find_file
(
$install_basedir
,
["
mysql
",
"
sql/share
",
"
share
",
"
scripts
"],
"
mysql_system_tables.sql
",
NOT_REQUIRED
);
if
(
-
f
$path_sql
)
{
{
my
$sql_dir
=
dirname
(
$path_sql
);
# Use the mysql database for system tables
# Use the mysql database for system tables
mtr_tofile
(
$bootstrap_sql_file
,
"
use mysql
\n
");
mtr_tofile
(
$bootstrap_sql_file
,
"
use mysql
\n
");
# Add the offical mysql system tables
# Add the offical mysql system tables
# for a production system
# for a production system
mtr_appendfile_to_file
("
$
path_
sql_dir
/mysql_system_tables.sql
",
mtr_appendfile_to_file
("
$sql_dir
/mysql_system_tables.sql
",
$bootstrap_sql_file
);
$bootstrap_sql_file
);
# Add the mysql system tables initial data
# Add the mysql system tables initial data
# for a production system
# for a production system
mtr_appendfile_to_file
("
$
path_
sql_dir
/mysql_system_tables_data.sql
",
mtr_appendfile_to_file
("
$sql_dir
/mysql_system_tables_data.sql
",
$bootstrap_sql_file
);
$bootstrap_sql_file
);
# Add test data for timezone - this is just a subset, on a real
# 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
# system these tables will be populated either by mysql_tzinfo_to_sql
# or by downloading the timezone table package from our website
# or by downloading the timezone table package from our website
mtr_appendfile_to_file
("
$path_sql_dir
/mysql_test_data_timezone.sql
",
mtr_appendfile_to_file
("
$sql_dir
/mysql_test_data_timezone.sql
",
$bootstrap_sql_file
);
# Fill help tables, just an empty file when running from bk repo
# but will be replaced by a real fill_help_tables.sql when
# building the source dist
mtr_appendfile_to_file
("
$sql_dir
/fill_help_tables.sql
",
$bootstrap_sql_file
);
$bootstrap_sql_file
);
}
}
...
@@ -2545,7 +2568,7 @@ sub mysql_install_db {
...
@@ -2545,7 +2568,7 @@ sub mysql_install_db {
{
{
# Install db from init_db.sql that exist in early 5.1 and 5.0
# Install db from init_db.sql that exist in early 5.1 and 5.0
# versions of MySQL
# versions of MySQL
my
$init_file
=
"
$basedir
/mysql-test/lib/init_db.sql
";
my
$init_file
=
"
$
install_
basedir
/mysql-test/lib/init_db.sql
";
mtr_report
("
- from '
$init_file
'
");
mtr_report
("
- from '
$init_file
'
");
my
$text
=
mtr_grab_file
(
$init_file
)
or
my
$text
=
mtr_grab_file
(
$init_file
)
or
mtr_error
("
Can't open '
$init_file
': $!
");
mtr_error
("
Can't open '
$init_file
': $!
");
...
@@ -2554,12 +2577,6 @@ sub mysql_install_db {
...
@@ -2554,12 +2577,6 @@ sub mysql_install_db {
sql_to_bootstrap
(
$text
));
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
# building the source dist
mtr_appendfile_to_file
("
$path_sql_dir
/fill_help_tables.sql
",
$bootstrap_sql_file
);
# Remove anonymous users
# Remove anonymous users
mtr_tofile
(
$bootstrap_sql_file
,
mtr_tofile
(
$bootstrap_sql_file
,
"
DELETE FROM mysql.user where user= '';
\n
");
"
DELETE FROM mysql.user where user= '';
\n
");
...
@@ -2582,8 +2599,8 @@ sub mysql_install_db {
...
@@ -2582,8 +2599,8 @@ sub mysql_install_db {
"
$exe_mysqld_bootstrap
"
.
join
("
",
@$args
)
.
"
\n
");
"
$exe_mysqld_bootstrap
"
.
join
("
",
@$args
)
.
"
\n
");
# Create directories mysql and test
# Create directories mysql and test
mkpath
("
$
data_
dir
/mysql
");
mkpath
("
$
install_data
dir
/mysql
");
mkpath
("
$
data_
dir
/test
");
mkpath
("
$
install_data
dir
/test
");
if
(
My::
SafeProcess
->
run
if
(
My::
SafeProcess
->
run
(
(
...
@@ -4087,6 +4104,9 @@ sub start_servers($) {
...
@@ -4087,6 +4104,9 @@ sub start_servers($) {
}
}
}
}
my
$mysqld_basedir
=
$mysqld
->
value
('
basedir
');
if
(
$basedir
eq
$mysqld_basedir
)
{
# Copy datadir from installed system db
# Copy datadir from installed system db
for
my
$path
(
"
$opt_vardir
",
"
$opt_vardir
/..
")
{
for
my
$path
(
"
$opt_vardir
",
"
$opt_vardir
/..
")
{
my
$install_db
=
"
$path
/install.db
";
my
$install_db
=
"
$path
/install.db
";
...
@@ -4095,6 +4115,15 @@ sub start_servers($) {
...
@@ -4095,6 +4115,15 @@ sub start_servers($) {
}
}
mtr_error
("
Failed to copy system db to '
$datadir
'
")
mtr_error
("
Failed to copy system db to '
$datadir
'
")
unless
-
d
$datadir
;
unless
-
d
$datadir
;
}
else
{
mysql_install_db
(
$mysqld
);
mtr_error
("
Failed to install system db to '
$datadir
'
")
unless
-
d
$datadir
;
}
# Create the servers tmpdir
# Create the servers tmpdir
my
$tmpdir
=
$mysqld
->
value
('
tmpdir
');
my
$tmpdir
=
$mysqld
->
value
('
tmpdir
');
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment