Commit Graph

408 Commits

Author SHA1 Message Date
Peter Korsgaard
f697096a77 support/testing: drop python2 tests
Python2 for the target is about to get removed, so drop the tests using it.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2022-02-09 22:07:33 +01:00
Arnout Vandecappelle (Essensium/Mind)
11f8b9fb45 support/testing: fix test_lua_cffi.py flake8 error
support/testing/tests/package/test_lua_cffi.py:14:1: W391 blank line at end of file

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2022-02-07 08:52:55 +01:00
Francois Perrad
13114d0f93 package/lua-cffi: new package
Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2022-02-06 20:22:12 +01:00
Francois Perrad
d32e062f1c package/lua: use Lua 5.4 as default
lua-sdl2 is not available on Lua 5.4, so update its test to use Lua 5.3
instead.

Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2022-02-05 23:45:19 +01:00
Julien Olivain
9a79397fc5 support/testing: add test for python-gnupg
This commit add a simple test doing symmetric encryption/decryption
to check this python interface with the gpg binary is working fine.

Signed-off-by: Julien Olivain <ju.o@free.fr>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2022-01-26 18:01:08 +01:00
Thomas Petazzoni
7df632905f toolchain/toolchain-external/toolchain-external-bootlin: update with new x86-64 toolchains
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2022-01-25 08:41:02 +01:00
Herve Codina
af5b1ec68b support/testing/tests/package/test_libshdata: new test
This new test ensures that libraries and binaries generated
using Parrot Alchemy build system are correct.
Indeed, the test uses libshdata-stress.
This binary depends on libshdata.
libshdata depends on libfutils and libfutils depends on ulog.
All of these binaries and libraries are built using Alchemy.

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2022-01-12 00:30:06 +01:00
Thomas Petazzoni
e5ead094e1 support/testing/tests: switch python-cryptography related tests to glibc
In a follow-up commit, we are about to bump python-cryptography to a
new version, which has the interesting charateristic of using Rust
code. This means python-cryptography will now only be available on
platforms supported by Rust, which for now excludes uclibc-based
configurations (none of the Rust Tier1/Tier2 platforms use uClibc,
there is some uClibc support in Tier3 platforms but they have not been
added to Buildroot for now).

So in preparation for this bump, we switch the few test cases of
Python packages that directly or indirectly use python-cryptography to
use a glibc toolchain. Another impacted test case is the
docker-compose test case, but it already uses a glibc toolchain;

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2022-01-09 12:13:49 +01:00
Francois Perrad
e39379ff59 package/lua-inotify: new package
Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2022-01-08 18:03:59 +01:00
Arnout Vandecappelle (Essensium/Mind)
0233b84204 support/testing: tyest_python_pybind.py: fix flake8 errors
support/testing/tests/package/test_python_pybind.py:1:1: F401 'os' imported but unused
support/testing/tests/package/test_python_pybind.py:3:1: F401 'subprocess' imported but unused
support/testing/tests/package/test_python_pybind.py:6:1: E302 expected 2 blank lines, found 1
1     E302 expected 2 blank lines, found 1
2     F401 'os' imported but unused

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2022-01-08 09:15:36 +01:00
Guillaume W. Bres
87f2b7004e support/testing: add test for python-pybind
The way that python-pybind can be used is fairly complicated, so a
runtime test for it is convenient. In addition, this test validates that
the headers actually work at runtime.

Signed-off-by: Guillaume W. Bres <guillaume.bressaix@gmail.com>
[Arnout:
 - Retain python3 only.
 - python-pybind is a target package, not host.
 - Select python-pybind instead of depend.
 - Simplify python-pybind-example package.
 - Check in python-pybind-example build if pybind11.get_include()
   produces output.
 - Don't use python3 -m pybind11 --includes: it includes the main python
   includes, which are for the host, not for the target.
 - Use TestPythonPackageBase instead of open-coding something imported
   with host python.
]
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2022-01-07 22:26:08 +01:00
Mikael Bourhis-Cloarec
bc91d35da7 support/testing: add package/test_mender.py
Create a test to check Mender client at runtime.

The aim of this test is:
  - to check the correct execution of simple Mender commands,
    in a minimal environment;
  - to validate there is no missing dependencies for runtime.

