public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/perl-SQL-Translator] epel10: Package tests
@ 2026-08-07 12:46 Jitka Plesnikova
  0 siblings, 0 replies; only message in thread
From: Jitka Plesnikova @ 2026-08-07 12:46 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/perl-SQL-Translator
Branch : epel10
Commit : 5611f4dcb8a1860d3bbb06788f4b27880cd32951
Author : Jitka Plesnikova <jplesnik@redhat.com>
Date   : 2023-02-27T15:14:42+01:00
Stats  : +60/-0 in 5 file(s)
URL    : https://src.fedoraproject.org/rpms/perl-SQL-Translator/c/5611f4dcb8a1860d3bbb06788f4b27880cd32951?branch=epel10

Log:
Package tests

---
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/gating.yaml b/gating.yaml
new file mode 100644
index 0000000..282e16b
--- /dev/null
+++ b/gating.yaml
@@ -0,0 +1,7 @@
+--- !Policy
+product_versions:
+  - fedora-*
+decision_context: bodhi_update_push_stable
+subject_type: koji_build
+rules:
+  - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}

diff --git a/perl-SQL-Translator.spec b/perl-SQL-Translator.spec
index 9628fcf..a7dad94 100644
--- a/perl-SQL-Translator.spec
+++ b/perl-SQL-Translator.spec
@@ -110,6 +110,8 @@ Requires:       perl(XML::Writer) >= 0.500
 # Remove badly detected requires (a grammar in the
 # lib/SQL/Translator/Parser/Sybase.pm)
 %global __requires_exclude %{__requires_exclude}|^perl\\(:\\)
+# Filter modules bundled for tests
+%global __provides_exclude_from %{?__provides_exclude_from:%__provides_exclude_from|}^%{_libexecdir}
 
 %description
 SQL::Translator is a group of Perl modules that converts vendor-specific
@@ -145,6 +147,17 @@ The sqlt-graph tool from %{name} that can automatically create a graph
 from a database schema. Packaged separately to avoid the main package
 depending on Graphviz.
 
+%package tests
+Summary:        Tests for %{name}
+Requires:       %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
+Requires:       perl-Test-Harness
+Requires:       perl(DBD::SQLite)
+Requires:       perl(XML::Parser)
+
+%description tests
+Tests from %{name}. Execute them
+with "%{_libexecdir}/%{name}/test".
+
 %prep
 %setup -q -n SQL-Translator-%{version}
 # Fix shell-bangs
@@ -156,6 +169,11 @@ chmod -x lib/SQL/Translator/Parser/JSON.pm
 rm lib/SQL/Translator/Parser/Excel.pm
 perl -i -ne 'print $_ unless m{^lib/SQL/Translator/Parser/Excel\.pm}' MANIFEST
 %endif
+# Help generators to recognize Perl scripts
+for F in t/*.t; do
+    perl -i -MConfig -ple 'print $Config{startperl} if $. == 1 && !s{\A#!.*perl\b}{$Config{startperl}}' "$F"
+    chmod +x "$F"
+done
 
 %build
 perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}" NO_PACKLIST=1 NO_PERLLOCAL=1
@@ -164,8 +182,29 @@ perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}" NO_PACKLIST=1 NO_PERL
 %install
 %{make_install}
 %{_fixperms} %{buildroot}/*
+# Install tests
+mkdir -p %{buildroot}%{_libexecdir}/%{name}
+cp -a t %{buildroot}%{_libexecdir}/%{name}
+mkdir -p %{buildroot}%{_libexecdir}/%{name}/script
+for F in sqlt sqlt.cgi sqlt-diagram sqlt-diff sqlt-diff-old sqlt-dumper sqlt-graph; do
+    ln -s %{_bindir}/$F %{buildroot}%{_libexecdir}/%{name}/script
+done
+cat > %{buildroot}%{_libexecdir}/%{name}/test << 'EOF'
+#!/bin/bash
+set -e
+# Some tests write into temporary files/directories. The easiest solution
+# is to copy the tests into a writable directory and execute them from there.
+DIR=$(mktemp -d)
+pushd "$DIR"
+cp -a %{_libexecdir}/%{name}/* ./
+prove -I . -j "$(getconf _NPROCESSORS_ONLN)"
+popd
+rm -rf "$DIR"
+EOF
+chmod +x %{buildroot}%{_libexecdir}/%{name}/test
 
 %check
+export HARNESS_OPTIONS=j$(perl -e 'if ($ARGV[0] =~ /.*-j([0-9][0-9]*).*/) {print $1} else {print 1}' -- '%{?_smp_mflags}')
 make test
 
 %files
@@ -192,9 +231,13 @@ make test
 %{_bindir}/sqlt-graph
 %{_mandir}/man1/sqlt-graph.*
 
+%files tests
+%{_libexecdir}/%{name}
+
 %changelog
 * Mon Feb 27 2023 Jitka Plesnikova <jplesnik@redhat.com> - 1.63-1
 - 1.63 bump
+- Package tests
 
 * Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.62-9
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

diff --git a/plans/sanity.fmf b/plans/sanity.fmf
new file mode 100644
index 0000000..a72ded4
--- /dev/null
+++ b/plans/sanity.fmf
@@ -0,0 +1,5 @@
+summary: Sanity tests
+discover:
+    how: fmf
+execute:
+    how: tmt

diff --git a/tests/upstream-tests.fmf b/tests/upstream-tests.fmf
new file mode 100644
index 0000000..db6a959
--- /dev/null
+++ b/tests/upstream-tests.fmf
@@ -0,0 +1,4 @@
+summary: Upstream tests
+component: perl-SQL-Translator
+require: perl-SQL-Translator-tests
+test: /usr/libexec/perl-SQL-Translator/test

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-07 12:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-07 12:46 [rpms/perl-SQL-Translator] epel10: Package tests Jitka Plesnikova

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox