Compare commits

...

No commits in common. "c9-beta" and "c10s" have entirely different histories.

20 changed files with 239 additions and 232 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

4
.gitignore vendored
View File

@ -1 +1,3 @@
SOURCES/DBD-MariaDB-1.21.tar.gz /DBD-MariaDB-1.21.tar.gz
/DBD-MariaDB-1.22.tar.gz
/DBD-MariaDB-1.23.tar.gz

View File

@ -1 +0,0 @@
fe2b6703d1340d82d219b056bf9a6feadf8904bd SOURCES/DBD-MariaDB-1.21.tar.gz

View File

@ -0,0 +1,19 @@
diff -up DBD-MariaDB-1.23/t/testrules.yml.orig DBD-MariaDB-1.23/t/testrules.yml
--- DBD-MariaDB-1.23/t/testrules.yml.orig 2023-09-10 16:18:55.000000000 +0200
+++ DBD-MariaDB-1.23/t/testrules.yml 2024-12-10 12:14:23.045521148 +0100
@@ -1,10 +1,11 @@
seq:
+ - seq: t/test-setup.t
- seq: t/00base.t
- seq: t/05dbcreate.t
- seq: t/10connect.t
+ - seq: t/87async.t
+ - seq: t/rt75353-innodb-lock-timeout.t
+ - seq: t/rt85919-fetch-lost-connection.t
- par:
- - seq: t/60leaks.t
- - seq: t/87async.t
- - seq: t/rt75353-innodb-lock-timeout.t
- - seq: t/rt85919-fetch-lost-connection.t
- par: **
+ - seq: t/test-clean.t

3
README.md Normal file
View File

@ -0,0 +1,3 @@
# perl-DBD-MariaDB
DBD::MariaDB is the Perl5 Database Interface driver for MariaDB and MySQL databases. In other words: DBD::MariaDB is an interface between the Perl programming language and the MariaDB/MySQL programming API that comes with the MariaDB/MySQL relational database management system. Most functions provided by this programming API are supported. Some rarely used functions are missing, mainly because no-one ever requested them.

View File