This test is not a board integration test for Mender,
including well-configured bootloader, partitioning, ...

Check:
  - the daemon is started;
  - the current 'artifact name' (name of the image or update) of the active
    partition is read, without error.

For that, we need to fake (see the 'overlay' directory):
  - some bootloader environment variables;
  - the name of an update.

Signed-off-by: Mikael Bourhis-Cloarec <mikael.bourhis@smile.fr>
[Romain: remove single hyphen command (Mender 3.0.0)]
Signed-off-by: Romain Naour <romain.naour@smile.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2022-01-07 19:05:46 +01:00
Arnout Vandecappelle (Essensium/Mind)
9d7abbfed8 support/testing: add runtime test for python-iptables
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2022-01-06 22:05:03 +01:00
Arnout Vandecappelle (Essensium/Mind)
007b5b483f support/testing/tests/download/sshd.py: fix flake8 warning
support/testing/tests/download/sshd.py:50:28: E261 at least two spaces before inline comment
1     E261 at least two spaces before inline comment

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2022-01-06 10:27:39 +01:00
Thomas Preston
fd548e16fb support/testing: Add download tests for SCP/SFTP
Add download test infrastructure which starts an OpenSSH server using
the sshd binary installed on the Buildroot host. This server can then be
used to test the expected usage of the SCP and SFTP download methods.
The test creates new SSH keys for the server and client, so that the
server can be run as a non-root user.

A new test module has been added called `tests.download.sshd` which
contains helper methods to create the SSH keys and a class called
`OpenSSHDaemon` which handles the sshd server component.

The tests download example packages in the br2-external project `ssh`.
They check the following conditions for both SCP and SFTP download
methods:
- Correct hash.
- Incorrect hash.
- No hash file.

The SSH download test infrastructure is based on test_git.py.

Signed-off-by: Thomas Preston <thomas.preston@codethink.co.uk>
[Arnout:
 - remove spurious end-of-line backslash;
 - remove unnecessary executable bit;
 - skip test instead of failing if sshd, ssh-keygen, scp or sftp are not
   found;
 - decode the output of subprocess;
 - use subprocess.check_output instead of subprocess.get_output;
 - use subprocess.check_call instead of manually checking return code;
 - don't set always-overridden SSHD_PORT_NUMBER in .mk file;
 - explicitly set sshd options on commandline instead of relying on host
   /etc/sshd/sshd_config;
 - let sshd listen only on localhost;
 - user internal sftp server;
 - disable BACKUP_SITE, no network is supposed to be accessed;
 - remove the -bad and -nohash versions;
 - rename {sftp,scp}-good to plain {sftp,scp};
 - move the sftp and scp packages into a single "ssh" external.
]
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2022-01-06 09:34:05 +01:00
Thomas Preston
a2f11c0cbf testing/infra: Add docstrings to base test classes
It wasn't immediately obvious to me what the two Buildroot base test
classes were for, so add docstrings to explain the differences between
BRConfigTest and BRTest.

Signed-off-by: Thomas Preston <thomas.preston@codethink.co.uk>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2022-01-06 09:34:05 +01:00
Thomas Petazzoni
63b72a7c15 package/python-aexpect: new package
This package was initially requested by José Pekkarinen, so he is
assigned as the maintainer for it.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2022-01-06 09:28:57 +01:00
Thomas Petazzoni
b3c66481e1 toolchain: re-generate Bootlin toolchain descriptions
Following the releases of 2021.11 Bootlin toolchains, this commit
represents the result of re-running the gen-bootlin-toolchains script.

The only part that isn't auto-generated are the contents of
Config.in.legacy, which account for the replacement of the RISC-V LP64
toolchain by RISC-V LP64D toolchains.

The complete set of runtime test cases was verified on Gitlab CI:

  https://gitlab.com/tpetazzoni/buildroot/-/pipelines/437767674

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2021-12-30 18:43:23 +01:00
Francois Perrad
a15cb73b49 package/lua-argon2: new package
Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2021-12-27 22:25:30 +01:00
Arnout Vandecappelle (Essensium/Mind)
7a947133ab support/testing: test_php_lua: fix flake8 error
support/testing/tests/package/test_php_lua.py:35:1: E302 expected 2 blank lines, found 1

