Add some SIGPIPE test cases
Test for SIGPIPE behavior in three different cases: - build scriptlets ought to have SIGPIPE working as usual (RhBug:651463) - SIGPIPE received from install scriptlet (RhBug:1264198) which currently fails because we end up exiting on that signal after the transaction. The original case involves file triggers, we simulate it by kill'ing for simplicitys sake. - query involving --pipe (RhBug:444389) Should test for RhBug:471591 too but need a simpler reproducer than in the bug, leaving that to some rainy day.
This commit is contained in:
parent
6278fcfb39
commit
5e51d2bf70
|
@ -31,6 +31,7 @@ TESTSUITE_AT += rpmpython.at
|
|||
TESTSUITE_AT += rpmdepmatch.at
|
||||
TESTSUITE_AT += rpmscript.at
|
||||
TESTSUITE_AT += rpmsigdig.at
|
||||
TESTSUITE_AT += rpmio.at
|
||||
EXTRA_DIST += $(TESTSUITE_AT)
|
||||
|
||||
## testsuite data
|
||||
|
@ -60,6 +61,7 @@ EXTRA_DIST += data/SPECS/triggers.spec
|
|||
EXTRA_DIST += data/SPECS/filetriggers.spec
|
||||
EXTRA_DIST += data/SPECS/prefixtest.spec
|
||||
EXTRA_DIST += data/SPECS/testdoc.spec
|
||||
EXTRA_DIST += data/SPECS/sigpipe.spec
|
||||
EXTRA_DIST += data/SOURCES/hello-1.0-modernize.patch
|
||||
EXTRA_DIST += data/SOURCES/hello-1.0.tar.gz
|
||||
EXTRA_DIST += data/SOURCES/hello-2.0.tar.gz
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
%bcond_with buildpipe
|
||||
%bcond_with manyfiles
|
||||
|
||||
Name: sigpipe
|
||||
Version: 1.0
|
||||
Release: 1%{?dist}
|
||||
Summary: Testing SIGPIPE behavior
|
||||
|
||||
Group: Testing
|
||||
License: GPLv2
|
||||
BuildArch: noarch
|
||||
|
||||
%description
|
||||
%{summary}
|
||||
%end
|
||||
|
||||
%define datadir /opt/%{name}/data
|
||||
|
||||
# Reproducer for https://bugzilla.redhat.com/show_bug.cgi?id=651463
|
||||
%if %{with buildpipe}
|
||||
%prep
|
||||
bash -c 's=$SECONDS
|
||||
set -o pipefail
|
||||
for ((i=0; i < 30; i++))
|
||||
do printf hello 2>/dev/null
|
||||
sleep .1
|
||||
done | /bin/sleep 1
|
||||
(( (SECONDS-s) < 2 )) || exit 1'
|
||||
%endif
|
||||
|
||||
%install
|
||||
mkdir -p %{buildroot}/%{datadir}
|
||||
%if %{with manyfiles}
|
||||
for i in {1..32}; do
|
||||
mkdir %{buildroot}/%{datadir}/${i}
|
||||
for j in {a..z}; do
|
||||
touch %{buildroot}/%{datadir}/${i}/${j}
|
||||
done
|
||||
done
|
||||
%endif
|
||||
|
||||
# For simulating https://bugzilla.redhat.com/show_bug.cgi?id=1264198
|
||||
%post
|
||||
kill -PIPE ${PPID}
|
||||
|
||||
%files
|
||||
%{datadir}
|
|
@ -0,0 +1,50 @@
|
|||
# rpmio.at: Misc (librpm)io tests
|
||||
|
||||
AT_BANNER([I/O])
|
||||
|
||||
AT_SETUP([SIGPIPE from --pipe])
|
||||
AT_KEYWORDS([signals])
|
||||
AT_CHECK([
|
||||
RPMDB_CLEAR
|
||||
RPMDB_INIT
|
||||
|
||||
runroot rpmbuild --quiet --with manyfiles -bb /data/SPECS/sigpipe.spec
|
||||
runroot rpm -qpl /build/RPMS/noarch/sigpipe-1.0-1.noarch.rpm --pipe "cat" | head -1
|
||||
],
|
||||
[0],
|
||||
[/opt/sigpipe/data
|
||||
],
|
||||
[])
|
||||
AT_CLEANUP
|
||||
|
||||
AT_SETUP([SIGPIPE from install scriptlet])
|
||||
AT_KEYWORDS([signals])
|
||||
# This incorrectly exists with code 141 due to SIGPIPE from scriptlet
|
||||
AT_XFAIL_IF([test $RPM_XFAIL -ne 0])
|
||||
AT_CHECK([
|
||||
RPMDB_CLEAR
|
||||
RPMDB_INIT
|
||||
|
||||
runroot rpmbuild --quiet -bb /data/SPECS/sigpipe.spec
|
||||
runroot rpm -U --nodeps /build/RPMS/noarch/sigpipe-1.0-1.noarch.rpm
|
||||
],
|
||||
[0],
|
||||
[],
|
||||
[])
|
||||
AT_CLEANUP
|
||||
|
||||
# XXX TODO: test for RhBug:471591 too, but needs a simpler reproducer
|
||||
|
||||
AT_SETUP([SIGPIPE in build scriptlet])
|
||||
AT_KEYWORDS([signals])
|
||||
AT_CHECK([
|
||||
RPMDB_CLEAR
|
||||
RPMDB_INIT
|
||||
|
||||
run rpmbuild --quiet --with buildpipe -bb "${RPMDATA}/SPECS/sigpipe.spec"
|
||||
],
|
||||
[0],
|
||||
[],
|
||||
[])
|
||||
AT_CLEANUP
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
m4_include([rpmgeneral.at])
|
||||
m4_include([rpmio.at])
|
||||
m4_include([rpmquery.at])
|
||||
m4_include([rpmverify.at])
|
||||
m4_include([rpmsigdig.at])
|
||||
|
|
Loading…
Reference in New Issue