Resolves: RHEL-25202 - Add tests

This commit is contained in:
Jitka Plesnikova 2024-03-20 13:51:34 +01:00
parent cdd99b8ca1
commit c99734eec6
9 changed files with 154 additions and 1 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

7
gating.yaml Normal file
View File

@ -0,0 +1,7 @@
--- !Policy
product_versions:
- rhel-*
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}
- !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional}

View File

@ -105,6 +105,9 @@ Provides: perl(Tk) = %{version}
%global __provides_exclude %__provides_exclude|perl\\(Tk::Widget\\)$
%global __provides_exclude %__provides_exclude|perl\\(Tk::Wm\\)$
# Filter modules bundled for tests
%global __provides_exclude_from %{?__provides_exclude_from:%__provides_exclude_from|}^%{_libexecdir}
%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\(TkTest\\)
%description
This a re-port of a perl interface to Tk8.4.
@ -122,13 +125,28 @@ Requires: perl-Tk = %{version}-%{release}
%description devel
%{summary}
%package tests
Summary: Tests for %{name}
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: perl-Test-Harness
# X11 tests:
Requires: xorg-x11-server-Xvfb
Requires: xorg-x11-xinit
Requires: google-noto-sans-fonts
Requires: font(:lang=en)
Requires: liberation-sans-fonts
%description tests
Tests from %{name}. Execute them
with "%{_libexecdir}/%{name}/test".
%prep
%setup -q -n Tk-%{version}
find . -type f -exec %{__perl} -pi -e \
's,^(#!)(/usr/local)?/bin/perl\b,$1%{__perl}, if ($. == 1)' {} \;
chmod -x pod/Popup.pod Tixish/lib/Tk/balArrow.xbm
# fix for widget as docs
%patch0
%patch -P0
%{__perl} -pi -e \
's,\@demopath\@,%{?_pkgdocdir}%{!?_pkgdocdir:%{_docdir}/%{name}-%{version}}/demos,g' demos/widget
# debian patch
@ -136,6 +154,12 @@ chmod -x pod/Popup.pod Tixish/lib/Tk/balArrow.xbm
# patch to fix #235666 ... seems like caching code is broken
%patch -P2 -p1 -b .seg
# 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 X11LIB=%{_libdir} XFT=1
find . -name Makefile | xargs %{__perl} -pi -e 's/^\tLD_RUN_PATH=[^\s]+\s*/\t/'
@ -158,6 +182,28 @@ mkdir __demos
cp -pR $RPM_BUILD_ROOT%{perl_vendorarch}/Tk/demos __demos
find __demos/ -type f -exec chmod -x {} \;
# Install tests
mkdir -p %{buildroot}%{_libexecdir}/%{name}
cp -a t %{buildroot}%{_libexecdir}/%{name}
rm %{buildroot}%{_libexecdir}/%{name}/t/pod.t
mkdir -p %{buildroot}%{_libexecdir}/%{name}/demos/demos/images
cp demos/demos/images/cursor* %{buildroot}%{_libexecdir}/%{name}/demos/demos/images
perl -i -pe 's{-Mblib", "blib/script}{%{_bindir}}' %{buildroot}%{_libexecdir}/%{name}/t/exefiles.t
perl -i -ne 'print $_ unless m{gedi}' %{buildroot}%{_libexecdir}/%{name}/t/exefiles.t
cat > %{buildroot}%{_libexecdir}/%{name}/test << 'EOF'
#!/bin/bash
set -e
# Some tests write into temporary files/directories
DIR=$(mktemp -d)
pushd "$DIR"
cp -a %{_libexecdir}/%{name}/* ./
xvfb-run -d prove -I . -j "$(getconf _NPROCESSORS_ONLN)"
popd
rm -rf "$DIR"
EOF
chmod +x %{buildroot}%{_libexecdir}/%{name}/test
%files
%doc Changes README README.linux ToDo pTk/*license* __demos/demos demos/widget COPYING
%doc blib/man1/widget.1
@ -180,10 +226,13 @@ find __demos/ -type f -exec chmod -x {} \;
%{perl_vendorarch}/Tk/install.pm
%{perl_vendorarch}/Tk/MakeDepend.pm
%files tests
%{_libexecdir}/%{name}
%changelog
* Wed Mar 13 2024 Jitka Plesnikova <jplesnik@redhat.com> - 804.035-8
- Enable building with FreeType support
- Package tests
- Resolves: RHEL-25202
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 804.035-7

5
plans/sanity.fmf Normal file
View File

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

View File

@ -0,0 +1,23 @@
summary: Verify if FreeType support is enabled
contact: Jitka Plesnikova <jplesnik@redhat.com>
component:
- perl-Tk
require:
- liberation-sans-fonts
- google-noto-sans-fonts
- perl-interpreter
- perl-Tk
- tk
- xorg-x11-server-Xvfb
test: ./test.sh
framework: beakerlib
enabled: true
tag:
- rhel-buildroot
- TestCaseCopy
- Tier1
tier: '1'
adjust:
- enabled: false
when: distro < rhel-8 or distro < centos-stream-8
continue: false

View File

@ -0,0 +1,40 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
. /usr/share/beakerlib/beakerlib.sh || exit 1
SLEEP_TIME="5"
rlJournalStart
rlPhaseStartSetup
rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory"
rlRun "cp tk-test.sh tk-test.pl $tmp"
rlRun "pushd $tmp"
rlPhaseEnd
rlPhaseStartTest
# Get output from tcl/Tk test script
rlVirtualXStart "tk1"
export DISPLAY="$( rlVirtualXGetDisplay \"tk1\" )"
rlRun "./tk-test.sh > tcl-output.log &" 0 "Running tcl/Tk test script'"
PS_TK1="$!"
rlRun "sleep $SLEEP_TIME" 0 "Sleeping for $SLEEP_TIME s"
rlRun "kill -9 $PS_TK1" 0,1 "Killing Tk"
rlVirtualXStop "tk1"
# Get output from perl-Tk test script
rlVirtualXStart "tk2"
export DISPLAY="$( rlVirtualXGetDisplay \"tk2\" )"
rlRun "./tk-test.pl > perl-output.log &" 0 "Running perl-Tk test script'"
PS_TK2="$!"
rlRun "sleep $SLEEP_TIME" 0 "Sleeping for $SLEEP_TIME s"
rlRun "kill -9 $PS_TK2" 0,1 "Killing Tk"
rlVirtualXStop "tk2"
rlAssertNotDiffer "tcl-output.log" "perl-output.log"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $tmp" 0 "Remove tmp directory"
rlPhaseEnd
rlJournalEnd

View File

@ -0,0 +1,6 @@
#!/usr/bin/perl
use Tk;
my $mw = MainWindow->new;
foreach my $font (sort $mw->fontFamilies)
{ print "$font\n"; }

View File

@ -0,0 +1,6 @@
#!/usr/bin/tclsh
package require Tk
foreach font [lsort [font families]] {
puts $font
}

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

@ -0,0 +1,16 @@
summary: Upstream tests
contact: Jitka Plesnikova <jplesnik@redhat.com>
component: perl-Tk
require:
- perl-Tk-tests
test: /usr/libexec/perl-Tk/test
enabled: true
tag:
- rhel-buildroot
- TestCaseCopy
- Tier1
tier: '1'
adjust:
- enabled: false
when: distro < rhel-9 or distro < centos-stream-9
continue: false