Add the missing line before class definition.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2021-12-20 18:56:15 +01:00
Herve Codina
403b62943b package/php-pam: new package
The php-pam package provides a PHP PAM (Pluggable Authentication
Modules) integration.

https://pecl.php.net/package/PAM

Based on initial work from Nicolas Carrier <nicolas.carrier@orolia.com>

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2021-12-17 22:46:55 +01:00
Herve Codina
d49127dd4c package/php-lua: new package
The php-lua package provides a PHP extension that embeds the lua
interpreter and offers an OO-API to lua variables and functions.

https://pecl.php.net/package/lua

Based on initial work from Nicolas Carrier <nicolas.carrier@orolia.com>

Two patches are present and were retrieved from the following
upstream pull request in order to support PHP8:
https://github.com/laruence/php-lua/pull/47

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2021-12-17 22:46:55 +01:00
Herve Codina
8ddeeffa18 package/php-apcu: new package
APCu is an in-memory key-value store for PHP.
Keys are of type string and values can be any PHP variables.
APCu only supports userland caching of variables

https://pecl.php.net/package/APCU

Based on initial work from Nicolas Carrier <nicolas.carrier@orolia.com>

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2021-12-17 22:46:55 +01:00
Romain Naour
8cce2ce1d2 support/testing: add gitlab download helper testing
Like for the github helper, add some tests to test the download of
Gitlab's generated tarball.

[1] f83826c90d

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Yann E. MORIN <yann.morin.1998@free.fr>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2021-12-06 22:12:24 +01:00
Romain Naour
1ca6ab6ace support/testing: add github download helper testing
Back in 2013, a github download helper has been introduced to cope with
changes in github download-URL's [1][2].

Since then a testing infrastructure has been introduced in Buildroot
but no tests has been added to check if the github download helper is
still working.

It was reported recently [3] that the github helper doesn't work anymore
using tags. Buildroot is not the only project having the issue, see
Github feedback discussions [4].

