From b73beed81097fb3ac44f938dd3c3767a5a75fee3 Mon Sep 17 00:00:00 2001 From: Jitka Plesnikova Date: Thu, 13 Mar 2025 13:06:28 +0100 Subject: [PATCH] Resolves: RHEL-53861, RHEL-77083 - Updated to 4.053 which contains several bugfixes - Updated check for SSL connection - Enabled testing --- .fmf/version | 1 + .gitignore | 2 ++ gating.yaml | 19 +++++++++++++ perl-DBD-MySQL.spec | 65 ++++++++++++++++++++++++++++++++++++--------- plans/internal.fmf | 12 +++++++++ sources | 2 +- test-clean.t | 16 +++++++++++ test-env.sh | 14 ++++++++++ test-setup.t | 51 +++++++++++++++++++++++++++++++++++ testrules.yml | 11 ++++++++ 10 files changed, 180 insertions(+), 13 deletions(-) create mode 100644 .fmf/version create mode 100644 gating.yaml create mode 100644 plans/internal.fmf create mode 100755 test-clean.t create mode 100755 test-env.sh create mode 100755 test-setup.t create mode 100644 testrules.yml diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/.gitignore b/.gitignore index 8d46690..8800175 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,5 @@ DBD-mysql-4.017.tar.gz /DBD-mysql-4.048.tar.gz /DBD-mysql-4.049.tar.gz /DBD-mysql-4.050.tar.gz +/DBD-mysql-4.052.tar.gz +/DBD-mysql-4.053.tar.gz diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..da7481a --- /dev/null +++ b/gating.yaml @@ -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} diff --git a/perl-DBD-MySQL.spec b/perl-DBD-MySQL.spec index d3f244e..77ad89b 100644 --- a/perl-DBD-MySQL.spec +++ b/perl-DBD-MySQL.spec @@ -1,30 +1,33 @@ +# mysql is not available on ix86 +ExcludeArch: %{ix86} + Name: perl-DBD-MySQL -Version: 4.050 -Release: 13%{?dist} +Version: 4.053 +Release: 1%{?dist} Summary: A MySQL interface for Perl License: GPL+ or Artistic URL: https://metacpan.org/release/DBD-mysql Source0: https://cpan.metacpan.org/authors/id/D/DV/DVEEDEN/DBD-mysql-%{version}.tar.gz +Source1: test-setup.t +Source2: test-clean.t +Source3: testrules.yml +Source4: test-env.sh # Remove a useless shebang, bug #1813195, # Patch0: DBD-mysql-4.050-Remove-a-useless-shebang-from-DBD-mysql.patch -BuildRequires: make BuildRequires: coreutils BuildRequires: findutils BuildRequires: gcc -BuildRequires: mariadb-connector-c -BuildRequires: mariadb-connector-c-devel +BuildRequires: make +BuildRequires: mysql-devel BuildRequires: openssl-devel BuildRequires: perl-devel BuildRequires: perl-generators BuildRequires: perl-interpreter -BuildRequires: perl(Carp) BuildRequires: perl(Config) BuildRequires: perl(Data::Dumper) -BuildRequires: perl(DBI) >= 1.609 BuildRequires: perl(DBI::DBD) BuildRequires: perl(Devel::CheckLib) >= 1.09 -BuildRequires: perl(DynaLoader) BuildRequires: perl(ExtUtils::MakeMaker) >= 6.76 BuildRequires: perl(File::Basename) BuildRequires: perl(File::Copy) @@ -35,6 +38,26 @@ BuildRequires: perl(strict) BuildRequires: perl(utf8) BuildRequires: perl(warnings) BuildRequires: zlib-devel +# Run-time +BuildRequires: perl(Carp) +BuildRequires: perl(DBI) >= 1.609 +BuildRequires: perl(DBI::Const::GetInfoType) +BuildRequires: perl(DynaLoader) +%ifnarch %{ix86} +# Tests +BuildRequires: mysql +BuildRequires: mysql-server +BuildRequires: perl(B) +BuildRequires: perl(bigint) +# Required to process t/testrules.yml +BuildRequires: perl(CPAN::Meta::YAML) +BuildRequires: perl(Encode) +BuildRequires: perl(lib) +BuildRequires: perl(Test::Deep) +BuildRequires: perl(Test::More) +BuildRequires: perl(Time::HiRes) +BuildRequires: perl(vars) +%endif Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version)) Provides: perl-DBD-mysql = %{version}-%{release} @@ -48,14 +71,23 @@ management system. %prep %setup -q -n DBD-mysql-%{version} -%patch0 -p1 +%patch -P0 -p1 # Correct file permissions find . -type f | xargs chmod -x +cp %{SOURCE1} %{SOURCE2} %{SOURCE3} t/ +cp %{SOURCE4} . + %build +. %{SOURCE4} perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}" \ - NO_PACKLIST=1 NO_PERLLOCAL=1 + NO_PACKLIST=1 NO_PERLLOCAL=1 \ + --testdb=$DBD_MYSQL_TESTDB \ + --testuser=$DBD_MYSQL_TESTUSER \ + --testpassword=$DBD_MYSQL_TESTPASSWORD \ + --testhost=$DBD_MYSQL_TESTHOST \ + --testsocket=$DBD_MYSQL_TESTSOCKET %{make_build} %install @@ -64,8 +96,12 @@ find %{buildroot} -type f -name '*.bs' -empty -delete %{_fixperms} %{buildroot}/* %check -# Full test coverage requires a live MySQL database -#make test +# Set MySQL and DBD::mysql test environment +%ifnarch %{ix86} +. %{SOURCE4} +unset RELEASE_TESTING +make test %{?with_perl_DBD_MySQL_enables_leak_test:EXTENDED_TESTING=1} +%endif %files %license LICENSE @@ -76,6 +112,11 @@ find %{buildroot} -type f -name '*.bs' -empty -delete %{_mandir}/man3/*.3* %changelog +* Thu Mar 13 2025 Jitka Plesnikova - 4.053-1 +- Resolves: RHEL-53861, RHEL-77083 +- Update check for SSL connection +- Enable testing + * Mon Aug 09 2021 Mohan Boddu - 4.050-13 - Rebuilt for IMA sigs, glibc 2.34, aarch64 flags Related: rhbz#1991688 diff --git a/plans/internal.fmf b/plans/internal.fmf new file mode 100644 index 0000000..68e7d08 --- /dev/null +++ b/plans/internal.fmf @@ -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-MySQL +execute: + how: tmt diff --git a/sources b/sources index 8cfecdf..c31b21e 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (DBD-mysql-4.050.tar.gz) = 910f5b4ba7a7890d50a79f37d04ec8971a4f62acd0fe30bf3ab634f66e3128f0cd6513e5c9da8c807a0f4477d0cc766682ea8dd0d8072d02821b78df51f37879 +SHA512 (DBD-mysql-4.053.tar.gz) = 066d9b4e748b52b2427b78babb5176a92fd3285695710139e4c9529e7e9dff19dc12aef2d8f616fa4a9065867bc5bcc517f8f29f84190956b4c2e06defae62b6 diff --git a/test-clean.t b/test-clean.t new file mode 100755 index 0000000..a8c52df --- /dev/null +++ b/test-clean.t @@ -0,0 +1,16 @@ +#!/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); + diff --git a/test-env.sh b/test-env.sh new file mode 100755 index 0000000..7913c4d --- /dev/null +++ b/test-env.sh @@ -0,0 +1,14 @@ +#!/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 + +# DBD::mysql test setup +export DBD_MYSQL_TESTDB=test +export DBD_MYSQL_TESTHOST=localhost +export DBD_MYSQL_TESTSOCKET=$MYSQL_UNIX_PORT +export DBD_MYSQL_TESTUSER=testuserdbd +export DBD_MYSQL_TESTPASSWORD=testpasswordDBD + diff --git a/test-setup.t b/test-setup.t new file mode 100755 index 0000000..6f4fa55 --- /dev/null +++ b/test-setup.t @@ -0,0 +1,51 @@ +#!/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'}; + +# DBD::MariaDB test setup +my $DBD_MYSQL_TESTDB = $ENV{'DBD_MYSQL_TESTDB'}; +my $DBD_MYSQL_TESTHOST = $ENV{'DBD_MYSQL_TESTHOST'}; +my $DBD_MYSQL_TESTSOCKET = $ENV{'DBD_MYSQL_TESTSOCKET'}; +my $DBD_MYSQL_TESTUSER = $ENV{'DBD_MYSQL_TESTUSER'}; +my $DBD_MYSQL_TESTPASSWORD = $ENV{'DBD_MYSQL_TESTPASSWORD'}; + +my $MYSQLD = '/usr/sbin/mysqld'; +# Initialize MySQL data directory +system("$MYSQLD --no-defaults --initialize-insecure --user=mysql --datadir=$MYSQL_DIR >/dev/null 2>&1"); +is($?, 0); + +# Starting the server +my $cmd = "$MYSQLD --no-defaults --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 --socket=$MYSQL_UNIX_PORT ping >/dev/null 2>&1") != 0) { + sleep 3; + $attempts++; + if ($attempts > 10) { + fail("skipping test, mysql server could not be contacted after 30 seconds\n"); + } +} +ok(1); + +# Create database +system("mysql -u root --skip-password --execute \"CREATE DATABASE IF NOT EXISTS $DBD_MYSQL_TESTDB CHARACTER SET='utf8mb4';\" 2>&1"); +is($?, 0); + +# The test user has to have the proper privileges that these tests require +system("mysql -u root --skip-password --execute \"CREATE USER '$DBD_MYSQL_TESTUSER'\@'localhost' IDENTIFIED BY '$DBD_MYSQL_TESTPASSWORD'; \" 2>&1"); +is($?, 0); +system("mysql -u root --skip-password --execute \"GRANT ALL PRIVILEGES ON $DBD_MYSQL_TESTDB.* TO '$DBD_MYSQL_TESTUSER'\@'localhost';\" 2>&1"); +is($?, 0); + +system("/usr/bin/mysqladmin --user=$DBD_MYSQL_TESTUSER --password=$DBD_MYSQL_TESTPASSWORD --socket=$DBD_MYSQL_TESTSOCKET ping >/dev/null 2>&1"); +is($?, 0); diff --git a/testrules.yml b/testrules.yml new file mode 100644 index 0000000..b03a5b6 --- /dev/null +++ b/testrules.yml @@ -0,0 +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: + - par: ** + - seq: t/test-clean.t