[Fedora-packaging] %check script issues
Ville Skyttä
ville.skytta at iki.fi
Mon Jun 27 17:45:42 UTC 2005
On Mon, 2005-06-27 at 01:59 +0300, Marius Feraru wrote:
> The hack suggested in [3] ("%check || :" _after_ %install) and the
> testing done determined that this %check is done after %install (sort of
> "%__spec_install_post").
>
> So, here come my issues:
> a) Maybe I really don't get it (reading [2] again and again), but it
> seems more appropiate to append this %check to %build (or even prepend
> it to %install), but I see no point for doing it _after_ %install.
The Max-RPM hack suggests placing "%check || :" after %install, because
that's the order rpmbuild >= 4.2 also runs the two in, no matter what
their order is in the specfile.
Off the cuff, I guess that the install-before-check order is because
non-well-behaving test suites may modify/add/remove files in the build
root which can affect what files get installed by the %install section.
Which is obviously not acceptable.
Can you come up with a generic case where running the test suite before
doing the staged install would be useful? I cannot at the moment.
> b) What is the "easy" way to disable %check? "--define 'check exit 0'"
> doesn't sound as "easy" as e.g. "--without check".
Right, but it doesn't have to be easy :) Just make it a habit to
disable the test suite only when _absolutely_ necessary. In those rare
cases, the --define way should not be too "hard", and keeps the specfile
(very) slightly more readable.
If a test suite of a package does or requires something that is not
appropriate (taking into account all situations where it might be run
in, generic/minimal build roots and personal workstations or desktops
etc.), report a bug against the package.
> Ok, b) is more like a rant or something, but a) bothers me a lot. Before
> knowing about this %check, I was adding a %{!?_without_test:make test}
> to the %build script and this seems good enough for me. Why should I
> "upgrade" to using this %check script?
Mileages vary, but I'd suggest at least running the test suite after
%install, no matter what way you choose. Also, conditionalizing the
build on a "--without test" or the like will obviously work only for
that particular package, whereas "--define 'check exit 0'" should work
for all packages that use %check, which are the majority already of ones
that run test suites in the first place.
Personally, I usually use the %check section just as is. In cases the
test suite requires or does something inappropriate, I just write the
"make test" and friends in the %check section, but comment them out
along with a note stating why. Or add a "--with tests" flag that
enables the test suite if it can be configured properly in the build
root, but I don't remember ever adding a "--without tests" flag, nor
using "--define 'check exit 0'", nor do I plan to do either :)
More information about the packaging
mailing list