Add tests for direct archive download (archives uploaded by maintainers),
download from a git tag and git hash using the github helper.
Make sure that Buildroot doesn't use BR2_BACKUP_SITE
(http://sources.buildroot.net).

[1] https://bugs.busybox.net/show_bug.cgi?id=6302
[2] c7c7d0697c
[3] https://bugs.busybox.net/show_bug.cgi?id=14396
[4] https://github.com/github/feedback/discussions/8149

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: Yann E. MORIN <yann.morin.1998@free.fr>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2021-12-06 22:12:20 +01:00
Romain Naour
bff1c6ada5 support/testing: test_luvi: make luvi test reproducible
As explained by Jörg [1], iteration with pairs() does not result in the
same order since luajit 2.1.

From [2]
"Table iteration with pairs() does not result in the same order?

The order of table iteration is explicitly undefined by the Lua
language standard. Different Lua implementations or versions may use
different orders for otherwise identical tables. Different ways of
constructing a table may result in different orders, too. Due to
improved VM security, LuaJIT 2.1 may even use a different order on
separate VM invocations or when string keys are newly interned.

If your program relies on a deterministic order, it has a bug.
Rewrite it, so it doesn't rely on the key order.
Or sort the table keys, if you must."

Note: The "luvi -v" return 255 even on success.

[1] http://lists.busybox.net/pipermail/buildroot/2021-November/627938.html
[2] https://luajit.org/faq.html

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: Francois Perrad <francois.perrad@gadz.org>
Cc: Jörg Krause <joerg.krause@embedded.rocks>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2021-11-12 23:26:17 +01:00
Romain Naour
1477b60d4e support/testing: test_luvi: switch to armv5 to boot with rng support enabled
Since the commit replacing moonjit by luajit [1] luvi doesn't work without
rng support enabled.

Switch to armv5 to use virtio-rng-pci on the qemu command line [2].

[1] 9450b53c8e
[2] https://git.buildroot.net/buildroot/tree/support/testing/infra/emulator.py?h=2021.08.1

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: Jörg Krause <joerg.krause@embedded.rocks>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2021-11-12 23:23:44 +01:00
Pierre-Jean Texier
38c1c535ad support/testing/tests/package/sample_python_unittest_xml_reporting.py: fix flake8 warnings
Fixes:

support/testing/tests/package/sample_python_unittest_xml_reporting.py:4:1: E302 expected 2 blank lines, found 1
support/testing/tests/package/sample_python_unittest_xml_reporting.py:8:1: E305 expected 2 blank lines after class or function definition, found 1
1     E302 expected 2 blank lines, found 1
1     E305 expected 2 blank lines after class or function definition, found 1

Signed-off-by: Pierre-Jean Texier <texier.pj2@gmail.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2021-11-08 22:12:22 +01:00
Pierre-Jean Texier
7140ebbda5 support/testing/tests/package/test_python_unittest_xml_reporting.py: fix flake8 warnings
Fixes:

support/testing/tests/package/test_python_unittest_xml_reporting.py:3:1: F401 'time' imported but unused
1     F401 'time' imported but unused
make: *** [Makefile:1220: check-flake8] Error 123

Signed-off-by: Pierre-Jean Texier <texier.pj2@gmail.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2021-11-08 22:12:13 +01:00
Romain Naour
d2f92512f6 support/testing: test_jffs2.py: update logical eraseblock size for qemu >= 2.9
The test_jffs2 test fail for the same reason as test_ubi test with qemu >= 2.9
due to a qemu 2.8 bug. See commit d8447c38f5.

Divide the erase block size by two.

Fixes:
https://gitlab.com/buildroot.org/buildroot/-/jobs/1687590514

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2021-11-05 22:30:36 +01:00
Thomas Petazzoni
9d3428beca package/python-unitest-xml-reporting: new package
Based on initial work from Nicolas Carrier
<nicolas.carrier@orolia.com>, with the following additions:

- Updated to a newer version
- Added proper license file handling
- Added runtime test case
- Restricted to Python 3.x

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2021-11-05 17:04:32 +01:00
Romain Naour
8b4a675854 support/testing: fix the TestPythonPy[2,3]Incremental test cases
The recent python-incremental version bump (commit
fd03cb5a12) added a change/fix
in incremental.Version().

python-incremental 17.5.0 return: "[package, version 1.2.3rc4]")
python-incremental 21.3.0 return: "[package, version 1.2.3.rc4]")

Fixes:
https://gitlab.com/buildroot.org/buildroot/-/jobs/1710552692
https://gitlab.com/buildroot.org/buildroot/-/jobs/1710552693

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: Asaf Kahlon <asafka7@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2021-10-31 18:42:55 +01:00
Herve Codina
7f9ad0ed7f package/php-pecl-dbus: new package
The php-pecl-dbus package provides a PHP extension for interaction
with D-Bus busses.

https://github.com/derickr/pecl-dbus

Based on initial work from Nicolas Carrier <nicolas.carrier@orolia.com>

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2021-10-27 22:10:38 +02:00
Raphaël Mélotte
5562eb58e8 support/testing: add new test for python-boto3
Add a rudimentary test inspired from the "Using boto3" section in
the package README ([1]).

Note that it doesn't try to do anything with the instanciated
resource, as this would require a network connection when the test
runs.

[1]: https://github.com/boto/boto3

Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2021-10-26 21:34:27 +02:00
Raphaël Mélotte
9060f1a6b8 support/testing: add new test for python-botocore
Add a rudimentary test inspired from the "Using botocore" section in
the package README ([1]).

Note that it doesn't try to use the instantiated client, as this would
require a network connection when the test runs.

[1]: https://github.com/boto/botocore

Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2021-10-26 21:34:27 +02:00
Raphaël Mélotte
0514ced833 support/testing: test_python_rsa: increase timeout
On some developers machines, the default timeout (5 seconds) is not
enough for the test to succeed.

Increase it to 20 seconds, to let more time for the rsa keys to be
generated.

Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2021-10-26 21:34:15 +02:00
Adam Duskett
1e363383b6 support/testing/tests/package/test_python_pyndiff: new test
A simple test that runs nmap twice to create the files scanme-1.xml and
scanme2.xml, then runs pyndiff on both files.

