Test RPM dependency generators for rubygems.

Add tests for RPM dependency generators that execute during build.
The tests make use of methods available in tools present in the
upstream ruby tar archive to find and set up the ruby executable.
This is then used to execute the dependency generator script with
a given test input passed into the subprocess and collect the output
given out by the generator for testing.

Skip "test_generator_on_gem_with_multiple_conflict_constraints" for
now. rubygems.req is currently only capable of filtering out a single
conflict requirement that is specified on a given dependency.

Execute it in the %check section before the long-running
Ruby test suite starts. If testing the generators fails it means there
is the possibility of generating bogus requires,
which is a valuable information to get sooner rather than later.
This commit is contained in:
Jarek Prokop 2023-12-20 10:06:40 +01:00 committed by vondruch
commit 2e6762df8d
5 changed files with 567 additions and 0 deletions

View file

@ -230,6 +230,11 @@ Source13: test_abrt.rb
Source14: test_systemtap.rb
# Ruby OpenSSL FIPS tests.
Source15: test_openssl_fips.rb
# RPM gem Requires dependency generator tests.
Source16: rpm_test_helper.rb
Source17: test_rubygems_req.rb
Source18: test_rubygems_prov.rb
Source19: test_rubygems_con.rb
# The load directive is supported since RPM 4.12, i.e. F21+. The build process
# fails on older Fedoras.
@ -1134,6 +1139,21 @@ ln -sfr probes.d %{_vpath_builddir}/
make -C %{_vpath_builddir} runruby TESTRUN_SCRIPT=%{SOURCE14}
%endif
# Test dependency generators for RPM
GENERATOR_SCRIPT="%{SOURCE9}" \
make -C %{_vpath_builddir} runruby TESTRUN_SCRIPT=" \
-I%{_builddir}/%{buildsubdir}/tool/lib -I%{_sourcedir} --enable-gems \
%{SOURCE17} --verbose"
GENERATOR_SCRIPT="%{SOURCE10}" \
make -C %{_vpath_builddir} runruby TESTRUN_SCRIPT=" \
-I%{_builddir}/%{buildsubdir}/tool/lib -I%{_sourcedir} --enable-gems \
%{SOURCE18} --verbose"
GENERATOR_SCRIPT="%{SOURCE11}" \
make -C %{_vpath_builddir} runruby TESTRUN_SCRIPT=" \
-I%{_builddir}/%{buildsubdir}/tool/lib -I%{_sourcedir} --enable-gems \
%{SOURCE19} --verbose"
DISABLE_TESTS=""
MSPECOPTS=""