Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 517976 - virtualx.eclass: virtualmake runs VIRTUALX_COMMAND with nonfatal
Summary: virtualx.eclass: virtualmake runs VIRTUALX_COMMAND with nonfatal
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo X packagers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: bad-nonfatal
  Show dependency tree
 
Reported: 2014-07-24 13:20 UTC by Michael Palimaka (kensington)
Modified: 2015-12-07 12:33 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Palimaka (kensington) gentoo-dev 2014-07-24 13:20:17 UTC
>>> Test phase [QtTest]: dev-qt/qtserialport-5.3.1

...

0% tests passed, 1 tests failed out of 1

Total Test time (real) =   0.50 sec

The following tests FAILED:
          1 - module_includes (Failed)
Errors while running CTest
make[1]: *** [check] Error 8
make[1]: Leaving directory `/var/tmp/portage/dev-qt/qtserialport-5.3.1/work/qtserialport-opensource-src-5.3.1/tests/auto/cmake'
make: *** [sub-cmake-check] Error 2
 * __helpers_die: WARNING: emake failed
Unable to unshare: EINVAL

>>> Install qtserialport-5.3.1 into /var/tmp/portage/dev-qt/qtserialport-5.3.1/image/ category dev-qt
Comment 1 Davide Pesavento gentoo-dev 2014-07-26 12:36:32 UTC
virtualmake runs VIRTUALX_COMMAND with nonfatal (depending on the EAPI), thus the failing 'emake check' doesn't die but just prints the warning, and qt5_foreach_target_subdir keeps going. At the end, the last executed command will be a popd which will succeed and return 0 to virtualmake, which in turn will think everything's fine and won't die.

Maybe virtualx.eclass should use EBUILD_DEATH_HOOKS instead of nonfatal?
CC'ing eclass maintainers for their opinion.
Comment 2 Davide Pesavento gentoo-dev 2014-07-26 12:49:15 UTC
In the meantime I've committed a (temporary?) workaround (also incomplete since it ignores mkdir and pushd/popd failures)
https://git.overlays.gentoo.org/gitweb/?p=proj/qt.git;a=commitdiff;h=dc15981d63addb5cf8e7c942fec6590f018a32f8

@kensington: please let me know if it works for you, i.e. if it dies.
Comment 3 Michael Palimaka (kensington) gentoo-dev 2014-07-26 17:34:02 UTC
Thanks, the package I was working with dies correctly now.
Comment 4 Davide Pesavento gentoo-dev 2014-07-28 00:33:27 UTC
I'm reassigning to x11@ then, in case they want to consider moving away from nonfatal (I hope so). I suggest to at least improve virtualmake documentation, mentioning this behavior.
Comment 5 Justin Lecher (RETIRED) gentoo-dev 2015-12-01 07:30:36 UTC
I see it correctly then the problem here is

starting virt X
   starting tests
       foreach test
           test run

when the test now fails, the whole testsuite wouldn't stop as we are running everything with nonfatal, right?

The reason for this is cleaning up the Xfvb session after the test run. If the tests would die normally the build process would be killed before we can clean up the Xfvb process. That why we run nonfatal and record the return code. You need to handle and pass the return code yourself up the the eclass function.
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2015-12-01 07:54:54 UTC
Let's keep this short.

We need to clean up, ergo we need to be nonfatal. Which means:

1. You can't call 'die' except for EAPI 6 'die -n'.

2. Every potentially fatal command needs '|| return' since 'die' won't terminate it.

Hope this short reminder of ebuild 1-2-3 helps.
Comment 7 Davide Pesavento gentoo-dev 2015-12-01 14:13:16 UTC
(In reply to Justin Lecher from comment #5)
> I see it correctly then the problem here is
> 
> starting virt X
>    starting tests
>        foreach test
>            test run
> 
> when the test now fails, the whole testsuite wouldn't stop as we are running
> everything with nonfatal, right?

Yes that's correct AFAIR.

> The reason for this is cleaning up the Xfvb session after the test run. If
> the tests would die normally the build process would be killed before we can
> clean up the Xfvb process. That why we run nonfatal and record the return
> code. You need to handle and pass the return code yourself up the the eclass
> function.

I thought as much. Can you use EBUILD_DEATH_HOOKS instead of nonfatal? or is that non-standard?
Comment 8 Davide Pesavento gentoo-dev 2015-12-01 14:18:07 UTC
(In reply to Michał Górny from comment #6)
> Let's keep this short.
[...]
> Hope this short reminder of ebuild 1-2-3 helps.

It does not. As I said in comment #4, this peculiar behavior of virtualx.eclass must be documented, I'm sure it's unexpected to most ebuild writers.

Or are you suggesting that we should append "|| return" to every die?
Comment 9 Justin Lecher (RETIRED) gentoo-dev 2015-12-07 12:33:37 UTC
As there is no way around calling the funxiton with nonfatal, I added a verbose explaination about the rational.

commit b016e3fcd2efdb8c70d6ee8d53f63f729d5ba916
Author: Justin Lecher <jlec@gentoo.org>
Date:   Mon Dec 7 13:31:32 2015 +0100

    virtualx.eclass: Add verbose warning about nonfatal call

    Gentoo-Bug: https://bugs.gentoo.org/show_bug.cgi?id=517976

    Signed-off-by: Justin Lecher <jlec@gentoo.org>

    https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b016e3fcd2efdb8c70d6ee8d53f63f729d5ba916