Signed-off-by: Adam Duskett <aduskett@gmail.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2021-10-21 22:48:44 +02:00
Arnout Vandecappelle (Essensium/Mind)
d721c95b8b support: fix flake8 error E741 ambiguous variable name
A recent update of flake8 in CI introduced a new check E741. It
basically checks that variables are at least 3 characters long. Up to
now, however, we have used shorter names in some places - all of them
turn out to be "l" for a line of text.

Replace all those "l" variables with "line".

Fixes: https://gitlab.com/buildroot.org/buildroot/-/jobs/1687009829
partially:
support/scripts/boot-qemu-image.py:47:21: E741 ambiguous variable name 'l'
support/scripts/check-dotconfig.py:20:38: E741 ambiguous variable name 'l'
support/scripts/size-stats:76:13: E741 ambiguous variable name 'l'
support/testing/tests/core/test_bad_arch.py:17:32: E741 ambiguous variable name 'l'
support/testing/tests/package/test_python_treq.py:10:30: E741 ambiguous variable name 'l'
support/testing/tests/toolchain/test_external.py:30:42: E741 ambiguous variable name 'l'

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2021-10-18 22:31:11 +02:00
Arnout Vandecappelle (Essensium/Mind)
1217817ac2 support/testing: sample_python_dbus_next: ignore F821 flake8 error
The dbus-next package uses the Python type annotation for dbus types. This is
not compatible with the python typing assumption that flake8 makes.

Exclude F821 from this line.

Fixes: https://gitlab.com/buildroot.org/buildroot/-/jobs/1687009829
partially:
support/testing/tests/package/sample_python_dbus_next.py:17:36: F821 undefined name 's'
support/testing/tests/package/sample_python_dbus_next.py:17:48: F821 undefined name 's'
support/testing/tests/package/sample_python_dbus_next.py:17:56: F821 undefined name 's'

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2021-10-18 22:30:44 +02:00
Romain Naour
e11c3cbe26 support/testing: test_ubi: allow to boot several times using the same ubi image.
Since the ubi/ubifs test has been introduced, it's not possible to
boot the same ubi image twice [1]:

"TODO: if you boot Qemu twice on the same UBI image, it fails to
attach the image the second time, with "ubi0 error:
ubi_read_volume_table: the layout volume was not found"."

For some reason, the kernel corrupt the ubi image if the ubifs
rootfs is mounted with write access. Use a custom config file
to mount the rootfs readonly (vol_type=static). Doing so requires
to add the flash size (vol_size=64MiB).

At least it allows to boot several times the same ubi image.

[1] bf4a6490e4

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2021-10-17 21:47:04 +02:00
Romain Naour
d8447c38f5 support/testing: update logical eraseblock and physical eraseblock size for qemu >= 2.9
The current ubi/ubifs test (test_ubi.py) rely on a Qemu bug present in
2.8.0 that was fixed in Qemu 2.9.0 [1]. The ubi/ubifs settings is
updated to run with Qemu >= 2.9.0 using the new multiple chip handling.

If needed, the old behavior can be enabled using the pflash01 property
"old-multiple-chip-handling" [2].

The issue was not detected until now since we are sill using an old
qemu (2.8 from Debian stretch) for testing in gitlab (using the
Buildroot Docker image used by gitlab-ci.yml).

First the logical eraseblock size (LEB) must be updated to the value
0x3ff80 reported by the kernel when using qemu >= 2.9.0.

  UBIFS (ubi0:0): Mounting in unauthenticated mode
  UBIFS error (ubi0:0 pid 1): ubifs_read_superblock: LEB size mismatch: 524160 in superblock, 262016 real
  UBIFS error (ubi0:0 pid 1): ubifs_read_superblock: bad superblock, error 1

But the system is still failing to boot:

 UBIFS error (ubi0:0 pid 1): ubifs_scan: garbage
 UBIFS error (ubi0:0 pid 1): ubifs_recover_master_node: failed to recover master node

ubifs is reading garbage since Qemu >= 2.9.0 report a sector
length per device divided by the number of devices (see commit [1]).

The kernel detect two flash devices (dmesg):

  Concatenating MTD devices:
  (0): "40000000.flash"
  (1): "40000000.flash"
  into device "40000000.flash"

Divide the physical eraseblock (PEB) size by two.