@ -1,83 +0,0 @@
From 9743bec52db5e8f1beb2b31e4a55d6ea1a4edcdd Mon Sep 17 00:00:00 2001
From: Pali <pali@cpan.org>
Date: Fri, 8 Apr 2022 21:36:47 +0200
Subject: [PATCH] Fix mysql_get_client_version() function
MariaDB Connector/C 3.1.10 changed API of mysql_get_client_version()
function. Before that release it returned client version. With that release
it started returning Connector/C package version.
So when compiling with MariaDB Connector/C client library, redefine
mysql_get_client_version() to always returns client version via function
mariadb_get_infov(MARIADB_CLIENT_VERSION_ID) call.
Driver code expects for a long time that mysql_get_client_version() call
returns client version and not something different.
Function mariadb_get_infov() is supported since MariaDB Connector/C 3.0+.
Fixes: https://github.com/perl5-dbi/DBD-mysql/issues/333
---
Makefile.PL | 8 +++++++-
dbdimp.h | 26 ++++++++++++++++++++++++++
2 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/Makefile.PL b/Makefile.PL
index b9b046c..f28a8df 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -757,7 +757,13 @@ sub Configure {
# https://jira.mariadb.org/browse/MDEV-16478
$function .= "\n#if defined(MARIADB_BASE_VERSION) || defined(MARIADB_PACKAGE_VERSION)\nif (mysql_get_client_version() >= 100301 && mysql_get_client_version() < 100308) return 1;\n#endif\n";
}
- $function .= 'return (mysql_get_client_version() == MYSQL_VERSION_ID) ? 0 : 1;';
+ # MariaDB Connector/C 3.1.10+ has broken mysql_get_client_version() function, so use mariadb_get_infov(MARIADB_CLIENT_VERSION_ID) instead
+ $function .= "size_t version;\n";
+ $function .= "#if defined(MARIADB_PACKAGE_VERSION) && defined(MARIADB_PACKAGE_VERSION_ID) && MARIADB_PACKAGE_VERSION_ID >= 30000\n";
+ $function .= "if (mariadb_get_infov((void *)0, MARIADB_CLIENT_VERSION_ID, &version) != 0)\n";
+ $function .= "#endif\n";
+ $function .= "version = mysql_get_client_version();\n";
+ $function .= 'return (version == MYSQL_VERSION_ID) ? 0 : 1;';
# libmysqld is built using g++ rather than gcc and sometimes
# we have to use libstdc++ to resolve linking problems
foreach my $add_ldflags (undef, '-lstdc++') {
diff --git a/dbdimp.h b/dbdimp.h
index 41cc72a..aee608f 100644
--- a/dbdimp.h
+++ b/dbdimp.h
@@ -322,6 +322,32 @@ PERL_STATIC_INLINE UV SvUV_nomg(pTHX_ SV *sv)
#define my_bool bool
#endif
+/*
+ * MariaDB Connector/C 3.1.10 changed API of mysql_get_client_version()
+ * function. Before that release it returned client version. With that release
+ * it started returning Connector/C package version.
+ *
+ * So when compiling with MariaDB Connector/C client library, redefine
+ * mysql_get_client_version() to always returns client version via function
+ * mariadb_get_infov(MARIADB_CLIENT_VERSION_ID) call.
+ *
+ * Driver code expects for a long time that mysql_get_client_version() call
+ * returns client version and not something different.
+ *
+ * Function mariadb_get_infov() is supported since MariaDB Connector/C 3.0+.
+ */
+#if defined(MARIADB_PACKAGE_VERSION) && defined(MARIADB_PACKAGE_VERSION_ID) && MARIADB_PACKAGE_VERSION_ID >= 30000
+PERL_STATIC_INLINE unsigned long mariadb_get_client_version(void)
+{
+ /* MARIADB_CLIENT_VERSION_ID really expects size_t type, documentation is wrong and says unsigned int. */
+ size_t version;
+ if (mariadb_get_infov(NULL, MARIADB_CLIENT_VERSION_ID, &version) != 0)
+ version = mysql_get_client_version(); /* On error fallback to mysql_get_client_version() */
+ return version;
+}
+#define mysql_get_client_version() mariadb_get_client_version()
+#endif
+
/* MYSQL_SECURE_AUTH became a no-op from MySQL 5.7.5 and is removed from MySQL 8.0.3 */
#if defined(MARIADB_BASE_VERSION) || MYSQL_VERSION_ID <= 50704
#define HAVE_SECURE_AUTH
--
2.49.0

View File

@ -1,14 +0,0 @@
diff -up DBD-MariaDB-1.21/t/testrules.yml.orig DBD-MariaDB-1.21/t/testrules.yml
--- DBD-MariaDB-1.21/t/testrules.yml.orig 2019-07-03 11:38:30.204870398 +0200
+++ DBD-MariaDB-1.21/t/testrules.yml 2019-07-03 11:38:41.334062976 +0200
@@ -1,4 +1,5 @@
seq:
+ - seq: t/test-setup.t
- seq: t/00base.t
- seq: t/05dbcreate.t
- seq: t/10connect.t
@@ -8,3 +9,4 @@ seq:
- seq: t/rt75353-innodb-lock-timeout.t
- seq: t/rt85919-fetch-lost-connection.t
- par: **
+ - seq: t/test-clean.t

View File

@ -1,13 +0,0 @@
diff -up DBD-MariaDB-1.21/t/45bind_no_backslash_escapes.t.orig DBD-MariaDB-1.21/t/45bind_no_backslash_escapes.t
--- DBD-MariaDB-1.21/t/45bind_no_backslash_escapes.t.orig 2022-02-17 14:00:30.765461191 +0100
+++ DBD-MariaDB-1.21/t/45bind_no_backslash_escapes.t 2022-02-17 14:01:54.388057993 +0100
@@ -19,7 +19,8 @@ if ($dbh->{mariadb_serverversion} < 5000
plan skip_all => "Servers < 5.0.1 do not support sql_mode NO_BACKSLASH_ESCAPES";
}
-if ($dbh->{mariadb_clientversion} < 50001) {
+# As from mariadb-connect-c 3.2.x version number for mariadb_clientversion is 3020x
+if ($dbh->{mariadb_clientversion} < 50001 && $dbh->{mariadb_serverversion} < 50001) {
$id2_quoted_no_backslash = q(X'737472696E675C737472696E6722737472696E6727737472696E67');
}

View File

@ -1,16 +0,0 @@
#!/usr/bin/perl
use strict;
use warnings;
use File::Path;
use Test::More tests => 2;
my $MYSQL_DIR = $ENV{'MYSQL_DIR'};
my $MYSQL_UNIX_PORT = $ENV{'MYSQL_UNIX_PORT'};
my $MYSQL_PIDFILE = $ENV{'MYSQL_PIDFILE'};
ok(system("/usr/bin/mysqladmin --user=root --socket=$MYSQL_UNIX_PORT shutdown 2>&1 || [ ! -s \"$MYSQL_PIDFILE\" ] || /bin/kill `cat \"$MYSQL_PIDFILE\"`") == 0);
my $removed_count = rmtree($MYSQL_DIR, 1, 1);
ok($removed_count > 0);

View File

@ -1,15 +0,0 @@
#!/usr/bin/bash
# MariaDB setup
export MYSQL_DIR=$PWD/t/testdb
export MYSQL_UNIX_PORT=$MYSQL_DIR/mysql.sock
export MYSQL_PIDFILE=$MYSQL_DIR/mysql.pid
export MYSQL_USER=`whoami`
# DBD::MariaDB test setup
export DBD_MARIADB_TESTDB=testdb
export DBD_MARIADB_TESTHOST=localhost
export DBD_MARIADB_TESTSOCKET=$MYSQL_UNIX_PORT
export DBD_MARIADB_TESTUSER=testuser
export DBD_MARIADB_TESTPASSWORD=testpassword

View File

@ -1,55 +0,0 @@
#!/usr/bin/perl
use strict;
use warnings;
use Test::More tests => 7;
# MySQL setup
my $MYSQL_DIR = $ENV{'MYSQL_DIR'};
my $MYSQL_UNIX_PORT = $ENV{'MYSQL_UNIX_PORT'};
my $MYSQL_PIDFILE = $ENV{'MYSQL_PIDFILE'};
my $MYSQL_USER = $ENV{'MYSQL_USER'};
chomp($MYSQL_USER);
# DBD::MariaDB test setup
my $DBD_MARIADB_TESTDB = $ENV{'DBD_MARIADB_TESTDB'};
my $DBD_MARIADB_TESTHOST = $ENV{'DBD_MARIADB_TESTHOST'};
my $DBD_MARIADB_TESTSOCKET = $ENV{'DBD_MARIADB_TESTSOCKET'};
my $DBD_MARIADB_TESTUSER = $ENV{'DBD_MARIADB_TESTUSER'};
my $DBD_MARIADB_TESTPASSWORD = $ENV{'DBD_MARIADB_TESTPASSWORD'};
my $MYSQLD = '';
my $mysql_version = readpipe("mysql --version");
if ($mysql_version =~ /MariaDB/) {
system("mysql_install_db --no-defaults --datadir=$MYSQL_DIR --force --skip-name-resolve --explicit_defaults_for_timestamp >/dev/null 2>&1");
is($?, 0);
$MYSQLD = '/usr/libexec/mysqld';
} else {
$MYSQLD = '/usr/sbin/mysqld';
system("$MYSQLD --no-defaults --initialize-insecure --datadir=$MYSQL_DIR --explicit_defaults_for_timestamp --user=$MYSQL_USER >/dev/null 2>&1");
is($?, 0);
}
my $cmd = "$MYSQLD --no-defaults --user=$MYSQL_USER --socket=$MYSQL_UNIX_PORT --datadir=$MYSQL_DIR --pid-file=$MYSQL_PIDFILE --explicit_defaults_for_timestamp --skip-networking >/dev/null 2>&1 &";
system($cmd);
is($?, 0);
my $attempts = 0;
while (system("/usr/bin/mysqladmin --user=root --socket=$MYSQL_UNIX_PORT ping >/dev/null 2>&1") != 0) {
sleep 3;
$attempts++;
if ($attempts > 10) {
fail("skipping test, mariadb/mysql server could not be contacted after 30 seconds\n");
}
}
ok(1);
system("mysql --socket=$MYSQL_UNIX_PORT --execute \"CREATE USER '$DBD_MARIADB_TESTUSER\@localhost';\" 2>&1");
is($?, 0);
system("mysql --socket=$MYSQL_UNIX_PORT --execute \"CREATE DATABASE IF NOT EXISTS $DBD_MARIADB_TESTDB CHARACTER SET='utf8mb4';\" 2>&1");
is($?, 0);
system("mysql --socket=$MYSQL_UNIX_PORT --execute \"GRANT ALL PRIVILEGES ON $DBD_MARIADB_TESTDB.* TO '$DBD_MARIADB_TESTUSER\@localhost' IDENTIFIED BY '$DBD_MARIADB_TESTPASSWORD';\" 2>&1");
is($?, 0);
system("/usr/bin/mysqladmin --user=$DBD_MARIADB_TESTUSER --password=$DBD_MARIADB_TESTPASSWORD --socket=$DBD_MARIADB_TESTSOCKET ping >/dev/null 2>&1");
is($?, 0);

19
gating.yaml Normal file
View File

@ -0,0 +1,19 @@
# Fedora
--- !Policy
id: fedora_policy
product_versions:
- fedora-*
decision_contexts:
- bodhi_update_push_testing
- bodhi_update_push_stable
subject_type: koji_build
rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}
# RHEL
--- !Policy
product_versions:
- rhel-*
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

View File

@ -7,26 +7,17 @@
%bcond_without perl_DBD_MariaDB_enables_net_ssleay_test %bcond_without perl_DBD_MariaDB_enables_net_ssleay_test
%endif %endif
# mariadb is not built for %%{ix86}
ExcludeArch: %{ix86}
Name: perl-DBD-MariaDB Name: perl-DBD-MariaDB
Version: 1.21 Version: 1.23
Release: 17%{?dist} Release: 10%{?dist}
Summary: MariaDB and MySQL driver for the Perl5 Database Interface (DBI) Summary: MariaDB and MySQL driver for the Perl5 Database Interface (DBI)
License: GPL+ or Artistic License: GPL-1.0-or-later OR Artistic-1.0-Perl
URL: https://metacpan.org/release/DBD-MariaDB/ URL: https://metacpan.org/release/DBD-MariaDB/
Source0: https://cpan.metacpan.org/authors/id/P/PA/PALI/DBD-MariaDB-%{version}.tar.gz Source0: https://cpan.metacpan.org/authors/id/P/PA/PALI/DBD-MariaDB-%{version}.tar.gz
Source1: test-setup.t Source1: test-setup.t
Source2: test-clean.t Source2: test-clean.t
Source3: test-env.sh Source3: test-env.sh
Patch0: DBD-MariaDB-1.21-Run-test-setup-and-clean.patch Patch0: DBD-MariaDB-1.21-Run-test-setup-and-clean.patch
# Fix test for changed value of mariadb_clientversion
# mariadb-connector-c 3.2.x version number changed mariadb_clientversion to 3020x
Patch1: DBD-MariaDB-fix-mariadb-connector-c-32x-test.patch
# Fix mysql_get_client_version() function for MariaDB Connector/C 3.1.10
# and higher, in upstream since 1.22
Patch2: DBD-MariaDB-1.21-Fix-mysql_get_client_version-function.patch
BuildRequires: findutils BuildRequires: findutils
BuildRequires: gcc BuildRequires: gcc
BuildRequires: make BuildRequires: make
@ -49,6 +40,7 @@ BuildRequires: perl(Getopt::Long)
BuildRequires: perl(strict) BuildRequires: perl(strict)
BuildRequires: perl(utf8) BuildRequires: perl(utf8)
BuildRequires: perl(warnings) BuildRequires: perl(warnings)
BuildRequires: sscg
# Tests # Tests
BuildRequires: hostname BuildRequires: hostname
BuildRequires: mariadb BuildRequires: mariadb
@ -77,7 +69,6 @@ BuildRequires: perl(Proc::ProcessTable)
BuildRequires: perl(Storable) BuildRequires: perl(Storable)
%endif %endif
Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
# Filter private modules for tests # Filter private modules for tests
%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}perl\\(lib.pl\\) %global __requires_exclude %{?__requires_exclude:%__requires_exclude|}perl\\(lib.pl\\)
@ -115,10 +106,13 @@ with "%{_libexecdir}/%{name}/test".
%prep %prep
%setup -q -n DBD-MariaDB-%{version} %setup -q -n DBD-MariaDB-%{version}
%patch -P0 -p1 %patch -P0 -p1
%patch -P1 -p1
%patch -P2 -p1
cp %{SOURCE1} %{SOURCE2} t/ cp %{SOURCE1} %{SOURCE2} t/
# Create certificates for tests
mkdir t/certs
sscg --hostname=localhost --ca-mode=0644 --ca-key-mode=0640 --cert-key-mode=0640 --no-dhparams-file
mv ca.crt service-key.pem service.pem t/certs
# Help file to recognise the Perl scripts and normalize shebangs # Help file to recognise the Perl scripts and normalize shebangs
for F in t/*.t t/*.pl; do for F in t/*.t t/*.pl; do
perl -i -MConfig -ple 'print $Config{startperl} if $. == 1 && !s{\A#!.*perl\b}{$Config{startperl}}' "$F" perl -i -MConfig -ple 'print $Config{startperl} if $. == 1 && !s{\A#!.*perl\b}{$Config{startperl}}' "$F"
@ -147,22 +141,33 @@ perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="$RPM_OPT_FLAGS" NO_PACKLIST=1 NO_P
%install %install
%{make_install} %{make_install}
find $RPM_BUILD_ROOT -type f -name '*.bs' -size 0 -delete find %{buildroot} -type f -name '*.bs' -size 0 -delete
%{_fixperms} %{buildroot}/*
# Install tests # Install tests
mkdir -p %{buildroot}%{_libexecdir}/%{name} mkdir -p %{buildroot}%{_libexecdir}/%{name}
cp -a t %{buildroot}%{_libexecdir}/%{name} cp -a t %{buildroot}%{_libexecdir}/%{name}
cp %{SOURCE3} %{buildroot}%{_libexecdir}/%{name} cp %{SOURCE3} %{buildroot}%{_libexecdir}/%{name}
cat > %{buildroot}%{_libexecdir}/%{name}/test << EOF cat > %{buildroot}%{_libexecdir}/%{name}/test << 'EOF'
#!/bin/sh #!/usr/bin/bash
set -e
unset RELEASE_TESTING unset RELEASE_TESTING
. %{_libexecdir}/%{name}/$(basename %{SOURCE3})
cd %{_libexecdir}/%{name} && exec prove -I . # The tests write to temporary database which is placed in $DIR/t/testdb
DIR=$(mktemp -d)
pushd "$DIR"
cp -a %{_libexecdir}/%{name}/* ./
# Load the variables
. $DIR/$(basename %{SOURCE3})
# Run tests
prove -I . -j "$(getconf _NPROCESSORS_ONLN)"
popd
rm -rf "$DIR"
EOF EOF
chmod +x %{buildroot}%{_libexecdir}/%{name}/test chmod +x %{buildroot}%{_libexecdir}/%{name}/test
%{_fixperms} $RPM_BUILD_ROOT/*
%check %check
# Set MariaDB and DBD::MariaDB test environment # Set MariaDB and DBD::MariaDB test environment
. %{SOURCE3} . %{SOURCE3}
@ -173,30 +178,77 @@ make test %{?with_perl_DBD_MariaDB_enables_leak_test:EXTENDED_TESTING=1}
%files %files
%license LICENSE %license LICENSE
%doc Changes Changes.historic %doc Changes Changes.historic
%{perl_vendorarch}/auto/* %{perl_vendorarch}/auto/DBD*
%{perl_vendorarch}/DBD* %{perl_vendorarch}/DBD*
%{_mandir}/man3/* %{_mandir}/man3/DBD::MariaDB*
%files tests %files tests
%{_libexecdir}/%{name} %{_libexecdir}/%{name}
%changelog %changelog
* Wed Apr 02 2025 Jitka Plesnikova <jplesnik@redhat.com> - 1.21-17 * Wed Feb 05 2025 Jitka Plesnikova <jplesnik@redhat.com> - 1.23-10
- Resolves: RHEL-85011 - Resolves: RHEL-66250
- Remove notes about mariadb-connector-c and SSL
* Tue Feb 04 2025 Jitka Plesnikova <jplesnik@redhat.com> - 1.23-9
- Resolves: RHEL-66250
- Updated notes related to the issue
* Tue Jan 28 2025 Jitka Plesnikova <jplesnik@redhat.com> - 1.23-8
- Generate SSL needed for tests since mariadb-connector-c 3.4.x
- Resolves: RHEL-66250
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 1.23-7
- Bump release for October 2024 mass rebuild:
Resolves: RHEL-64018
* Thu Aug 08 2024 Troy Dawson <tdawson@redhat.com> - 1.23-6
- Bump release for Aug 2024 java mass rebuild
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 1.23-5
- Bump release for June 2024 mass rebuild
* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.23-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.23-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Thu Oct 19 2023 Jitka Plesnikova <jplesnik@redhat.com> - 1.23-2
- Replace using mysql by mariadb in setup script
* Mon Sep 11 2023 Jitka Plesnikova <jplesnik@redhat.com> - 1.23-1
- 1.23 bump (rhbz#2238227)
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.22-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Tue Jul 11 2023 Jitka Plesnikova <jplesnik@redhat.com> - 1.22-5
- Perl 5.38 rebuild
* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.22-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.22-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Tue May 31 2022 Jitka Plesnikova <jplesnik@redhat.com> - 1.22-2
- Perl 5.36 rebuild
* Tue Apr 26 2022 Jitka Plesnikova <jplesnik@redhat.com> - 1.22-1
- 1.22 bump
* Thu Feb 17 2022 Jitka Plesnikova <jplesnik@redhat.com> - 1.21-16 * Thu Feb 17 2022 Jitka Plesnikova <jplesnik@redhat.com> - 1.21-16
- Fix test for mariadb-connector-c 3.2.x - Fix test for mariadb-connector-c 3.2.x
* Tue Aug 17 2021 Jitka Plesnikova <jplesnik@redhat.com> - 1.21-15 * Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.21-15
- Related: rhbz#1960259 - Enable gating - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 1.21-14 * Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.21-14
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
Related: rhbz#1991688
* Tue Jun 22 2021 Mohan Boddu <mboddu@redhat.com> - 1.21-13 * Fri May 21 2021 Jitka Plesnikova <jplesnik@redhat.com> - 1.21-13
- Rebuilt for RHEL 9 BETA for openssl 3.0 - Perl 5.34 rebuild
Related: rhbz#1971065
* Tue May 04 2021 Jitka Plesnikova <jplesnik@redhat.com> - 1.21-12 * Tue May 04 2021 Jitka Plesnikova <jplesnik@redhat.com> - 1.21-12
- Update tests - Update tests

12
plans/internal.fmf Normal file
View File

@ -0,0 +1,12 @@
summary: Private (RHEL) beakerlib tests
enabled: false
adjust:
- when: distro == rhel
enabled: true
because: private tests are accesible only within rhel pipline
discover:
- name: rhel
how: fmf
url: https://pkgs.devel.redhat.com/git/tests/perl-DBD-MariaDB
execute:
how: tmt

5
plans/sanity.fmf Normal file
View File

@ -0,0 +1,5 @@
summary: Sanity tests
discover:
how: fmf
execute:
how: tmt

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (DBD-MariaDB-1.23.tar.gz) = 2217f36606caab477b8fa931a69b53b7f706a25cf013e4b62aa1b0b48905aba24b724604b4b99e83dea08d967848119447f35ff8e6b5eb80c7fea4e8c084de16

16
test-clean.t Executable file
View File

@ -0,0 +1,16 @@
#!/usr/bin/perl
use strict;
use warnings;
use File::Path;
use Test::More tests => 2;
my $MARIADB_DIR = $ENV{'MARIADB_DIR'};
my $MARIADB_UNIX_PORT = $ENV{'MARIADB_UNIX_PORT'};
my $MARIADB_PIDFILE = $ENV{'MARIADB_PIDFILE'};
ok(system("mariadb-admin --user=root --socket=$MARIADB_UNIX_PORT shutdown 2>&1 || [ ! -s \"$MARIADB_PIDFILE\" ] || /bin/kill `cat \"$MARIADB_PIDFILE\"`") == 0);
my $removed_count = rmtree($MARIADB_DIR, 1, 1);
ok($removed_count > 0);

16
test-env.sh Executable file
View File

@ -0,0 +1,16 @@
#!/usr/bin/bash
# MariaDB setup
export MARIADB_BASE=$PWD
export MARIADB_DIR=$MARIADB_BASE/t/testdb
export MARIADB_UNIX_PORT=$MARIADB_DIR/mysql.sock
export MARIADB_PIDFILE=$MARIADB_DIR/mysql.pid
export MARIADB_USER=`whoami`
# DBD::MariaDB test setup
export DBD_MARIADB_TESTDB=testdb
export DBD_MARIADB_TESTHOST=localhost
export DBD_MARIADB_TESTSOCKET=$MARIADB_UNIX_PORT
export DBD_MARIADB_TESTUSER=testuser
export DBD_MARIADB_TESTPASSWORD=testpassword

47
test-setup.t Executable file
View File

@ -0,0 +1,47 @@
#!/usr/bin/perl
use strict;
use warnings;
use Test::More tests => 7;
# MySQL setup
my $MARIADB_BASE = $ENV{'MARIADB_BASE'};
my $MARIADB_DIR = $ENV{'MARIADB_DIR'};
my $MARIADB_UNIX_PORT = $ENV{'MARIADB_UNIX_PORT'};
my $MARIADB_PIDFILE = $ENV{'MARIADB_PIDFILE'};
my $MARIADB_USER = $ENV{'MARIADB_USER'};
chomp($MARIADB_USER);
# DBD::MariaDB test setup
my $DBD_MARIADB_TESTDB = $ENV{'DBD_MARIADB_TESTDB'};
my $DBD_MARIADB_TESTHOST = $ENV{'DBD_MARIADB_TESTHOST'};
my $DBD_MARIADB_TESTSOCKET = $ENV{'DBD_MARIADB_TESTSOCKET'};
my $DBD_MARIADB_TESTUSER = $ENV{'DBD_MARIADB_TESTUSER'};
my $DBD_MARIADB_TESTPASSWORD = $ENV{'DBD_MARIADB_TESTPASSWORD'};
system("mariadb-install-db --no-defaults --datadir=$MARIADB_DIR --force --skip-name-resolve --explicit_defaults_for_timestamp >/dev/null 2>&1");
is($?, 0);
my $cmd = "mariadbd-safe --no-defaults --user=$MARIADB_USER --socket=$MARIADB_UNIX_PORT --datadir=$MARIADB_DIR --pid-file=$MARIADB_PIDFILE --ssl_cert=$MARIADB_BASE/t/certs/service.pem --ssl_key=$MARIADB_BASE/t/certs/service-key.pem --ssl_ca=$MARIADB_BASE/t/certs/ca.crt --skip-networking >/dev/null 2>&1 &";
system($cmd);
is($?, 0);
my $attempts = 0;
while (system("mariadb-admin --user=root --socket=$MARIADB_UNIX_PORT ping >/dev/null 2>&1") != 0) {
sleep 3;
$attempts++;
if ($attempts > 10) {
fail("skipping test, mariadb/mysql server could not be contacted after 30 seconds\n");
}
}
ok(1);
system("mariadb --socket=$MARIADB_UNIX_PORT --execute \"CREATE USER '$DBD_MARIADB_TESTUSER\@localhost';\" 2>&1");
is($?, 0);
system("mariadb --socket=$MARIADB_UNIX_PORT --execute \"CREATE DATABASE IF NOT EXISTS $DBD_MARIADB_TESTDB CHARACTER SET='utf8mb4';\" 2>&1");
is($?, 0);
system("mariadb --socket=$MARIADB_UNIX_PORT --execute \"GRANT ALL PRIVILEGES ON $DBD_MARIADB_TESTDB.* TO '$DBD_MARIADB_TESTUSER\@localhost' IDENTIFIED BY '$DBD_MARIADB_TESTPASSWORD';\" 2>&1");
is($?, 0);
system("mariadb-admin --user=$DBD_MARIADB_TESTUSER --password=$DBD_MARIADB_TESTPASSWORD --socket=$DBD_MARIADB_TESTSOCKET ping >/dev/null 2>&1");
is($?, 0);

11
tests/upstream-tests.fmf Normal file
View File

@ -0,0 +1,11 @@
summary: Upstream tests
component: perl-DBD-MariaDB
require: perl-DBD-MariaDB-tests
test: /usr/libexec/perl-DBD-MariaDB/test
enabled: true
tag:
- rhel-buildroot
adjust:
- enabled: false
when: distro < rhel-10 or distro < centos-stream-10
continue: false