diff mbox series

[bug#40543,v2,5/5] gnu: virt-manager: Work towards enabling some tests.

Message ID 20200415174952.9368-5-mail@cbaines.net
State Accepted
Headers show
Series [bug#40543,v2,1/5] gnu: Add python2-pyatspi. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job

Commit Message

Christopher Baines April 15, 2020, 5:49 p.m. UTC
* gnu/packages/virtualization.scm (virt-manager)[arguments]: Set #:test-target
to "test_ui", replace the 'check phase.
[native-inputs]: Add some inputs required for running tests.
---
 gnu/packages/virtualization.scm | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

Comments

Marius Bakke April 15, 2020, 6:46 p.m. UTC | #1
Christopher Baines <mail@cbaines.net> writes:

> * gnu/packages/virtualization.scm (virt-manager)[arguments]: Set #:test-target
> to "test_ui", replace the 'check phase.
> [native-inputs]: Add some inputs required for running tests.
> ---
>  gnu/packages/virtualization.scm | 25 +++++++++++++++++++++----
>  1 file changed, 21 insertions(+), 4 deletions(-)
>
> diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm
> index be17ec15f0..c8840f345a 100644
> --- a/gnu/packages/virtualization.scm
> +++ b/gnu/packages/virtualization.scm
> @@ -602,9 +602,10 @@ virtualization library.")
>      (build-system python-build-system)
>      (arguments
>       `(#:use-setuptools? #f          ; uses custom distutils 'install' command
> -       ;; Some of the tests seem to require network access to install virtual
> -       ;; machines.
> -       #:tests? #f
> +       #:test-target "test_ui"
> +       #:tests? #f                      ; TODO The tests currently fail
> +                                        ; RuntimeError: Loop condition wasn't
> +                                        ; met
>         #:imported-modules ((guix build glib-or-gtk-build-system)
>                             ,@%python-build-system-modules)
>         #:modules ((ice-9 match)
> @@ -651,6 +652,16 @@ virtualization library.")
>                                 ,(filter identity paths))))
>                           bin-files))
>               #t))
> +         (replace 'check
> +           (lambda* (#:key tests? #:allow-other-keys)
> +             (when tests?
> +               (setenv "HOME" "/tmp")
> +               (system "Xvfb :1 &")
> +               (setenv "DISPLAY" ":1")
> +               ;; Dogtail requires that Assistive Technology support be enabled
> +               (setenv "GTK_MODULES" "gail:atk-bridge")
> +               (invoke "dbus-run-session" "--" "python" "setup.py" "test_ui"))
> +             #t))
>           (add-after 'install 'glib-or-gtk-compile-schemas
>             (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
>           (add-after 'install 'glib-or-gtk-wrap
> @@ -679,7 +690,13 @@ virtualization library.")
>         ("gobject-introspection" ,gobject-introspection)
>         ("gtk+" ,gtk+ "bin")             ; gtk-update-icon-cache
>         ("perl" ,perl)                   ; pod2man
> -       ("intltool" ,intltool)))
> +       ("intltool" ,intltool)
> +       ;; The following are required for running the tests
> +       ("python-dogtail" ,python-dogtail)
> +       ("xvfb" ,xorg-server)
> +       ("dbus" ,dbus)
> +       ("at-spi2-core" ,at-spi2-core)
> +       ("gsettings-desktop-schemas" ,gsettings-desktop-schemas)))

Perhaps we should comment these inputs for now so that they won't
needlessly rebuild this package?

Also, this should use 'xorg-server-for-tests'.

Otherwise LGTM.
Christopher Baines April 16, 2020, 8:27 a.m. UTC | #2
Marius Bakke <mbakke@fastmail.com> writes:

> Christopher Baines <mail@cbaines.net> writes:
>
>> * gnu/packages/virtualization.scm (virt-manager)[arguments]: Set #:test-target
>> to "test_ui", replace the 'check phase.
>> [native-inputs]: Add some inputs required for running tests.
>> ---
>>  gnu/packages/virtualization.scm | 25 +++++++++++++++++++++----
>>  1 file changed, 21 insertions(+), 4 deletions(-)
>>
>> diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm
>> index be17ec15f0..c8840f345a 100644
>> --- a/gnu/packages/virtualization.scm
>> +++ b/gnu/packages/virtualization.scm
>> @@ -602,9 +602,10 @@ virtualization library.")
>>      (build-system python-build-system)
>>      (arguments
>>       `(#:use-setuptools? #f          ; uses custom distutils 'install' command
>> -       ;; Some of the tests seem to require network access to install virtual
>> -       ;; machines.
>> -       #:tests? #f
>> +       #:test-target "test_ui"
>> +       #:tests? #f                      ; TODO The tests currently fail
>> +                                        ; RuntimeError: Loop condition wasn't
>> +                                        ; met
>>         #:imported-modules ((guix build glib-or-gtk-build-system)
>>                             ,@%python-build-system-modules)
>>         #:modules ((ice-9 match)
>> @@ -651,6 +652,16 @@ virtualization library.")
>>                                 ,(filter identity paths))))
>>                           bin-files))
>>               #t))
>> +         (replace 'check
>> +           (lambda* (#:key tests? #:allow-other-keys)
>> +             (when tests?
>> +               (setenv "HOME" "/tmp")
>> +               (system "Xvfb :1 &")
>> +               (setenv "DISPLAY" ":1")
>> +               ;; Dogtail requires that Assistive Technology support be enabled
>> +               (setenv "GTK_MODULES" "gail:atk-bridge")
>> +               (invoke "dbus-run-session" "--" "python" "setup.py" "test_ui"))
>> +             #t))
>>           (add-after 'install 'glib-or-gtk-compile-schemas
>>             (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
>>           (add-after 'install 'glib-or-gtk-wrap
>> @@ -679,7 +690,13 @@ virtualization library.")
>>         ("gobject-introspection" ,gobject-introspection)
>>         ("gtk+" ,gtk+ "bin")             ; gtk-update-icon-cache
>>         ("perl" ,perl)                   ; pod2man
>> -       ("intltool" ,intltool)))
>> +       ("intltool" ,intltool)
>> +       ;; The following are required for running the tests
>> +       ("python-dogtail" ,python-dogtail)
>> +       ("xvfb" ,xorg-server)
>> +       ("dbus" ,dbus)
>> +       ("at-spi2-core" ,at-spi2-core)
>> +       ("gsettings-desktop-schemas" ,gsettings-desktop-schemas)))
>
> Perhaps we should comment these inputs for now so that they won't
> needlessly rebuild this package?

Sure, I'll comment them out.

> Also, this should use 'xorg-server-for-tests'.

I did see xorg-server-for-tests, but the comment said "This package is
intended to be used when building GTK". I guess the same reasoning
applies though, and it is used for packages other than GTK.

I'll make these changes and send some updated patches.
diff mbox series

Patch

diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm
index be17ec15f0..c8840f345a 100644
--- a/gnu/packages/virtualization.scm
+++ b/gnu/packages/virtualization.scm
@@ -602,9 +602,10 @@  virtualization library.")
     (build-system python-build-system)
     (arguments
      `(#:use-setuptools? #f          ; uses custom distutils 'install' command
-       ;; Some of the tests seem to require network access to install virtual
-       ;; machines.
-       #:tests? #f
+       #:test-target "test_ui"
+       #:tests? #f                      ; TODO The tests currently fail
+                                        ; RuntimeError: Loop condition wasn't
+                                        ; met
        #:imported-modules ((guix build glib-or-gtk-build-system)
                            ,@%python-build-system-modules)
        #:modules ((ice-9 match)
@@ -651,6 +652,16 @@  virtualization library.")
                                ,(filter identity paths))))
                          bin-files))
              #t))
+         (replace 'check
+           (lambda* (#:key tests? #:allow-other-keys)
+             (when tests?
+               (setenv "HOME" "/tmp")
+               (system "Xvfb :1 &")
+               (setenv "DISPLAY" ":1")
+               ;; Dogtail requires that Assistive Technology support be enabled
+               (setenv "GTK_MODULES" "gail:atk-bridge")
+               (invoke "dbus-run-session" "--" "python" "setup.py" "test_ui"))
+             #t))
          (add-after 'install 'glib-or-gtk-compile-schemas
            (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
          (add-after 'install 'glib-or-gtk-wrap
@@ -679,7 +690,13 @@  virtualization library.")
        ("gobject-introspection" ,gobject-introspection)
        ("gtk+" ,gtk+ "bin")             ; gtk-update-icon-cache
        ("perl" ,perl)                   ; pod2man
-       ("intltool" ,intltool)))
+       ("intltool" ,intltool)
+       ;; The following are required for running the tests
+       ("python-dogtail" ,python-dogtail)
+       ("xvfb" ,xorg-server)
+       ("dbus" ,dbus)
+       ("at-spi2-core" ,at-spi2-core)
+       ("gsettings-desktop-schemas" ,gsettings-desktop-schemas)))
     (home-page "https://virt-manager.org/")
     (synopsis "Manage virtual machines")
     (description