You can start the tests automatically or manually:
Automatically running tests:
To run the tests automatically after the
OpenEmbedded build system successfully creates an image,
first set the
TEST_IMAGE
variable to "1" in your local.conf
file in the
Build Directory:
TEST_IMAGE = "1"
Next, build your image. If the image successfully builds, the tests will be run:
bitbake core-image-sato
Manually running tests:
To manually run the tests, first globally inherit the
testimage
class by editing your local.conf
file:
INHERIT += "testimage"
Next, use BitBake to run the tests:
bitbake -c testimage image
All test files reside in
meta/lib/oeqa/runtime
in the
Source Directory.
A test name maps directly to a Python module.
Each test module may contain a number of individual tests.
Tests are usually grouped together by the area
tested (e.g tests for systemd reside in
meta/lib/oeqa/runtime/systemd.py
).
You can add tests to any layer provided you place them in the
proper area and you extend
BBPATH
in the local.conf
file as normal.
Be sure that tests reside in
.
layer
/lib/oeqa/runtime
meta/lib/oeqa/runtime
.
You can change the set of tests run by appending or overriding
TEST_SUITES
variable in local.conf
.
Each name in TEST_SUITES
represents a
required test for the image.
Test modules named within TEST_SUITES
cannot be skipped even if a test is not suitable for an image
(e.g. running the RPM tests on an image without
rpm
).
Appending "auto" to TEST_SUITES
causes the
build system to try to run all tests that are suitable for the
image (i.e. each test module may elect to skip itself).
The order you list tests in TEST_SUITES
is important and influences test dependencies.
Consequently, tests that depend on other tests should be added
after the test on which they depend.
For example, since the ssh
test
depends on the
ping
test, "ssh" needs to come after
"ping" in the list.
The test class provides no re-ordering or dependency handling.
unittest
rules apply.
Here are some things to keep in mind when running tests:
The default tests for the image are defined as:
DEFAULT_TEST_SUITES_pn-image
= "ping ssh df connman syslog xorg scp vnc date rpm dnf dmesg"
Add your own test to the list of the by using the following:
TEST_SUITES_append = " mytest"
Run a specific list of tests as follows:
TEST_SUITES = "test1 test2 test3"
Remember, order is important. Be sure to place a test that is dependent on another test later in the order.