Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CI, fix Embedded server, improve tests, adjust to MySQL 8 #213

Open
wants to merge 44 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
02f5f7d
Fix and cleanup test t/12embedded.t
pali Nov 16, 2023
bdd3688
Fix test t/87async.t to not enter into infinite dead loop
pali Nov 16, 2023
37d7fa0
Generate t/MariaDB.mtest file from Makefile.PL in deterministic way
pali Nov 18, 2023
cb42283
Fix remembering Makefile.PL --testauthplugin option during more Makef…
pali Nov 18, 2023
b5af5ea
Remember in imp_dbh structure if connection is to Embedded server or not
pali Nov 18, 2023
87097ed
Fix mariadb_hostinfo and SQL_SERVER_NAME attributes for Embedded server
pali Nov 18, 2023
b87ab2f
Async queries do not work with Embedded server
pali Nov 18, 2023
6b137cc
mariadb_max_allowed_packet does not work with Embedded server
pali Nov 18, 2023
aaf3f78
Fix test t/10connect.t for Embedded server
pali Nov 18, 2023
1a19779
Connection to Embedded server does not have socket
pali Nov 18, 2023
bc40bf0
Do not run async tests with Embedded server
pali Nov 18, 2023
504e9dd
Do not run wait_timeout tests with Embedded server
pali Nov 18, 2023
771b59b
In Github Actions script rename CONC_* variables to CLIENT_*
pali Jul 23, 2023
94dc429
On Github CI test MySQL 4.1 and 5.1 server versions with MySQL 8.0.4+…
pali Jul 23, 2023
9238285
Extend documentation for Embedded server option mariadb_embedded_options
pali Nov 18, 2023
3df4b8a
Allow to run test suite against Embedded server
pali Nov 16, 2023
36fdf7d
In test t/12embedded.t use new Makefile.PL option --testemboptions
pali Nov 18, 2023
66a06e6
Add Ubuntu Trusty MySQL 5.5 PIC library with Embedded server for test…
pali Nov 16, 2023
0eb99d7
Fix mariadb_auto_reconnect for MySQL 8.0.24+
pali Nov 20, 2023
a9a518b
Fix SSL options for MySQL 8.3.0+ client library
pali Mar 19, 2024
3e29195
Revert "Change mariadb_st_internal_execute41 function argument num_pa…
pali Mar 19, 2024
efcf592
Fix bind params for MySQL 8.3.0+ client library
pali Mar 19, 2024
d51e741
WIP Explicitly create the directory for local lib
choroba Dec 12, 2024
0a294ee
Uninstall existing mysql/mariadb
choroba Dec 12, 2024
8d1b4df
fixup! Allow to run test suite against Embedded server
pali Dec 12, 2024
5a732e6
fixup! Add Ubuntu Trusty MySQL 5.5 PIC library with Embedded server f…
pali Dec 12, 2024
ddc92cb
Install dependences after setup of DBD_MARIADB_* env on Github Action…
pali Dec 13, 2024
4fc2c05
WIP show build failures
choroba Dec 12, 2024
cdfdfb8
fixup! Install dependences after setup of DBD_MARIADB_* env on Github…
pali Dec 14, 2024
7e9c0f9
fixup! Install dependences after setup of DBD_MARIADB_* env on Github…
choroba Dec 14, 2024
9a1bffc
fixup! In Github Actions script rename CONC_* variables to CLIENT_*
choroba Dec 14, 2024
338ab6c
fixup! Add Ubuntu Trusty MySQL 5.5 PIC library with Embedded server f…
choroba Dec 14, 2024
2c18625
fixup! Add Ubuntu Trusty MySQL 5.5 PIC library with Embedded server f…
pali Dec 15, 2024
ff86f97
WIP: Debug failures on embedded server
choroba Jan 11, 2025
0050cda
fixup! fixup! Add Ubuntu Trusty MySQL 5.5 PIC library with Embedded s…
choroba Jan 11, 2025
b1871e3
fixup! Add Ubuntu Trusty MySQL 5.5 PIC library with Embedded server f…
choroba Jan 12, 2025
b1b6d0f
fixup! Add Ubuntu Trusty MySQL 5.5 PIC library with Embedded server f…
choroba Jan 12, 2025
6787dd1
Add new Makefile.PL option --requireembsup
pali Jan 12, 2025
60f68da
Use DBD_MARIADB_REQUIREEMBSUP=1 on Github Actions CI for client-versi…
pali Jan 12, 2025
aece417
fixup! Add Ubuntu Trusty MySQL 5.5 PIC library with Embedded server f…
choroba Jan 12, 2025
1b5293d
fixup! In test t/12embedded.t use new Makefile.PL option --testembopt…
choroba Jan 12, 2025
19d14e8
fixup! Add Ubuntu Trusty MySQL 5.5 PIC library with Embedded server f…
choroba Jan 12, 2025
3b952fc
TMP: Make tests verbose for the hanging configuration
choroba Jan 13, 2025
6d66e9e
WIP Try a more recent client version
choroba Jan 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
186 changes: 128 additions & 58 deletions .github/workflows/ci.yaml

