[PATCH] gnu: u-boot-tools: Enable tests.

  • Done
  • quality assurance status badge
Details
2 participants
  • Danny Milosavljevic
  • Ludovic Courtès
Owner
unassigned
Submitted by
Danny Milosavljevic
Severity
normal

Debbugs page

Danny Milosavljevic wrote 7 years ago
(address . guix-patches@gnu.org)(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
20180518191247.18456-1-dannym@scratchpost.org
* 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(-)

Toggle diff (98 lines)
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.")))
Ludovic Courtès wrote 7 years ago
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)(address . 31520@debbugs.gnu.org)
878t861df7.fsf@gnu.org
Hey Danny,

Danny Milosavljevic <dannym@scratchpost.org> skribis:

Toggle quote (8 lines)
> * 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]”.

Toggle quote (5 lines)
> + (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’.

Toggle quote (9 lines)
> + (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’.
Danny Milosavljevic wrote 7 years ago
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 31520@debbugs.gnu.org)
20180526211604.72c336bf@scratchpost.org
Hi Ludo,

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

Toggle quote (2 lines)
> 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.

Toggle quote (3 lines)
> 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?

Toggle quote (2 lines)
> Also no need for the leading slash in ‘files’.

Okay.

Toggle quote (11 lines)
> > + (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.
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAlsJsnQACgkQ5xo1VCww
uqVNegf+Popjs2XCAUE7BCQzqDfOssInjtOW4fGnNrjKFbBn+yt8dB5NwDjc2dnH
222vgR4NawFIXpEh0+sskxsQi1yQJRhGlVt9pyy/Ak1a33Sxh419WhpQpWmitLeA
8X/aywckcb1G7L/hux/huw1pavPOXc/7VsJBVCI4EDxWNLTv6In4/U5veJXczOST
EQFop8ROTkn2e2Jwd4M4cWh5Qw3XQowy/BRggh8i8Z31Mykpc7Jq0bxuClFOR+Tm
odkwxBuWQJGTo0N3lNnwGofvRQgxOBiV2ufpizK5bIuC77EAV5SzqZxY9dI/5a3c
AVc9wkXpT3oZX3I53LeaSgt1WjbKPA==
=AbRy
-----END PGP SIGNATURE-----


Ludovic Courtès wrote 7 years ago
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)(address . 31520@debbugs.gnu.org)
876039xn0y.fsf@gnu.org
Hello Danny!

Danny Milosavljevic <dannym@scratchpost.org> skribis:

Toggle quote (7 lines)
> On Sat, 26 May 2018 20:26:20 +0200
> ludo@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?

Toggle quote (5 lines)
>> 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?

Toggle quote (3 lines)
> 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.

Toggle quote (13 lines)
>> > + (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’.
Danny Milosavljevic wrote 7 years ago
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 31520@debbugs.gnu.org)
20180528000545.50ceb0ba@scratchpost.org
Hi Ludo,

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

Toggle quote (5 lines)
> > 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.

Toggle quote (5 lines)
> 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.
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAlsLK7kACgkQ5xo1VCww
uqWMKggAjDDkWIFG0wunC60rhExkwbsduBP4301PPAVta3uWlcg6jmne3WnLA9Ra
fqsK30YRN8npRZAa2SCuDtUXp6e3LFRoqheS+rng3JV34+nJIUJYNoIHo1ffpNKU
uneMaoajCq97ehatJiO+g6IrXg0RsYiWY0HsV28J4XCw7Ei5TNnzI9wPTVuvMjsj
b9jyATPAs/h9Ashi/Tlw+l5zTaGXZaW1Io71DSI66PiuX82gu7khj9ljTbBrZpNW
jqg+0Nukv//UDqbhmN3NTSOZ8mscnYs/hC38CGX5Z4VQYNXMo+C1aTK2mL//klP/
8QL1e2DKLd2WDvPfOYVI37d0ibL0Rw==
=Kx3W
-----END PGP SIGNATURE-----


Ludovic Courtès wrote 7 years ago
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)(address . 31520@debbugs.gnu.org)
874lis43gu.fsf@gnu.org
Morning!

Danny Milosavljevic <dannym@scratchpost.org> skribis:

Toggle quote (11 lines)
> On Sun, 27 May 2018 15:10:05 +0200
> ludo@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?

Toggle quote (3 lines)
> 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’.
Danny Milosavljevic wrote 7 years ago
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 31520-done@debbugs.gnu.org)
20180528235221.55ae2b83@scratchpost.org
Hi Ludo,

On Mon, 28 May 2018 09:57:37 +0200
ludo@gnu.org (Ludovic Courtès) wrote:
Toggle quote (3 lines)
> 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.
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAlsMehUACgkQ5xo1VCww
uqXJmQf5Af0tBSXx4Cm6kDFxUPFh5QGi1CxUPLjjmhkBDRFq0bZ1jz0jfYJoAU4/
AU9aBIxmFzE88qMERHyir6aq7G1MnrxEZiFsU6FStibmz0I4K1JTF9dA7Xqt9n8H
cu6qbTLFKZ4+7SpiD3nZj33o3rBfzRdnlzSTk+1Fbq2X7CBJ7FloBAByTTvwa5W5
lUCwfQn3oRQjThogtQ4IfPihVZcl4FpN2MnHiOVYOr8hKjnaQg31xZqI7HL/t+/9
7yChrguFVgC5bAYC3/UyH/2Wth9+ZjEL9RvYoXInzgM4EQTf/8qIVt1ybrg3kOGR
BO/ge5F8SaCplBni88sRCdzJOJJ26Q==
=Bb3r
-----END PGP SIGNATURE-----


Closed
Ludovic Courtès wrote 7 years ago
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)(address . 31520-done@debbugs.gnu.org)
87zi0iy1ik.fsf@gnu.org
Hello,

Danny Milosavljevic <dannym@scratchpost.org> skribis:

Toggle quote (2 lines)
> 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.

Toggle quote (3 lines)
> It indeed works if I remove native-search-paths from dtc, so I've pushed it
> without.

Cool, thanks!

Ludo’.
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 31520@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 31520
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help