Re: Help with DBus Tests Failing for Python Package
Hi, Jaft writes: > On Tuesday, December 27, 2022 at 11:49:31 AM CST, Maxim Cournoyer > wrote: >> I bet this is because of the expectation of python-dbus on the processes >> being reaped by PID 1 instead of staying around as zombies, as currently >> happens in the Guix build container (see: >> https://issues.guix.gnu.org/30948). >> >> The current workaround currently used in Guix involves the use of tini >> and of a forked process... it's not very pretty (see 'guix edit mutter' >> for such an example). > > Thanks a ton for the pointer, Maxim. > > Unfortunately, I still seem to be getting the same result. At first, I tried > a simple approach of ~(execlp "tini" "--" "python" "setup.py" "test")~; I > think it wound up still requiring the =dbus= package, to run. > > That failing, I decided to try something closer to what =mutter= was doing > with [...] >> (match (primitive-fork) >> (0 ;child process >> (set-child-subreaper!) >> ;; XXX: Tini provides proper PID1-like signal >>handling that >> ;; reaps zombie processes, necessary for the >> ;; 'test_shutdown_subprocesses' test to pass. >> >> ;; TODO: Complete >>https://issues.guix.gnu.org/30948. >> ;; (execlp "tini" "--" "python" "setup.py" >>"test") >> (execlp "tini" "--" >> "dbus-run-session" "--" >> "xvfb-run" "-a" "-s" (getenv >>"XVFB_SERVER_ARGS") >> "python" "setup.py" "test")) >> (pid >> (match (waitpid pid) >> ((_ . status) >> (unless (zero? status) >> (error "`pytest' exited with status" >> status > > I know some bits there are definitely not relevant; I figured I could clean > it up, after, if things worked but I'm still getting the exact same errors. > > Just to make sure /I'm/ not doing something incorrectly, is this within what > you meant? Or did I do anything that's obviously not correct, in this setup? The important bits are the fork, the (set-child-subreaper!) in the child process (forked) and the (execlp "tini" "--" your-test-commands). If this doesn't improve things, the problem may be elsewhere. -- Thanks, Maxim
Re: Help with DBus Tests Failing for Python Package
On Tuesday, December 27, 2022 at 11:49:31 AM CST, Maxim Cournoyer wrote: > I bet this is because of the expectation of python-dbus on the processes > being reaped by PID 1 instead of staying around as zombies, as currently > happens in the Guix build container (see: > https://issues.guix.gnu.org/30948). > > The current workaround currently used in Guix involves the use of tini > and of a forked process... it's not very pretty (see 'guix edit mutter' > for such an example). Thanks a ton for the pointer, Maxim. Unfortunately, I still seem to be getting the same result. At first, I tried a simple approach of ~(execlp "tini" "--" "python" "setup.py" "test")~; I think it wound up still requiring the =dbus= package, to run. That failing, I decided to try something closer to what =mutter= was doing with > (arguments (list #:imported-modules > `(,@%python-build-system-modules > (guix build syscalls)) > #:modules > '((guix build python-build-system) > (guix build syscalls) > (guix build utils) > (ice-9 match)) > #:phases > #~(modify-phases %standard-phases > (replace 'check > (lambda* (#:key tests? #:allow-other-keys) > (when tests? > ;; Setup (see the 'test-mutter' CI target at > ;; >https://gitlab.gnome.org/GNOME/mutter/-/raw/main/.gitlab-ci.yml). > (setenv "HOME" "/tmp") > (setenv "XDG_RUNTIME_DIR" (string-append (getcwd) > >"/runtime-dir")) > (mkdir (getenv "XDG_RUNTIME_DIR")) > (chmod (getenv "XDG_RUNTIME_DIR") #o700) > > (setenv "GSETTINGS_SCHEMA_DIR" "data") > (setenv "MUTTER_DEBUG_DUMMY_MODE_SPECS" >"800x600@10.0") > ;; (setenv "PIPEWIRE_DEBUG" "2") > ;; (setenv "PIPEWIRE_LOG" >"meson-logs/pipewire.log") > (setenv "XVFB_SERVER_ARGS" "+iglx -noreset") > (setenv "G_SLICE" "always-malloc") > (setenv "MALLOC_CHECK" "3") > (setenv "NO_AT_BRIDGE" "1") > ;; This is needed, otherwise the >"mutter:core+mutter/unit / > ;; anonymous-file" test would fail (see: > ;; >https://gitlab.gnome.org/GNOME/mutter/-/issues/2017). > (setenv "CI_JOB_ID" "1") > > ;; (invoke "glib-compile-schemas" (getenv >"GSETTINGS_SCHEMA_DIR")) > (mkdir-p (getenv "XDG_RUNTIME_DIR")) > (chmod (getenv "XDG_RUNTIME_DIR") #o755) > ;; (invoke "pipewire" "--version") ;check for >pipewire > ;; (system "pipewire &") ;always returns 0 due >to forking > > (match (primitive-fork) > (0 ;child process > (set-child-subreaper!) > ;; XXX: Tini provides proper PID1-like signal >handling that > ;; reaps zombie processes, necessary for the > ;; 'test_shutdown_subprocesses' test to pass. > > ;; TODO: Complete >https://issues.guix.gnu.org/30948. > ;; (execlp "tini" "--" "python" "setup.py" >"test") > (execlp "tini" "--" > "dbus-run-session" "--" > "xvfb-run" "-a" "-s" (getenv >"XVFB_SERVER_ARGS") > "python" "setup.py" "test")) > (pid > (match (waitpid pid) > ((_ . status) > (unless (zero? status) > (error "`pytest' exited with status" > status I know some bits there are definitely not relevant; I figured I could clean it up, after, if things worked but I'm still getting the exact same errors. Just to make sure /I'm/ not doing something incorrectly, is this within what you meant? Or did I do anything that's obviously not correct, in this setup?
Re: Help with DBus Tests Failing for Python Package
Hello, Jaft writes: > So I tried a different tactic and, noticing the error said the issue > was ~dbus-session~ didn't exist, did this, instead: > >> (arguments (list #:phases #~(modify-phases %standard-phases >> (add-before 'check 'start-xserver >> (lambda _ >> ;; Tests require a running dbus-daemon. >> (system "dbus-daemon &") >> ;; For missing '/etc/machine-id'. >> (setenv "DBUS_FATAL_WARNINGS" "0")) >> (inputs (list python python-pygobject)) >> (native-inputs (list xorg-server-for-tests)) > > This works much better and the 232 tests get run; most, even pass…except 4. > The output is thus: > >> test_get_object_path (tests.test_proxy.DBusProxyTestCase) >> Test get_object_path. ... ok >> >> == >> FAIL: test_async_calls (tests.test_unix.DBusUnixExampleTestCase) >> Test DBus async calls with fds. >> -- >> Traceback (most recent call last): >> File >> "/tmp/guix-build-python-dasbus-1.7.drv-0/dasbus-1.7/tests/test_unix.py", >> line 420, in test_async_calls >> self._run_test() >> File >>"/tmp/guix-build-python-dasbus-1.7.drv-0/dasbus-1.7/tests/lib_dbus.py", line >>194, in _run_test >> self.assertEqual(client.exitcode, 0, msg) >> AssertionError: 1 != 0 : _call_hello_async has finished with 1 >> >> == >> FAIL: test_properties (tests.test_unix.DBusUnixExampleTestCase) >> Test DBus properties with fds. >> -- >> Traceback (most recent call last): >> File >> "/tmp/guix-build-python-dasbus-1.7.drv-0/dasbus-1.7/tests/test_unix.py", >> line 457, in test_properties >> self._run_test() >> File >>"/tmp/guix-build-python-dasbus-1.7.drv-0/dasbus-1.7/tests/lib_dbus.py", line >>194, in _run_test >> self.assertEqual(client.exitcode, 0, msg) >> AssertionError: 1 != 0 : _set_pipes has finished with 1 >> >> == >> FAIL: test_signals (tests.test_unix.DBusUnixExampleTestCase) >> Test DBus signals with fds. >> -- >> Traceback (most recent call last): >> File >> "/tmp/guix-build-python-dasbus-1.7.drv-0/dasbus-1.7/tests/test_unix.py", >> line 481, in test_signals >> self._run_test() >> File >>"/tmp/guix-build-python-dasbus-1.7.drv-0/dasbus-1.7/tests/lib_dbus.py", line >>194, in _run_test >> self.assertEqual(client.exitcode, 0, msg) >> AssertionError: 1 != 0 : _trigger_signal has finished with 1 >> >> == >> FAIL: test_sync_calls (tests.test_unix.DBusUnixExampleTestCase) >> Test DBus sync calls with fds. >> -- >> Traceback (most recent call last): >> File >> "/tmp/guix-build-python-dasbus-1.7.drv-0/dasbus-1.7/tests/test_unix.py", >> line 398, in test_sync_calls >> self._run_test() >> File >>"/tmp/guix-build-python-dasbus-1.7.drv-0/dasbus-1.7/tests/lib_dbus.py", line >>194, in _run_test >> self.assertEqual(client.exitcode, 0, msg) >> AssertionError: 1 != 0 : _call_hello_sync has finished with 1 >> >> -- >> Ran 232 tests in 681.414s >> >> FAILED (failures=4) >> Test failed: >> error: Test failed: > failures=4> >> error: in phase 'check': uncaught exception: >> %exception #<&invoke-error program: "python" arguments: ("-c" >> "import setuptools, tokenize;__file__='setup.py';f=getattr(tokenize, >> 'open', open)(__file__);code=f.read().replace('\r\n', >> '\n');f.close();exec(compile(code, __file__, 'exec'))" "test") >> exit-status: 1 term-signal: #f stop-signal: #f> I bet this is because of the expectation of python-dbus on the processes being reaped by PID 1 instead of staying around as zombies, as currently happens in the Guix build container (see: https://issues.guix.gnu.org/30948). The current workaround currently used in Guix involves the use of tini and of a forked process... it's not very pretty (see 'guix edit mutter' for such an example). Good luck! -- Thanks, Maxim
Re: Help with DBus Tests Failing for Python Package
Jaft writes: > So I tried a different tactic and, noticing the error said the issue was > ~dbus-session~ didn't exist, did this, instead: > >> (arguments (list #:phases #~(modify-phases %standard-phases >> (add-before 'check 'start-xserver >> (lambda _ >> ;; Tests require a running dbus-daemon. >> (system "dbus-daemon &") >> ;; For missing '/etc/machine-id'. >> (setenv "DBUS_FATAL_WARNINGS" "0")) >> (inputs (list python python-pygobject)) >> (native-inputs (list xorg-server-for-tests)) > > This works much better and the 232 tests get run; most, even pass…except 4. > The output is thus: > >> test_get_object_path (tests.test_proxy.DBusProxyTestCase) >> Test get_object_path. ... ok >> >> == >> FAIL: test_async_calls (tests.test_unix.DBusUnixExampleTestCase) >> Test DBus async calls with fds. >> -- >> Traceback (most recent call last): >> File >>"/tmp/guix-build-python-dasbus-1.7.drv-0/dasbus-1.7/tests/test_unix.py", line >>420, in test_async_calls >> self._run_test() >> File >>"/tmp/guix-build-python-dasbus-1.7.drv-0/dasbus-1.7/tests/lib_dbus.py", line >>194, in _run_test >> self.assertEqual(client.exitcode, 0, msg) >> AssertionError: 1 != 0 : _call_hello_async has finished with 1 >> >> == >> FAIL: test_properties (tests.test_unix.DBusUnixExampleTestCase) >> Test DBus properties with fds. >> -- >> Traceback (most recent call last): >> File >>"/tmp/guix-build-python-dasbus-1.7.drv-0/dasbus-1.7/tests/test_unix.py", line >>457, in test_properties >> self._run_test() >> File >>"/tmp/guix-build-python-dasbus-1.7.drv-0/dasbus-1.7/tests/lib_dbus.py", line >>194, in _run_test >> self.assertEqual(client.exitcode, 0, msg) >> AssertionError: 1 != 0 : _set_pipes has finished with 1 >> >> == >> FAIL: test_signals (tests.test_unix.DBusUnixExampleTestCase) >> Test DBus signals with fds. >> -- >> Traceback (most recent call last): >> File >>"/tmp/guix-build-python-dasbus-1.7.drv-0/dasbus-1.7/tests/test_unix.py", line >>481, in test_signals >> self._run_test() >> File >>"/tmp/guix-build-python-dasbus-1.7.drv-0/dasbus-1.7/tests/lib_dbus.py", line >>194, in _run_test >> self.assertEqual(client.exitcode, 0, msg) >> AssertionError: 1 != 0 : _trigger_signal has finished with 1 >> >> == >> FAIL: test_sync_calls (tests.test_unix.DBusUnixExampleTestCase) >> Test DBus sync calls with fds. >> -- >> Traceback (most recent call last): >> File >>"/tmp/guix-build-python-dasbus-1.7.drv-0/dasbus-1.7/tests/test_unix.py", line >>398, in test_sync_calls >> self._run_test() >> File >>"/tmp/guix-build-python-dasbus-1.7.drv-0/dasbus-1.7/tests/lib_dbus.py", line >>194, in _run_test >> self.assertEqual(client.exitcode, 0, msg) >> AssertionError: 1 != 0 : _call_hello_sync has finished with 1 >> >> -- >> Ran 232 tests in 681.414s >> >> FAILED (failures=4) >> Test failed: >> error: Test failed: > failures=4> >> error: in phase 'check': uncaught exception: >> %exception #<&invoke-error program: "python" arguments: ("-c" >> "import setuptools, tokenize;__file__='setup.py';f=getattr(tokenize, >> 'open', open)(__file__);code=f.read().replace('\r\n', >> '\n');f.close();exec(compile(code, __file__, 'exec'))" "test") >> exit-status: 1 term-signal: #f stop-signal: #f> > > It doesn't look like enough to clearly tell /why/ things failed (and > looking through the source of the particular failing tests isn't much > clearer, for me, unfortunately) but maybe someone's run across a > similar experience, before, that might indicate something to try. Just a guess but maybe you should wrap the check phase in dbus-run-session.
Re: Help with DBus Tests Failing for Python Package
So I tried a different tactic and, noticing the error said the issue was ~dbus-session~ didn't exist, did this, instead: > (arguments (list #:phases #~(modify-phases %standard-phases > (add-before 'check 'start-xserver > (lambda _ > ;; Tests require a running dbus-daemon. > (system "dbus-daemon &") > ;; For missing '/etc/machine-id'. > (setenv "DBUS_FATAL_WARNINGS" "0")) > (inputs (list python python-pygobject)) > (native-inputs (list xorg-server-for-tests)) This works much better and the 232 tests get run; most, even pass…except 4. The output is thus: > test_get_object_path (tests.test_proxy.DBusProxyTestCase) > Test get_object_path. ... ok > > == > FAIL: test_async_calls (tests.test_unix.DBusUnixExampleTestCase) > Test DBus async calls with fds. > -- > Traceback (most recent call last): > File >"/tmp/guix-build-python-dasbus-1.7.drv-0/dasbus-1.7/tests/test_unix.py", line >420, in test_async_calls > self._run_test() > File >"/tmp/guix-build-python-dasbus-1.7.drv-0/dasbus-1.7/tests/lib_dbus.py", line >194, in _run_test > self.assertEqual(client.exitcode, 0, msg) > AssertionError: 1 != 0 : _call_hello_async has finished with 1 > > == > FAIL: test_properties (tests.test_unix.DBusUnixExampleTestCase) > Test DBus properties with fds. > -- > Traceback (most recent call last): > File >"/tmp/guix-build-python-dasbus-1.7.drv-0/dasbus-1.7/tests/test_unix.py", line >457, in test_properties > self._run_test() > File >"/tmp/guix-build-python-dasbus-1.7.drv-0/dasbus-1.7/tests/lib_dbus.py", line >194, in _run_test > self.assertEqual(client.exitcode, 0, msg) > AssertionError: 1 != 0 : _set_pipes has finished with 1 > > == > FAIL: test_signals (tests.test_unix.DBusUnixExampleTestCase) > Test DBus signals with fds. > -- > Traceback (most recent call last): > File >"/tmp/guix-build-python-dasbus-1.7.drv-0/dasbus-1.7/tests/test_unix.py", line >481, in test_signals > self._run_test() > File >"/tmp/guix-build-python-dasbus-1.7.drv-0/dasbus-1.7/tests/lib_dbus.py", line >194, in _run_test > self.assertEqual(client.exitcode, 0, msg) > AssertionError: 1 != 0 : _trigger_signal has finished with 1 > > == > FAIL: test_sync_calls (tests.test_unix.DBusUnixExampleTestCase) > Test DBus sync calls with fds. > -- > Traceback (most recent call last): > File >"/tmp/guix-build-python-dasbus-1.7.drv-0/dasbus-1.7/tests/test_unix.py", line >398, in test_sync_calls > self._run_test() > File >"/tmp/guix-build-python-dasbus-1.7.drv-0/dasbus-1.7/tests/lib_dbus.py", line >194, in _run_test > self.assertEqual(client.exitcode, 0, msg) > AssertionError: 1 != 0 : _call_hello_sync has finished with 1 > > -- > Ran 232 tests in 681.414s > > FAILED (failures=4) > Test failed: > error: Test failed: failures=4> > error: in phase 'check': uncaught exception: > %exception #<&invoke-error program: "python" arguments: ("-c" "import > setuptools, tokenize;__file__='setup.py';f=getattr(tokenize, 'open', > open)(__file__);code=f.read().replace('\r\n', > '\n');f.close();exec(compile(code, __file__, 'exec'))" "test") exit-status: 1 > term-signal: #f stop-signal: #f> It doesn't look like enough to clearly tell /why/ things failed (and looking through the source of the particular failing tests isn't much clearer, for me, unfortunately) but maybe someone's run across a similar experience, before, that might indicate something to try. On Monday, December 26, 2022 at 10:18:55 PM CST, Jaft wrote: > I'm attempting to package the Python package DasBus > (https://github.com/rhinstaller/dasbus/) and the tests, when it tries to test > by making DBus calls, are failing. > > For specificity, the error output is: > > > test_additional_arguments (tests.test_dbus.DBusExampleTestCase) > > Call a DBus method. ... ** > > GLib-GIO:ERROR:../glib-2.70.2/gio/gtestdbus.c:667:start_daemon: assertion > > failed (error == NULL): Failed to execute child process “dbus-daemon” (No > > such file or directory) (g-exec-error-quark, 8) > > Bail out! GLib-GIO:ERROR:../glib-2.70.2/gio/gtestdbus.c:667:start_daemon: > > assertion failed (error == NULL): Failed to execute child proc
Help with DBus Tests Failing for Python Package
I'm attempting to package the Python package DasBus (https://github.com/rhinstaller/dasbus/) and the tests, when it tries to test by making DBus calls, are failing. For specificity, the error output is: > test_additional_arguments (tests.test_dbus.DBusExampleTestCase) > Call a DBus method. ... ** > GLib-GIO:ERROR:../glib-2.70.2/gio/gtestdbus.c:667:start_daemon: assertion > failed (error == NULL): Failed to execute child process “dbus-daemon” (No > such file or directory) (g-exec-error-quark, 8) > Bail out! GLib-GIO:ERROR:../glib-2.70.2/gio/gtestdbus.c:667:start_daemon: > assertion failed (error == NULL): Failed to execute child process > “dbus-daemon” (No such file or directory) (g-exec-error-quark, 8) > error: in phase 'check': uncaught exception: > %exception #<&invoke-error program: "python" arguments: ("-c" "import > setuptools, tokenize;__file__='setup.py';f=getattr(tokenize, 'open', > open)(__file__);code=f.read().replace('\r\n', > '\n');f.close();exec(compile(code, __file__, 'exec'))" "test") exit-status: > #f term-signal: 6 stop-signal: #f> I tried using ~xorg-server-for-tests~ and initializing the server before the =check= phase but I'm still running into the same error. Would anyone know what might be a cause? > (define-public python-dasbus > (package > (name "python-dasbus") > (version "1.7") > (source (origin > (method url-fetch) > (uri (pypi-uri "dasbus" version)) > (sha256 (base32 > >"1xmn6q00v3kif5q8jcq6vi84k6xb97s2ry5rgdgyxs6z3a20v1d8" > (build-system python-build-system) > (arguments (list #:phases #~(modify-phases %standard-phases > (add-before 'check 'start-xserver > (lambda _ > (system "Xvfb :1 &") > (setenv "DISPLAY" ":1")) > (inputs (list python python-pygobject)) > (native-inputs (list xorg-server-for-tests)) > (home-page "https://github.com/rhinstaller/dasbus";) > (synopsis "DBus library in Python 3") > (description "DBus library in Python 3") > (license #f)))