Large diffs are not rendered by default.

156 changes: 123 additions & 33 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,22 @@ push @mysql_headers, 'mysql.h';

our $opt = { "help" => \&Usage, };

my ($test_host, $test_port, $test_socket, $test_authplugin);
my ($test_host, $test_port, $test_socket, $test_embdatadir);
{
local ($::test_host, $::test_port, $::test_user, $::test_socket, $::test_authplugin, $::test_password, $::test_db, $::test_mysql_config, $::test_cflags, $::test_libs);
local ($::test_host, $::test_port, $::test_user, $::test_socket, $::test_embdatadir, $::test_emboptions, $::test_authplugin, $::test_password, $::test_db, $::test_mysql_config, $::test_cflags, $::test_libs);
eval { require "./t/MariaDB.mtest" } and do {
$opt->{'testuser'} = $::test_user;
$opt->{'testpassword'} = $::test_password;
$opt->{'testdb'} = $::test_db;
$opt->{'mysql_config'} = $::test_mysql_config;
$opt->{'cflags'} = $::test_cflags;
$opt->{'libs'} = $::test_libs;
$opt->{'testemboptions'} = $::test_emboptions;
$opt->{'testauthplugin'} = $::test_authplugin;
$test_host = $::test_host;
$test_port = $::test_port;
$test_socket = $::test_socket;
$test_authplugin = $::test_authplugin;
$test_embdatadir = $::test_embdatadir;
}
}

Expand All @@ -50,7 +52,10 @@ Getopt::Long::GetOptions(
"testuser:s",
"testpassword:s",
"testsocket:s",
"testembdatadir:s",
"testemboptions:s",
"testauthplugin:s",
"requireembsup!",
"cflags:s",
"libs:s",
"mysql_config:s",
Expand Down Expand Up @@ -106,62 +111,112 @@ MSG
}
}

for my $key (qw(testdb testhost testuser testpassword testsocket testauthplugin testport cflags libs))
if (exists $opt->{requireembsup})
{
$source->{'requireembsup'} = "User's choice";
}
elsif (defined $ENV{'DBD_MARIADB_REQUIREEMBSUP'})
{
$source->{'requireembsup'} = 'environment';
$opt->{'requireembsup'} = !!$ENV{DBD_MARIADB_REQUIREEMBSUP};
}
else
{
$source->{'requireembsup'} = 'default';
$opt->{'requireembsup'} = 0;
}

for my $key (qw(testdb testhost testuser testpassword testsocket testport testembdatadir testemboptions testauthplugin cflags libs))
{
Configure($opt, $source, $key);
}

