From 06efdcb4e1f8b8fcabbf0a3c25f423f5fa6dba38 Mon Sep 17 00:00:00 2001 From: Sam James Date: Thu, 20 Aug 2026 02:49:53 +0100 Subject: [PATCH] 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 d3f2238d418dfe4324f65b391d144b2117263888. 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 --- dev-python/pycuda/pycuda-2025.1.3-r1.ebuild | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/dev-python/pycuda/pycuda-2025.1.3-r1.ebuild b/dev-python/pycuda/pycuda-2025.1.3-r1.ebuild index f18c69cd2bd00..df91b5f0f1bce 100644 --- a/dev-python/pycuda/pycuda-2025.1.3-r1.ebuild +++ b/dev-python/pycuda/pycuda-2025.1.3-r1.ebuild @@ -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