Tested with qemu 2.9.0, 5.1.0.

Fixes:
https://gitlab.com/kubu93/buildroot/-/jobs/1543100932

[1] https://git.qemu.org/?p=qemu.git;a=commitdiff;h=feb0b1aa11f14ee71660aba46b46387d1f923c9e
[2] http://lists.busybox.net/pipermail/buildroot/2021-September/622069.html

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2021-10-17 21:47:02 +02:00
Romain Naour
1ab2dd6aa5 support/testing: test_ubi: add image format on the qemu command line
Adding the Image format on the Qemu command line avoid this warning:

"WARNING: Image format was not specified for 'output/TestUbi/images/rootfs.ubi' and probing guessed raw.
         Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions."

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2021-10-17 21:46:59 +02:00
Romain Naour
6f9e83f5f7 support/testing: test_ubi: reduce the rootfs.ubi size to 64M to match the Qemu emulated flash device
The size of the cfi flash device emulated by Qemu is 64M not 128M [1].
Since Qemu >= 4.0, the size of the device must match the size of the block backend [2].

Fixes:

  qemu-system-arm: device requires 67108864 bytes, block backend provides 134217728 bytes

[1] https://git.qemu.org/?p=qemu.git;a=blob;f=hw/arm/vexpress.c;h=58481c07629aedb09864dcc72757ff7947e733bb;hb=f9baca549e44791be0dd98de15add3d8452a8af0#l50
[2] https://git.qemu.org/?p=qemu.git;a=commitdiff;h=06f1521795207359a395996c253c306f4ab7586e

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2021-10-17 21:46:57 +02:00
Yann E. MORIN
128af17dce support/testing: fix python_flask_expect_python
Commit e6ee07f41a (package/python-flask-expects-json: new package)
added a non-functional test case that, as noticed by Edgar, fails with:

    AssertionError: '%{http_code}' != '200'

That's because the % sign is self-escaped, à-la C, in the first part
of the command, probably to avoid its being %-formatted. But only the
second part of the command is %-formatted, so we do not need to
self-escape % in the first part.

Additionally, since eb3ee3078a (support/testing/infra/emulator.py:
prevent the commands from wrapping), we no longer need to play tricks
with commands that are too long to fit on the first line of the shell
prompt.

Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Edgar Bonet <bonet@grenoble.cnrs.fr>
Reviewed-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2021-10-12 22:51:25 +02:00
Herve Codina
36395e4762 package/lua-augeas: new package
The lua-augeas package provides a Lua binding for augeas

https://github.com/ncopa/lua-augeas

Based on initial work from Nicolas Carrier <nicolas.carrier@orolia.com>

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2021-10-12 22:21:12 +02:00
Herve Codina
9fc7b49ab1 package/dtbocfg: new package
dtbocfg, which stands for Device Tree Blob Overlay Configuration
File System, was developed to serve as a userspace API of Device
Tree Overlay.

https://github.com/ikwzm/dtbocfg

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2021-10-11 22:50:40 +02:00
Thomas Petazzoni
1ea0ae0349 support/testing: add suite of tests for gdb
The list of tests is as follows:

TestGdbHostOnlyDefault: build just minimal host-gdb, default version

TestGdbHostOnlyAllFeatures: build host-gdb, default version, with all
features enabled (TUI, Python, simulator)

TestGdbserverOnly: build just target gdbserver, default version

TestGdbFullTarget: build just target gdb, default version

TestGdbHostOnly9x: build minimal host-gdb, 9.x version

TestGdbHostGdbserver9x: build minimal host-gdb 9.x + gdbserver

TestGdbHostGdbTarget9x: build minimal host-gdb 9.x + full gdb

TestGdbHostOnly11x: build minimal host-gdb, 11.x version

TestGdbHostGdbserver11x: build minimal host-gdb 11.x + gdbserver

TestGdbHostGdbTarget11x: build minimal host-gdb 11.x + gdb

TestGdbArc: build minimal host-gdb + gdb + gdbserver, for the special
ARC architecture version

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2021-10-10 19:41:32 +02:00
Edgar Bonet
eb3ee3078a support/testing/infra/emulator.py: prevent the commands from wrapping
Traditional VT-10x terminals (and their emulators) [0] have a "magic
margins" feature that enables the last character position to be updated
without scrolling the screen: whenever a character is printed on the
last column, the cursor stays over the character, instead of moving to
the next line.