if (!$opt->{testport} && (!$opt->{testhost} || $opt->{testhost} eq 'localhost') && !defined $opt->{testsocket} && $test_socket) {
# Reusing old test host is possible if it does not conflict with new test port, new test socket or new test embdatadir
if (!defined $opt->{testhost} && defined $test_host && length $test_host &&
((defined $opt->{testport} && $test_host ne 'localhost' && $test_host ne 'embedded') ||
(defined $opt->{testsocket} && $test_host eq 'localhost') ||
(defined $opt->{testembdatadir} && $test_host eq 'embedded') ||
(!defined $opt->{testsocket} && !defined $opt->{testembdatadir} && !defined $opt->{testport}))) {
$opt->{testhost} = $test_host;
$source->{testhost} = "User's choice";
}

# Reusing old test port is possible if it does not conflict with new test host, new test socket or new test embdatadir
if (!defined $opt->{testport} && defined $test_port && length $test_port &&
(!defined $opt->{testhost} || ($opt->{testhost} ne 'localhost' && $opt->{testhost} ne 'embedded')) &&
!defined $opt->{testsocket} &&
!defined $opt->{testembdatadir}) {
$opt->{testport} = $test_port;
$source->{testport} = "User's choice";
}

# Reusing old test socket is possible if it does not conflict with new test host, new test port or new test embdatadir
if (!defined $opt->{testsocket} && defined $test_socket && length $test_socket &&
(!defined $opt->{testhost} || $opt->{testhost} eq 'localhost') &&
!defined $opt->{testport} &&
!defined $opt->{testembdatadir}) {
$opt->{testsocket} = $test_socket;
$source->{testsocket} = "User's choice";
}

if (!$opt->{testsocket}) {
if (!defined $opt->{testhost} && $test_host && (!$opt->{testport} || $test_host ne 'localhost')) {
$opt->{testhost} = $test_host;
$source->{testhost} = "User's choice";
}
if (!defined $opt->{testport} && $test_port && (!$opt->{testhost} || $opt->{testhost} ne 'localhost')) {
$opt->{testport} = $test_port;
$source->{testport} = "User's choice";
}
} else {
if (!defined $opt->{testhost} && $test_host && $test_host eq 'localhost') {
$opt->{testhost} = 'localhost';
$source->{testhost} = "User's choice";
}
# Reusing old test embdatadir is possible if it does not conflict with new test host, new test port or new test socket
if (!defined $opt->{testembdatadir} && defined $test_embdatadir && length $test_embdatadir &&
(!defined $opt->{testhost} || $opt->{testhost} eq 'embedded') &&
!defined $opt->{testport} &&
!defined $opt->{testsocket}) {
$opt->{testembdatadir} = $test_embdatadir;
$source->{testembdatadir} = "User's choice";
}

# if we have a testsocket but no host, set localhost
if (defined $opt->{testsocket} && !defined $opt->{testhost}) {
$opt->{testhost} = 'localhost';
$source->{testhost} = 'guessed';
}

#if we have a testport but no host, assume 127.0.0.1
if ( $opt->{testport} && !$opt->{testhost} ) {
# if we have a testembdatadir but no host, set embedded
if (defined $opt->{testembdatadir} && !defined $opt->{testhost}) {
$opt->{testhost} = 'embedded';
$source->{testhost} = 'guessed';
}

# if we have a testport but no host, assume 127.0.0.1
if (defined $opt->{testport} && !defined $opt->{testhost}) {
$opt->{testhost} = '127.0.0.1';
$source->{testhost} = 'guessed';
}

foreach (qw(testhost testport testsocket testauthplugin)) {
foreach (qw(testhost testport testsocket testembdatadir)) {
next if defined $opt->{$_};
$opt->{$_} = '';
$source->{$_} = 'default';
}

# testsocket makes sense only when testhost is localhost
if ($opt->{testsocket} && $opt->{testhost} && $opt->{testhost} ne 'localhost') {
if (length $opt->{testsocket} && $opt->{testhost} ne 'localhost') {
die << "MSG";
Option --testport or --testhost different from localhost cannot be specified together with option --testsocket.
Option --testhost different from localhost cannot be specified together with option --testsocket.
MSG
}

# testport cannot be specified when host is localhost
if ($opt->{testport} && $opt->{testhost} && $opt->{testhost} eq 'localhost') {
# testembdatadir makes sense only when testhost is embedded
if (length $opt->{testembdatadir} && $opt->{testhost} ne 'embedded') {
die << "MSG";
Option --testport cannot be specified when --testhost is localhost.
Option --testhost different from embedded cannot be specified together with option --testembdatadir.
MSG
}

# testhost cannot be embedded
if ($opt->{testhost} && $opt->{testhost} eq 'embedded') {
# there is no default testembdatadir, so check that it is set
if ($opt->{testhost} eq 'embedded' && !length $opt->{testembdatadir}) {
die << "MSG";
Option --testhost cannot be embedded.
Option --testembdatadir must be specified when --testhost is embedded.
MSG
}

# testport cannot be specified when host is localhost or embedded
if (length $opt->{testport} && ($opt->{testhost} eq 'localhost' || $opt->{testhost} eq 'embedded')) {
die << "MSG";
Option --testport cannot be specified when --testhost is localhost or embedded.
MSG
}

Expand Down Expand Up @@ -258,10 +313,19 @@ my $have_embedded = check_lib(
ldflags => (join ' ', @libdirs, @libs, @ldflags),
header => \@mysql_headers,
function => 'return mysql_embedded() ? 0 : 1;',
debug => 1,
);

print "Embedded server: " . ($have_embedded ? "supported" : "not supported by client library") . "\n\n";

if (!$have_embedded && ($opt->{testhost} eq 'embedded' || $opt->{requireembsup})) {
die << "MSG";
Cannot run test suite against Embedded server (specified via
option --testhost=embedded or option --requireembsup) because
Embedded server is not supported by client library.
MSG
}

my $have_get_charset_number = check_lib(
LIBS => (join ' ', @libdirs, $main_lib),
ccflags => $opt->{cflags},
Expand Down Expand Up @@ -414,20 +478,26 @@ EOF
print "Client library deinitialize OpenSSL library functions: " . ($have_problem_with_openssl ? "yes" : "no") . "\n\n";

my $fileName = File::Spec->catfile("t", "MariaDB.mtest");
print "Writing $fileName for test suite\n";
(open(FILE, ">$fileName") &&
(print FILE ("{ local " . Data::Dumper->Dump([$opt], ["opt"]) .
" local " . Data::Dumper->Dump([$source], ["source"]) .
(print FILE ("{\n" .
"local " . Data::Dumper->new([$opt], ["opt"])->Sortkeys(1)->Indent(1)->Dump() .
"local " . Data::Dumper->new([$source], ["source"])->Sortkeys(1)->Indent(1)->Dump() .
"\$::test_host = \$opt->{'testhost'};\n" .
"\$::test_port = \$opt->{'testport'};\n" .
"\$::test_user = \$opt->{'testuser'};\n" .
"\$::test_socket = \$opt->{'testsocket'};\n" .
"\$::test_embdatadir = \$opt->{'testembdatadir'};\n" .
"\$::test_emboptions = \$opt->{'testemboptions'};\n" .
"\$::test_authplugin = \$opt->{'testauthplugin'};\n" .
"\$::test_password = \$opt->{'testpassword'};\n" .
"\$::test_db = \$opt->{'testdb'};\n" .
"\$::test_dsn = \"DBI:MariaDB:\$::test_db\";\n" .
"\$::test_dsn .= \":\$::test_host\" if \$::test_host;\n" .
"\$::test_dsn .= \":\$::test_port\" if \$::test_port;\n".
"\$::test_dsn .= \";mariadb_socket=\$::test_socket\" if \$::test_socket;\n" .
"\$::test_dsn .= \";mariadb_embedded_options=--datadir=\$::test_embdatadir\" if \$::test_embdatadir;\n" .
"\$::test_dsn .= \",\$::test_emboptions\" if \$::test_embdatadir and \$::test_emboptions;\n" .
"\$::test_dsn .= \";mariadb_auth_plugin=\$::test_authplugin\" if \$::test_authplugin;\n" .
"\$::test_dsn .= \";mariadb_connect_timeout=120;mariadb_read_timeout=120;mariadb_write_timeout=120\";\n" .
"\$::test_mysql_config = \$opt->{'mysql_config'} if \$source->{'mysql_config'} eq 'User\\'s choice';\n" .
Expand Down Expand Up @@ -661,9 +731,19 @@ Possible options are:
the database server; by default unix socket is chosen
by mariadb/mysqlclient library; takes effect only
when --testhost is set to "localhost"
--testembdatadir=<dir> Use <dir> as database directory for embedded server,
it may be and it is suggested to be empty, which means
that database is uninitialized; takes effect only when
--testhost is set to "embedded"
--testemboptions=<op> Use <op> as additional options for embedded server
separated by comma, it is recommended to set output
log file (e.g. '--log-error=/dev/null') and language
directory (e.g. '--language=/usr/local/share/mysql')
if language directory is different than system one
--testauthplugin=<ap> Use <ap> auth plugin when doing user authentication
handshake with server; for older server versions it is
needed to pass "mysql_native_password"
--requireembsup Require client library with embedded server support
--mariadb_config Synonym for --mysql_config, override it
--mysql_config=<path> Specify <path> for mariadb_config or mysql_config script
--help Print this message and exit
Expand Down Expand Up @@ -788,6 +868,7 @@ sub Configure {
header => \@mysql_headers,
function => $function,
not_execute => 1,
debug => 1,
) or next;
}
# and now create executable and do real version check
Expand All @@ -797,6 +878,7 @@ sub Configure {
ccflags => $opt->{cflags},
header => \@mysql_headers,
function => $function,
debug => 1,
) or next;
$str .= ' ' . $add_ldflags if defined $add_ldflags;
$check_passed = 1;
Expand Down Expand Up @@ -858,6 +940,14 @@ perl Makefile.PL --testuser=username
$source->{$param} = "default";
$opt->{$param} = "";
}
elsif ($param eq "testauthplugin") {
$source->{$param} = "default";
$opt->{$param} = "";
}
elsif ($param eq "testemboptions") {
$source->{$param} = "default";
$opt->{$param} = "";
}
elsif ($param eq "cflags") {
$source->{$param} = "guessed";
my ($dir, $file) = SearchFor('include', 'mysql.h');
Expand Down Expand Up @@ -900,7 +990,7 @@ section "Linker flags" or type
perl Makefile.PL --help
MSG
}
elsif ($param eq "testhost" || $param eq "testport" || $param eq "testsocket" || $param eq "testauthplugin") {
elsif (grep { $param eq $_ } ("testhost", "testport", "testsocket", "testembdatadir")) {
# known parameter, but do nothing
}
else {
Expand Down
Loading
Loading