Commit Graph

72 Commits

Author SHA1 Message Date
Costin Constantin 393bd7496d oeqa/oetest.py: add better package search for hasPackage()
Modified hasPackage() to split the content of pacakage manifest file
in containing lines and search at the begining of each line the
existance of the needed pkg.

[YOCTO #8170]

(From OE-Core rev: f07045fcae859c902434062d1725f1348f42d1dd)

Signed-off-by: Costin Constantin <costin.c.constantin@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-08-26 08:28:06 +01:00
Mariano Lopez 857da0884a oetest.py: Don't wait to write dump files
This allows to write the dump files immediately
after get the data from the target. Before this,
it would run all the commands and write the files.
The old behavior could cause no log written at all
if the serial console gets stuck.

(From OE-Core rev: 73c98d38e94d3b1407620c134f3b00dcd9d6132c)

Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-08-16 09:25:00 +01:00
Mariano Lopez 9c72c1a5aa oetest.py: Added method tearDown for oeRuntimeTest
The tearDown method is triggered when a tests ends
it doesn't matter if fails or succeeds. Inside this
method added an evalution to check if fails and then
run some commands in the target to get the data for
later debugging.

[YOCTO #8118]

(From OE-Core rev: 8bbfef69828d9b053e2a33dfa9d8318d9572cf6b)

Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-08-16 09:25:00 +01:00
Richard Purdie 26997d1d21 lib/oeqa: Add sdk tests for gcc/perl/python
Enhance testing of the generated SDK tarballs by adding tests for
gcc/perl/python based on the existing runtime tests.

(From OE-Core rev: 18160403427b2aab4207c939312fb0981c3f2d1b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-04-29 10:58:55 +01:00
Patrick Ohly f626c58c32 testimage: sort modules based on dependencies
TEST_SUITES="auto" is useful to run all suitable tests without
having to hard-code the list. However, it did not take test
dependencies into account, which can be an issue for tests
which really depend on some other test to run first.

To fix this, modules get loaded in the order determined by
TESTS_SUITES, but then get re-ordered based on dependencies
derived from @skipUnlessPassed before running them. The original
order is used to break ties when there are no dependencies, so
reordering only occurs when really necessary.

@skipUnlessPassed gets extended such that it makes the test name
a method depends on available for inspection by the test loader
in oetest.py.

Unfortunately Python's unittest offers no API to inspect tests
in a TestSuite, so the code has to rely on implementation details
to find all tests. The worst that can happen when the implementation
changes is that tests are not found and reordering does not happen.

(From OE-Core rev: 6e4543a35836c572b23b9f8162b19d1e038d3ed2)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-04-10 18:10:25 +01:00
Patrick Ohly 058e75d60e oeqa/oetest.py: use bb logging
Plain print has two drawbacks:
- the output is handled by different processes, causing the message
  about found tests to appear randomly after the result of the initial
  tests
- the output is not part of the bitbake console output

Affects image testing with testimage.bbclass.

(From OE-Core rev: 4b6f87a82ece230b7296f1577d4092ef559af1d4)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-04-10 18:10:25 +01:00
Lucian Musat 1f5186efbf oeqa: Added package installer to oetest to aid in future automatic install of packages
(From OE-Core rev: e0af8a3c751f938faf7deb60b51f42450ae58e27)

Signed-off-by: Lucian Musat <georgex.l.musat@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-09-10 15:38:56 +01:00
Corneliu Stoicescu e2b4dde94c oeqa/oetest.py: enable sdk tests to use hasFeature and hasPackage methods.
In order to use the hasFeature and hasPackage methods, we need to make oeSDKTest extend oeTest and also set the test context (tc) attribute in the oeTest class when loading the tests.

(From OE-Core rev: 54436aeed5ac5e0da0779919f8524a0603e19c6a)

Signed-off-by: Corneliu Stoicescu <corneliux.stoicescu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-08-27 12:12:31 +01:00
Corneliu Stoicescu 2999a7f684 oeqa/oetest.py: enable sdk testing
- add support for sdk tests in the loadTests and runTests methods
- add new oeSDKTest test object

NOTE: Original patch made by: Richard Purdie <richard.purdie@linuxfoundation.org>

(From OE-Core rev: 6c147e5c82b39773e135ca828b37905cbb31be3b)

Signed-off-by: Corneliu Stoicescu <corneliux.stoicescu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-08-18 08:55:54 +01:00
Lucian Musat 8e26ab7d52 oeqa/rutime: Added testcase decorators for automated runtime tests. Also added LogResults decorator for oeTest class in oetest.py
(From OE-Core rev: 95b83084487d0712362ade8ac487999c3274bb96)

Signed-off-by: Lucian Musat <georgex.l.musat@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-07-25 16:54:42 +01:00
Lucian Musat 0c4dd0ad16 oeqa: Refactor test skipping decorators to use the unittest result object
In order to make the test skipping decorators independent of the oeTest object we rely on the unittest result object to construct skip, fail and error lists used by these decorators.
Created a new object getResults that analyses upper frames and retrieves the unittest result object instance, then return a list of failed, skipped and error tests.
Also removed the oetest import from decorators.py because it was no longer required.

(From OE-Core rev: 4d2d201158236bd4c72546cf8db88681ff921b11)

Signed-off-by: Lucian Musat <georgex.l.musat@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-07-25 15:34:00 +01:00
Stefan Stanacar 731acba417 testimage: add ability to export tests
Add the ability to export the tests so that they can run independently of
the build system, as is required if you want to be able to hand the test
execution off to a scheduler.
Booting/deployment of the target is still handled by the build system,
as before, only the execution of the tests happens outside of the build system.
Tests exported are the ones defined in TEST_SUITES.

No tests have been changed as interesting parts of the data store have been
exported and tests can continue to query them as before. Small adjustments were made
for a couple of oeqa modules though.

[YOCTO #5613]

(From OE-Core rev: 155dd52e0f707e06f50756584a50f744ba6b7844)

Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-02-09 09:40:00 +00:00
Stefan Stanacar db1a2a6178 oeqa/runtime: drop restartTarget method
Restart is a property of a specific target, not
of a test class, should a test really need to restart
the target the direct method should be called.
Also some tests used this to enforce more ram, which
makes sense only for qemu targets only (and the inital
reason this was needed isn't valid anymore, qemu machines had
the default ram size bumped a while ago).

(From OE-Core rev: 333a4326082e500bdbcd323af37e183e74adf617)

Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-01-29 17:38:49 +00:00
Stefan Stanacar b4d9b4208b testimage: use the new targetcontrol.py module for running tests
This patch makes the necessary changes for using the targetcontrol.py module
so that one can run the same tests on a qemu instance or a remote machine
based on the value of TEST_TARGET variable: "qemu" or "simpleremote".
The default value is "qemu" which starts a qemu instance and it's the
with what we currently have.

With "simpleremote", the remote machine must be up with network and ssh
and you need to set TEST_TARGET_IP with the IP address of the remote machine
(it can still be a qemu instance that was manually started).

Basically testimage.bbclass now does something along the lines of:
 - load tests -> deploy (prepare) / start target -> run tests.
There were a couple of changes necessary for tests and
also some cleanups/renames that were needed to adjust this change. (use
ip everywhere when refering to target and server_ip when refering to host/build machine)
Also two unnecessary and unsed methods were dropped from sshcontrol.

[ YOCTO #5554 ]

(From OE-Core rev: a7820350fa3271d78ed7476e02f4aef593be1125)

Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-12-03 17:45:51 +00:00
Stefan Stanacar d4398d41be lib/oeqa: use the new manifest file for determining if a package is installed
Use the new manifest file instead of ${WORKDIR}/installed_pkgs.txt for determining
if an image has a certain package, because installed_pkgs.txt goes away with rm_work
enabled.
We can't use the IMAGE_MANIFEST var for the file path because that relies on IMAGE_NAME which
changes at every run (because of date), so we use the link which points to the last
one built.

[ YOCTO #5072 ]

(From OE-Core rev: f57c83fc33583c140f668946f3f3e79b960aa9ee)

Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-12-03 17:45:51 +00:00
Stefan Stanacar 19aeca1cac lib/oeqa: add oeTest superclass
Add oeTest superclass, make oeRuntimeTest inherit that and
make the necesarry adjustments. Tests in lib/oeqa/runtime don't
change, they still inherit oeRuntimeTest.
We should do this because oetest.py in the future can be a base module
for more stuff than oeRuntimeTest.

(From OE-Core rev: cd4ed41a070bd52c446ac3df8337f17ab9421145)

Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-11-05 22:04:28 +00:00
Mihai Lindner f6fed84380 oeqa/oetest: oeRuntimeTest: enable long messages
Set longMessage to True for all tests derived from oeRuntimeTest, in
order to have somewhat info on assertions with cryptic or no messages.

(From OE-Core rev: e5196ebd6c652431a3b80cdc9f60b752401314f4)

Signed-off-by: Mihai Lindner <mihaix.lindner@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-09-06 23:03:23 +01:00
Stefan Stanacar 2dfc0e1cc7 lib/oeqa: change behaviour for unskippable tests
When a test module wants to be skipped because it doesn't
apply to the image but it was nevertheless a required
test (one in TEST_SUITES), we issued an warning that it
was a required test and went on with running the module.
Usually all tests in the module failed (e.g gcc tests on a non-sdk image),
but this allowed us to know that something went wrong with the image
(some package/feature didn't make it).

However, instead of just issuing an warning and running the tests
it's better to throw an exception. The traceback will tell us what's wrong,
and we don't run every single test method.
Output will look like this:
--snip--
| NOTE: Test modules  ['oeqa.runtime.ping', 'oeqa.runtime.ssh', 'oeqa.runtime.gcc']
| NOTE: Found 5 tests
| test_ping (oeqa.runtime.ping.PingTest) ... ok
| test_ssh (oeqa.runtime.ssh.SshTest) ... ok
| ERROR
|
| ======================================================================
| ERROR: setUpModule (oeqa.runtime.gcc)
| ----------------------------------------------------------------------
| Traceback (most recent call last):
|   File "/mnt/back/yocto/poky/meta/lib/oeqa/runtime/gcc.py", line 8, in setUpModule
|     skipModule("Image doesn't have tools-sdk in IMAGE_FEATURES")
|   File "/mnt/back/yocto/poky/meta/lib/oeqa/oetest.py", line 108, in skipModule
|     "\nor the image really doesn't have the requred feature/package when it should." % (modname, reason))
| Exception:
| Test gcc wants to be skipped.
| Reason is: Image doesn't have tools-sdk in IMAGE_FEATURES
| Test was required in TEST_SUITES, so either the condition for skipping is wrong
| or the image really doesn't have the requred feature/package when it should.
|
| ----------------------------------------------------------------------
| Ran 2 tests in 1.036s
|
| FAILED (errors=1)
| NOTE: Sending SIGTERM to runqemu
--snip--

(From OE-Core rev: fd51cecf8b258d9f839a0ecebde69d09f75dc468)

Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-08-26 11:47:21 +01:00
Stefan Stanacar 51588936d4 lib/oeqa: make it possible to restart the target
Tweak QemuRunner so we can actually restart the
qemu target in a test (if we want more memory for example).
Also add a restart method to the base test class so that tests
can use it.

(From OE-Core rev: 9de7fe11967576f4a8b24e653c6b9a02e5f6d85b)

Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-08-26 11:47:21 +01:00
Stefan Stanacar 656a8b97c1 testimage.bbclass, lib/oeqa: add headers and comments
Adds some comments to testimage.bbclass and the files it calls,
just to give an ideea of what it does.

(From OE-Core rev: 8bbb7116cf02466dfc59a17dc7bb51287aeea55b)

Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-07-16 10:04:17 +01:00
Stefan Stanacar 7f57d3c524 lib/oeqa/oetest.py: provide a ps command for all tests
Many tests will use 'ps' but we need to know if it's busybox
or standard ps.
Drop the existing check from the connman test.

(From OE-Core rev: 1515d33d2c5b7275a3ac20e07c1db1d8273de796)

Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-07-16 10:04:16 +01:00
Stefan Stanacar 12bf6262f6 lib/oeqa/oetest.py: base module for all runtime unittests
This module contains the base class for all runtime tests
and some helper methods.

(From OE-Core rev: 7765c27705e90381975fb2b89ea2181287517761)

Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
Signed-off-by: Radu Moisan <radu.moisan@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-07-09 10:53:43 +01:00