commit:     16e67b51511f6ad9cdffa1f1bf9ec3b109dd645c
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 11 18:02:29 2021 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Wed Aug 11 18:02:29 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=16e67b51

sys-fs/udev: check if /dev is writable before running tests

Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 sys-fs/udev/udev-249-r2.ebuild | 28 +++++++++++++---------------
 sys-fs/udev/udev-9999.ebuild   | 28 +++++++++++++---------------
 2 files changed, 26 insertions(+), 30 deletions(-)

diff --git a/sys-fs/udev/udev-249-r2.ebuild b/sys-fs/udev/udev-249-r2.ebuild
index a77771e66f7..08a32a5d3c7 100644
--- a/sys-fs/udev/udev-249-r2.ebuild
+++ b/sys-fs/udev/udev-249-r2.ebuild
@@ -198,32 +198,30 @@ multilib_src_compile() {
        eninja "${targets[@]}"
 }
 
-multilib_src_test() {
+src_test() {
        # The testsuite is *very* finicky. Don't try running it in
        # containers or anything but a full VM or on bare metal.
        # udev calls 'mknod' a number of times, and this interacts
        # badly with kernel namespaces.
 
-       if [[ ${EUID} -ne 0 ]]; then
-               ewarn "udev tests need to run under uid 0"
-               ewarn "Skipping tests"
-       elif has sandbox ${FEATURES}; then
-               ewarn "\'FEATURES=sandbox\' detected"
+       if [[ ! -w /dev ]]; then
                ewarn "udev tests needs full access to /dev"
                ewarn "Skipping tests"
        else
-               einfo Running tests
+               meson-multilib_src_test
+       fi
+}
 
-               # two binaries required by udev-test.pl
-               eninja systemd-detect-virt test-udev
-               local -x PATH="${PWD}:${PATH}"
+multilib_src_test() {
+       # two binaries required by udev-test.pl
+       eninja systemd-detect-virt test-udev
+       local -x PATH="${PWD}:${PATH}"
 
-               # prepare ${BUILD_DIR}/test/sys, required by udev-test.pl
-               "${EPYTHON}" "${S}"/test/sys-script.py test || die
+       # prepare ${BUILD_DIR}/test/sys, required by udev-test.pl
+       "${EPYTHON}" "${S}"/test/sys-script.py test || die
 
-               # the perl script contains all the udev tests
-               "${S}"/test/udev-test.pl || die
-       fi
+       # the perl script contains all the udev tests
+       "${S}"/test/udev-test.pl || die
 }
 
 multilib_src_install() {

diff --git a/sys-fs/udev/udev-9999.ebuild b/sys-fs/udev/udev-9999.ebuild
index 270009d07a3..162f5505799 100644
--- a/sys-fs/udev/udev-9999.ebuild
+++ b/sys-fs/udev/udev-9999.ebuild
@@ -195,32 +195,30 @@ multilib_src_compile() {
        eninja "${targets[@]}"
 }
 
-multilib_src_test() {
+src_test() {
        # The testsuite is *very* finicky. Don't try running it in
        # containers or anything but a full VM or on bare metal.
        # udev calls 'mknod' a number of times, and this interacts
        # badly with kernel namespaces.
 
-       if [[ ${EUID} -ne 0 ]]; then
-               ewarn "udev tests need to run under uid 0"
-               ewarn "Skipping tests"
-       elif has sandbox ${FEATURES}; then
-               ewarn "\'FEATURES=sandbox\' detected"
+       if [[ ! -w /dev ]]; then
                ewarn "udev tests needs full access to /dev"
                ewarn "Skipping tests"
        else
-               einfo Running tests
+               meson-multilib_src_test
+       fi
+}
 
-               # two binaries required by udev-test.pl
-               eninja systemd-detect-virt test-udev
-               local -x PATH="${PWD}:${PATH}"
+multilib_src_test() {
+       # two binaries required by udev-test.pl
+       eninja systemd-detect-virt test-udev
+       local -x PATH="${PWD}:${PATH}"
 
-               # prepare ${BUILD_DIR}/test/sys, required by udev-test.pl
-               "${EPYTHON}" "${S}"/test/sys-script.py test || die
+       # prepare ${BUILD_DIR}/test/sys, required by udev-test.pl
+       "${EPYTHON}" "${S}"/test/sys-script.py test || die
 
-               # the perl script contains all the udev tests
-               "${S}"/test/udev-test.pl || die
-       fi
+       # the perl script contains all the udev tests
+       "${S}"/test/udev-test.pl || die
 }
 
 multilib_src_install() {

Reply via email to