Skip to content

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

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

Merged
merged 32 commits into from
May 3, 2025
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
2f1ca8e
Fix and cleanup test t/12embedded.t
pali Nov 16, 2023
1a36a67
Fix test t/87async.t to not enter into infinite dead loop
pali Nov 16, 2023
a5010fc
Generate t/MariaDB.mtest file from Makefile.PL in deterministic way
pali Nov 18, 2023
018a8a0
Fix remembering Makefile.PL --testauthplugin option during more Makef…
pali Nov 18, 2023
bcef327
Remember in imp_dbh structure if connection is to Embedded server or not
pali Nov 18, 2023
0eb1a0c
Fix mariadb_hostinfo and SQL_SERVER_NAME attributes for Embedded server
pali Nov 18, 2023
726d84a
Async queries do not work with Embedded server
pali Nov 18, 2023
6986835
mariadb_max_allowed_packet does not work with Embedded server
pali Nov 18, 2023
c7e42cc
Fix test t/10connect.t for Embedded server
pali Nov 18, 2023
4307922
Connection to Embedded server does not have socket
pali Nov 18, 2023
a6147f8
Do not run async tests with Embedded server
pali Nov 18, 2023
6336101
Do not run wait_timeout tests with Embedded server
pali Nov 18, 2023
57f7269
In Github Actions script rename CONC_* variables to CLIENT_*
pali Jul 23, 2023
2b76ad0
On Github CI test MySQL 4.1 and 5.1 server versions with MySQL 8.0.4+…
pali Jul 23, 2023
86db0a8
Extend documentation for Embedded server option mariadb_embedded_options
pali Nov 18, 2023
24f99ef
Allow to run test suite against Embedded server
pali Nov 16, 2023
66a97ae
Add new Makefile.PL option --requireembsup
pali Jan 12, 2025
70f63de
Use DBD_MARIADB_REQUIREEMBSUP=1 on Github Actions CI for client-versi…
pali Jan 12, 2025
0e01277
In test t/12embedded.t use new Makefile.PL option --testemboptions
pali Nov 18, 2023
f80b3b9
Add Ubuntu Trusty MySQL 5.5 PIC library with Embedded server for test…
pali Nov 16, 2023
65a80d2
Fix mariadb_auto_reconnect for MySQL 8.0.24+
pali Nov 20, 2023
ecc5fcb
Fix SSL options for MySQL 8.3.0+ client library
pali Mar 19, 2024
ee6ed3c
Revert "Change mariadb_st_internal_execute41 function argument num_pa…
pali Mar 19, 2024
85ee575
Fix bind params for MySQL 8.3.0+ client library
pali Mar 19, 2024
8c3cc68
Uninstall existing mysql/mariadb
choroba Dec 12, 2024
c09c0bd
Install dependences after setup of DBD_MARIADB_* env on Github Action…
pali Dec 13, 2024
8a4eb3c
Update the apt cache
choroba Apr 15, 2025
135df8b
Skip testing the old server with a new client to prevent crashes
choroba May 3, 2025
1394693
Add Perl 5.8.40 to the tests
choroba May 3, 2025
fba7f51
Stop testing the combination that always times out in GitHub Actions
choroba May 3, 2025
b0d2458
Use older ExtUtils::ParseXS for older Perls for compatibility
choroba May 3, 2025
0ea6902
Merge Github Actions CI steps to install client dependencies
choroba May 3, 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
197 changes: 135 additions & 62 deletions .github/workflows/ci.yaml

Large diffs are not rendered by default.

153 changes: 120 additions & 33 deletions Makefile.PL
Original file line number Diff line number Diff line change
@@ -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;
}
}

@@ -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",
@@ -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
}

@@ -262,6 +317,14 @@ my $have_embedded = check_lib(

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},
@@ -414,20 +477,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" .
@@ -661,9 +730,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
@@ -858,6 +937,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');
@@ -900,7 +987,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 {
Loading