dev-python/pycuda: error out early w/o accessible NVIDIA GPU

When no NVIDIA GPU is available, there are a few options:
1) Warn or silently skip tests which is unfortunate if you really want
   the tests to run, and I'd say the common case is you do want that. The only time
   you *don't* is in the tinderbox scenario where you're not actually using many/most/all
   of the things you install.

   Even if you're a user running tests because you have it installed, you likely
   want the tests to run (not just developers) for that package.

   We've had cases where these smart warnings or skips are broken where
   we've missed out on real test coverage for no good reason. A recent
   example is d3f2238d41.

2) Fail hard if it's not accessible, which may mean there's no such GPU at all,
   or just that there's missing permissions. The only case this seems to inconvenience
   is tinderboxes, which seems like an acceptable trade-off here.

Note that userpriv is still seemingly an issue even w/ the portage user
being in the video group but maybe I'm missing something there as I'm
a little surprised by that.

Bug: https://bugs.gentoo.org/516572
Closes: https://bugs.gentoo.org/981024
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Sam James
2026-08-20 02:49:53 +01:00
parent 6d0ab519d5
commit 06efdcb4e1

View File

@@ -66,12 +66,24 @@ python_configure() {
}
python_test() {
# we need write access to this to run the tests
# We need write access to these to run the tests
addwrite /dev/nvidia0
addwrite /dev/nvidiactl
addwrite /dev/nvidia-uvm
addwrite /dev/nvidia-uvm-tools
if [[ ! -w /dev/nvidiactl ]]; then
eerror "Could not write to /dev/nvidiactl. To run these tests, a NVIDIA GPU is required"
eerror "and must be accessible by the package manager."
eerror
eerror "Further, the 'portage' user usually needs to be in the video group:"
eerror " 1) set ACCT_USER_PORTAGE_GROUPS_ADD='video' in make.conf and re-emerge"
eerror " acct-user/portage, or"
eerror
eerror " 2) please run 'gpasswd -a portage video'."
die "/dev/nvidiactl inaccessible; check permissions?"
fi
EPYTEST_DESELECT=(
# needs investigation, perhaps failure is hardware-specific
test/test_driver.py::test_pass_cai_array