GNU bug report logs - #31520
[PATCH] gnu: u-boot-tools: Enable tests.

Previous Next

Package: guix-patches;

Reported by: Danny Milosavljevic <dannym <at> scratchpost.org>

Date: Fri, 18 May 2018 19:14:02 UTC

Severity: normal

Tags: patch

Done: Danny Milosavljevic <dannym <at> scratchpost.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 31520 in the body.
You can then email your comments to 31520 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#31520; Package guix-patches. (Fri, 18 May 2018 19:14:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Danny Milosavljevic <dannym <at> scratchpost.org>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Fri, 18 May 2018 19:14:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: guix-patches <at> gnu.org
Cc: Danny Milosavljevic <dannym <at> scratchpost.org>
Subject: [PATCH] gnu: u-boot-tools: Enable tests.
Date: Fri, 18 May 2018 21:12:47 +0200
* gnu/packages/bootloaders.scm (dtc)[native-search-paths]: Add PYTHONPATH.
(u-boot-tools)[native-inputs]: Add openssl, python2-coverage, python2-pytest,
sdl.
[arguments]<#:make-flags>: Remove NO_SDL.
[arguments]<#:test-target>: Change to "tests".
[arguments]<#:phases>[patch]: New phase.
[arguments]<#:phases>[check]: Replace and move.
---
 gnu/packages/bootloaders.scm | 49 +++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 46 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 333f30e72..4041f2320 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -33,6 +33,7 @@
   #:use-module (gnu packages disk)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages cdrom)
+  #:use-module (gnu packages check)
   #:use-module (gnu packages cross-base)
   #:use-module (gnu packages disk)
   #:use-module (gnu packages firmware)
@@ -49,6 +50,7 @@
   #:use-module (gnu packages python)
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages tls)
+  #:use-module (gnu packages sdl)
   #:use-module (gnu packages swig)
   #:use-module (gnu packages virtualization)
   #:use-module (gnu packages web)