The Busybox shell, ash, attempts to defeat this feature by printing
CR,LF right after echoing a character to the last column.[1] This
doesn't play well with emulator.py. The run() method of the Emulator
class captures the output of the emulated system and assumes the first
line it reads is the echo of the command, and all subsequent lines are
the command's output. If the line made by the command + shell prompt is
longer than 80 characters, then it is echoed as two or more lines, and
all but the first one are mistaken for the command's output.

We fix this by telling the emulated system that we are using an
ultra-wide terminal with 29999 columns. Larger values would be ignored
and replaced by the default, namely 80 columns.[2]

[0] https://vt100.net/docs/vt100-ug/chapter3.html  -  DECAWM
[1] https://git.busybox.net/busybox/tree/libbb/lineedit.c?h=1_34_0#n412
[2] https://git.busybox.net/busybox/tree/libbb/xfuncs.c?h=1_34_0#n258

Signed-off-by: Edgar Bonet <bonet@grenoble.cnrs.fr>
Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Co-authored-by: Yann E. MORIN <yann.morin.1998@free.fr>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2021-10-06 21:54:20 +02:00
Kory Maincent
c656373aeb support/testing/tests/fs/test_iso9660.py: add support to test using EFI BIOS
The ISO9660 tests are only testing BIOS Legacy.
Add support to test an ISO9660 image based on EFI BIOS.
Add support to test an ISO9660 hybrid image based on Legacy and EFI BIOS.
Add dedicated Grub2 builtin config for the EFI compatible cases.

Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2021-10-03 14:45:10 +02:00
Kory Maincent
d6d7cbb8e0 support/testing: don't fail on tests emitting invalid utf-8 sequences
When booting under EFI, grub2 will output a nice and shiny boot menu,
using extended ASCII characters (in the [0x80..0xFF] range), namely
CP437 [0], on the assumption that the VGA BIOS is a real one and has the
corresponding (and only!) font, as is the case on real hardware.

However, when run in our runtime test infrastructure, this triggers the
infamous python UnicodeDecodeError exception:

    Traceback (most recent call last):
      [...]
        emulator.login()
      File "[...]/buildroot/support/testing/infra/emulator.py", line 89, in login
        index = self.qemu.expect(["buildroot login:", pexpect.TIMEOUT],
      File "/usr/lib/python3/dist-packages/pexpect/spawnbase.py", line 340, in expect
        return self.expect_list(compiled_pattern_list,
      File "/usr/lib/python3/dist-packages/pexpect/spawnbase.py", line 369, in expect_list
        return exp.expect_loop(timeout)
      File "/usr/lib/python3/dist-packages/pexpect/expect.py", line 111, in expect_loop
        incoming = spawn.read_nonblocking(spawn.maxread, timeout)
      File "/usr/lib/python3/dist-packages/pexpect/pty_spawn.py", line 485, in read_nonblocking
        return super(spawn, self).read_nonblocking(size)
      File "/usr/lib/python3/dist-packages/pexpect/spawnbase.py", line 178, in read_nonblocking
        s = self._decoder.decode(s, final=False)
      File "/usr/lib/python3.8/codecs.py", line 322, in decode
        (result, consumed) = self._buffer_decode(data, self.errors, final)
    UnicodeDecodeError: 'utf-8' codec can't decode byte 0xda in position 0: invalid continuation byte

Grub2 is not wrong in emitting those chars, and basically we should not
expect the packages we test to always emit correct UTF-8 sequences; at
the very least, this should not cause the test infra to fail.

We fix that by telling pexpect.spawn to "fix" such invalid sequences by
replacing them with the suitable Unicode character, U+FFFD REPLACEMENT
CHARACTER.

[0] https://en.wikipedia.org/wiki/Code_page_437
[1] https://docs.python.org/3/library/codecs.html#error-handlers

Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
[yann.morin.1998@free.fr:
  - don't change encoding, use codec_errors
  - rewrite commit log accordingly
]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2021-10-03 14:26:12 +02:00