@@ -317,6 +319,10 @@ menu to select one of the installed operating systems.")
      `(("bison" ,bison)
        ("flex" ,flex)
        ("swig" ,swig)))
+    (native-search-paths
+      (list (search-path-specification
+             (variable "PYTHONPATH")
+             (files '("/lib/python2.7/site-packages")))))
     (inputs
      `(("python-2" ,python-2)))
     (arguments
@@ -350,7 +356,11 @@ tree binary files.  These are board description files used by Linux and BSD.")
     (native-inputs
      `(("bc" ,bc)
        ("dtc" ,dtc)
+       ("openssl" ,openssl)
        ("python-2" ,python-2)
+       ("python2-coverage" ,python2-coverage)
+       ("python2-pytest" ,python2-pytest)
+       ("sdl" ,sdl)
        ("swig" ,swig)))
     (build-system  gnu-build-system)
     (home-page "http://www.denx.de/wiki/U-Boot/")
@@ -364,10 +374,34 @@ also initializes the boards (RAM etc).")
     (inherit u-boot)
     (name "u-boot-tools")
     (arguments
-     `(#:make-flags '("HOSTCC=gcc" "NO_SDL=1")
-       #:test-target "test"
+     `(#:make-flags '("HOSTCC=gcc")
+       #:test-target "tests"
        #:phases
        (modify-phases %standard-phases
+         (add-after 'unpack 'patch
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "Makefile"
+              (("/bin/pwd") (which "pwd"))
+              (("/bin/false") (which "false")))
+             (substitute* "tools/dtoc/fdt_util.py"
+              (("'cc'") "'gcc'"))
+             (substitute* "test/run"
+              ;; Make it easier to find test failures.
+              (("#!/bin/bash") "#!/bin/bash -x")
+              ;; pytest doesn't find it otherwise.
+              (("test/py/tests/test_ofplatdata.py")
+               "tests/test_ofplatdata.py")
+              ;; This test would require git.
+              (("\\./tools/patman/patman") (which "true"))
+              ;; This test would require internet access.
+              (("\\./tools/buildman/buildman") (which "true")))
+             (substitute* "test/py/tests/test_sandbox_exit.py"
+              (("def test_ctrl_c")
+               "@pytest.mark.skip(reason='Guix has problems with SIGINT')
+def test_ctrl_c"))
+             (substitute* "tools/binman/binman.py"
+              (("100%") "99%")) ; TODO: Find out why that is needed.
+             #t))
          (replace 'configure
            (lambda* (#:key make-flags #:allow-other-keys)
              (call-with-output-file "configs/tools_defconfig"
@@ -395,7 +429,16 @@ also initializes the boards (RAM etc).")
                            "tools/proftool"
                            "tools/fdtgrep"
                            "tools/env/fw_printenv"))
-               #t))))))
+               #t)))
+           (delete 'check)
+           (add-after 'install 'check
+             (lambda* (#:key make-flags test-target #:allow-other-keys)
+               (apply invoke "make" "mrproper" make-flags)
+               (setenv "SDL_VIDEODRIVER" "dummy")
+               (setenv "PAGER" "cat")
+               (apply invoke "make" test-target make-flags)
+               (symlink "build-sandbox_spl" "sandbox")
+               (invoke "test/image/test-imagetools.sh"))))))
     (description "U-Boot is a bootloader used mostly for ARM boards.  It
 also initializes the boards (RAM etc).  This package provides its
 board-independent tools.")))




Information forwarded to guix-patches <at> gnu.org:
bug#31520; Package guix-patches. (Sat, 26 May 2018 18:27:02 GMT) Full text and rfc822 format available.

Message #8 received at 31520 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Danny Milosavljevic <dannym <at> scratchpost.org>
Cc: 31520 <at> debbugs.gnu.org
Subject: Re: [bug#31520] [PATCH] gnu: u-boot-tools: Enable tests.
Date: Sat, 26 May 2018 20:26:20 +0200
Hey Danny,

Danny Milosavljevic <dannym <at> scratchpost.org> skribis:

> * gnu/packages/bootloaders.scm (dtc)[native-search-paths]: Add PYTHONPATH.
> (u-boot-tools)[native-inputs]: Add openssl, python2-coverage, python2-pytest,
> sdl.
> [arguments]<#:make-flags>: Remove NO_SDL.
> [arguments]<#:test-target>: Change to "tests".
> [arguments]<#:phases>[patch]: New phase.
> [arguments]<#:phases>[check]: Replace and move.

No need to repeat “[arguments]”.

> +    (native-search-paths
> +      (list (search-path-specification
> +             (variable "PYTHONPATH")
> +             (files '("/lib/python2.7/site-packages")))))

Why is it needed?  That would need a comment.  :-)  Even better if we
can achieve the same effect without defining this search path.

Also no need for the leading slash in ‘files’.

> +           (add-after 'install 'check
> +             (lambda* (#:key make-flags test-target #:allow-other-keys)
> +               (apply invoke "make" "mrproper" make-flags)
> +               (setenv "SDL_VIDEODRIVER" "dummy")
> +               (setenv "PAGER" "cat")
> +               (apply invoke "make" test-target make-flags)
> +               (symlink "build-sandbox_spl" "sandbox")
> +               (invoke "test/image/test-imagetools.sh"))))))

Please return #t.

Thanks!

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#31520; Package guix-patches. (Sat, 26 May 2018 19:17:02 GMT) Full text and rfc822 format available.

Message #11 received at 31520 <at> debbugs.gnu.org (full text, mbox):

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: ludo <at> gnu.org (Ludovic Courtès)
Cc: 31520 <at> debbugs.gnu.org
Subject: Re: [bug#31520] [PATCH] gnu: u-boot-tools: Enable tests.
Date: Sat, 26 May 2018 21:16:04 +0200
[Message part 1 (text/plain, inline)]
Hi Ludo,

On Sat, 26 May 2018 20:26:20 +0200
ludo <at> gnu.org (Ludovic Courtès) wrote:

> Why is it needed?  That would need a comment.  :-)

dtc has Python bindings and we build them.

The u-boot-tools tests use them (nothing else does).

I'll add a comment.

>  Even better if we
> can achieve the same effect without defining this search path.

Sure, I guess.  If you install dtc into your profile it won't work then though.

Also, do you think we should try to extract the Python bindings into its own
package?

> Also no need for the leading slash in ‘files’.

Okay.

> > +           (add-after 'install 'check
> > +             (lambda* (#:key make-flags test-target #:allow-other-keys)
> > +               (apply invoke "make" "mrproper" make-flags)
> > +               (setenv "SDL_VIDEODRIVER" "dummy")
> > +               (setenv "PAGER" "cat")
> > +               (apply invoke "make" test-target make-flags)
> > +               (symlink "build-sandbox_spl" "sandbox")
> > +               (invoke "test/image/test-imagetools.sh"))))))  
> 
> Please return #t.

invoke does :)

We can add another one, though.
[Message part 2 (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#31520; Package guix-patches. (Sun, 27 May 2018 13:11:01 GMT) Full text and rfc822 format available.

Message #14 received at 31520 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Danny Milosavljevic <dannym <at> scratchpost.org>
Cc: 31520 <at> debbugs.gnu.org
Subject: Re: [bug#31520] [PATCH] gnu: u-boot-tools: Enable tests.
Date: Sun, 27 May 2018 15:10:05 +0200
Hello Danny!

Danny Milosavljevic <dannym <at> scratchpost.org> skribis:

> On Sat, 26 May 2018 20:26:20 +0200
> ludo <at> gnu.org (Ludovic Courtès) wrote:
>
>> Why is it needed?  That would need a comment.  :-)
>
> dtc has Python bindings and we build them.

But then we do not need a search path definition in dtc itself; the one
in Python is enough.  Or am I missing something?

>>  Even better if we
>> can achieve the same effect without defining this search path.
>
> Sure, I guess.  If you install dtc into your profile it won't work then though.

I think there are two possible situations:

  1. dtc provides Python bindings that are useful to Python
     programmers.  This is addressed by having both Python and dtc in
     the same profile, in which case PYTHONPATH is automatically
     defined.  Nothing special to do.

  2. dtc is itself written in Python and needs to access its own
     Python code.  In that case we should wrap the ‘dtc’ command such
     that PYTHONPATH contains the right thing.

Does that make sense?

> Also, do you think we should try to extract the Python bindings into its own
> package?

Not necessarily, it probably doesn’t take up much space.

>> > +           (add-after 'install 'check
>> > +             (lambda* (#:key make-flags test-target #:allow-other-keys)
>> > +               (apply invoke "make" "mrproper" make-flags)
>> > +               (setenv "SDL_VIDEODRIVER" "dummy")
>> > +               (setenv "PAGER" "cat")
>> > +               (apply invoke "make" test-target make-flags)
>> > +               (symlink "build-sandbox_spl" "sandbox")
>> > +               (invoke "test/image/test-imagetools.sh"))))))  
>> 
>> Please return #t.
>
> invoke does :)

Oh, true, sorry!

Thanks,
Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#31520; Package guix-patches. (Sun, 27 May 2018 22:07:01 GMT) Full text and rfc822 format available.

Message #17 received at 31520 <at> debbugs.gnu.org (full text, mbox):

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: ludo <at> gnu.org (Ludovic Courtès)
Cc: 31520 <at> debbugs.gnu.org
Subject: Re: [bug#31520] [PATCH] gnu: u-boot-tools: Enable tests.
Date: Mon, 28 May 2018 00:05:45 +0200
[Message part 1 (text/plain, inline)]
Hi Ludo,

On Sun, 27 May 2018 15:10:05 +0200
ludo <at> gnu.org (Ludovic Courtès) wrote:

> > dtc has Python bindings and we build them.  
> 
> But then we do not need a search path definition in dtc itself; the one
> in Python is enough.  Or am I missing something?

There's a libfdt.py, provided by the dtc package, and u-boot-tools
tests use it.

Right now, we're not necessarily installing libfdt.py into python (?) or the
profile or anything.

Like u-boot-tools has somewhere (in its unit tests):

  #!/usr/bin/env python3
  import pylibfdt

And dtc provides

  libfdt.py

which could be useful for Python programmers, too.

>   1. dtc provides Python bindings that are useful to Python
>      programmers.  This is addressed by having both Python and dtc in
>      the same profile, in which case PYTHONPATH is automatically
>      defined.  Nothing special to do.

Yes.  But in this case u-boot-tools uses libfdt.py when building (testing) itself.
[Message part 2 (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#31520; Package guix-patches. (Mon, 28 May 2018 07:58:02 GMT) Full text and rfc822 format available.

Message #20 received at 31520 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Danny Milosavljevic <dannym <at> scratchpost.org>
Cc: 31520 <at> debbugs.gnu.org
Subject: Re: [bug#31520] [PATCH] gnu: u-boot-tools: Enable tests.
Date: Mon, 28 May 2018 09:57:37 +0200
Morning!

Danny Milosavljevic <dannym <at> scratchpost.org> skribis:

> On Sun, 27 May 2018 15:10:05 +0200
> ludo <at> gnu.org (Ludovic Courtès) wrote:
>
>> > dtc has Python bindings and we build them.  
>> 
>> But then we do not need a search path definition in dtc itself; the one
>> in Python is enough.  Or am I missing something?
>
> There's a libfdt.py, provided by the dtc package, and u-boot-tools
> tests use it.

OK.  If u-boot-tools has both Python and dtc as inputs, then PYTHONPATH
is correctly defined, isn’t it?

> Right now, we're not necessarily installing libfdt.py into python (?) or the
> profile or anything.

So we should make sure dtc installs libfdt.py in $prefix/lib/python2.7/….

Does that make sense?

Ludo’.




Reply sent to Danny Milosavljevic <dannym <at> scratchpost.org>:
You have taken responsibility. (Mon, 28 May 2018 21:53:02 GMT) Full text and rfc822 format available.

Notification sent to Danny Milosavljevic <dannym <at> scratchpost.org>:
bug acknowledged by developer. (Mon, 28 May 2018 21:53:02 GMT) Full text and rfc822 format available.

Message #25 received at 31520-done <at> debbugs.gnu.org (full text, mbox):

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: ludo <at> gnu.org (Ludovic Courtès)
Cc: 31520-done <at> debbugs.gnu.org
Subject: Re: [bug#31520] [PATCH] gnu: u-boot-tools: Enable tests.
Date: Mon, 28 May 2018 23:52:21 +0200
[Message part 1 (text/plain, inline)]
Hi Ludo,

On Mon, 28 May 2018 09:57:37 +0200
ludo <at> gnu.org (Ludovic Courtès) wrote:
> OK.  If u-boot-tools has both Python and dtc as inputs, then PYTHONPATH
> is correctly defined, isn’t it?

Hmm, then I don't understand how native-search-paths works.

I thought native-search-paths would just add $package/$path for the current
package--but it seems guix uses it as a pattern in all packages, not just
the package that specified it.

It indeed works if I remove native-search-paths from dtc, so I've pushed it
without.
[Message part 2 (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#31520; Package guix-patches. (Tue, 29 May 2018 14:35:01 GMT) Full text and rfc822 format available.

Message #28 received at 31520-done <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Danny Milosavljevic <dannym <at> scratchpost.org>
Cc: 31520-done <at> debbugs.gnu.org
Subject: Re: [bug#31520] [PATCH] gnu: u-boot-tools: Enable tests.
Date: Tue, 29 May 2018 16:33:55 +0200
Hello,

Danny Milosavljevic <dannym <at> scratchpost.org> skribis:

> Hmm, then I don't understand how native-search-paths works.

The search path spec is attached to the package that “owns” the given
variables.  So python has a spec for PYTHONPATH, Guile has a spec for
GUILE_LOAD_PATH, and so on.

Then, if you have both python and a python package in the same profile,
the machinery automatically defines PYTHONPATH according to the spec.

> It indeed works if I remove native-search-paths from dtc, so I've pushed it
> without.

Cool, thanks!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 27 Jun 2018 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 86 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.