Commit Graph

25 Commits

Author SHA1 Message Date
Richard Purdie 3b39971748 classes/lib: Complete transition to python3
This patch contains all the other misc pieces of the transition to
python3 which didn't make sense to be broken into individual patches.

(From OE-Core rev: fcd6b38bab8517d83e1ed48eef1bca9a9a190f57)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-06-02 08:24:01 +01:00
Ed Bartosh f799e218ed oeqa/targetcontrol: support wic image type
Added 'wic' to the list image types supported by targetcontrol.

This is a preparation for booting and testing wic images
with oe-selftest.

[YOCTO #8498]

(From OE-Core rev: 7dda053fbd1ea1354b7720cfa691470ba88ef5b9)

(From OE-Core rev: 4b84328d3cd0d87ad146f034b58f68a5158313d7)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-15 16:28:44 +00:00
Ed Bartosh 7066f1671e oeqa/targetcontrol: make ssh control optional
Added new parameter 'ssh' to targetcontrol 'start' method
to be able to test images without running ssh server.

[YOCTO #8498]

(From OE-Core rev: 1c3c66aadd43092bc19242b0651ee810cc31fe7c)

(From OE-Core rev: 67ccf7413b2ac9f516dbdaa6a39d4cec38a6c94d)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-15 16:28:44 +00:00
Richard Purdie ef0fe3193e oeqa: Test failure/cleanup improvements
Currently, if qemu segfaults, the tests merrily continue trying to execute
which takes time for them to timeout and is a bit silly. Worse, no logs about
the segfault are shown to the user, its silent!

This patch tries to unravel the tangled web of issues and ensures that we:

* install a SIGCHLD handler which tells the user qemu exited
* check if qemu is running, if it isn't fail the test outright
* don't leave processes behind in sshcontrol which would hold
  bitbake.lock and block shutdown

(From OE-Core rev: 5c04b1ca1e989f569d5755a646734d01a0c56cae)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-06 15:26:18 +01:00
Mariano Lopez 53ab41a5f6 qemurunner: Added host dumps when there are errors
This adds an instance of HostDumper to qemurunner,
with this instance now is possible to get dumps
from the host when there is an error.

This adds dump points in the next cases:
    - runqemu exits before seeing qemu pid
    - Fail to get qemu process arguments
    - Not reach login banner before timeout
    - qemu pid never appears

This also modifies the constructors of BaseDumper,
HostDumper and TargetDumper, they don't require
the datastore anymore, but the feature to replace
datastore variables has been lost (never used)

[YOCTO #8118]

(From OE-Core rev: b0af40fb76cd5035696e9d8a44f815f64214d23a)

Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-03 12:43:16 +01:00
Mariano Lopez 85fd1a7a12 dump: Created new classes for dump host and target
It makes sense to separate the dump commands from the
oeRuntimeTest class, this way it can be used in all
the test context.

These are the changes included in this patch:

    - Created classes: BaseDumper, HostDumper, TargetDumper
    - Create an instance of HostDumper in imagetest.bbclass
      and add it to TestContext class, this way any class
      that have access to the TestContext would be able
      to dump logs from the host
    - Create an instance of TargetDumper in QemuTarget
      class after get the runner, this way it is
      accessible during the tests.

[YOCTO #8118]

(From OE-Core rev: ad10af6be343b5425fde43055263b0744c161cb3)

Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-08-30 12:36:12 +01:00
Mariano Lopez 48373be830 testimage: Run commands in target and host when test fails
This patch modify three files altought two of them
are minimal modifications. This version includes
the changes proposed by Paul.

testimage.bbclass:
    Create new vars for easy modification of the dump
directory and commands to be run on host and target
when a test fails
    TESTIMAGE_DUMP_DIR: Directory to save the dumps
    testimage_dump_target: Commands to run on target
    testimage_dump_host: Commands to run on host

oetest.py:
    - Allow to use the vars defined in testimage class
    - Now able to run commands in the host and dump the
      results
    - Fix an issue with the condition where to run the
      dump commands (Before it run the commands every
      test after a failure, now it runs the commands only
      in tests that failed)
    - Fix the output to stdout

[YOCTO #8118]

(From OE-Core rev: 26fe645457633f90bb5ddbb12f5f7b9ca4a06cc5)

(From OE-Core rev: 7b4fbbf979ed22434b8e3f83ae145139bb0d9fc7)

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-30 12:36:07 +01:00
Richard Purdie e3aa7a30b3 targetcontrol: Improve logs by outputting qemu boot log in case of failure
We've had a few cases on the autobuilder where we've lost logs of
the boot and been unable to debug it further. Show this information
onto the console to be more useful.

(From OE-Core rev: 5302b7b8fa1349ae99040fe8fdcc4e42c722cc10)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-07-27 23:29:15 +01:00
Paul Eggleton 01ccad15da oeqa/targetcontrol: write QemuRunner log output to a file
If we use this outside of testimage we don't have a task log; so let's
just explicitly write the log output to a file all the time so it's
always there to look at (particularly useful when runqemu exits
immediately with an error.)

(From OE-Core rev: 09b7ed39df150257cfe2eb55a8f8c7475e73217e)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-07-27 23:29:14 +01:00
Paul Eggleton 69bae0651e oeqa/targetcontrol: create test directory before copying rootfs image
The test directory might not exist at this point so just go ahead and
create it.

(From OE-Core rev: 7ef86ce62b52f0f3d0c51e3c20d7b4f37025bf41)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-07-27 23:29:14 +01:00
Richard Purdie 86d30d756a meta: Add explict getVar param for (non) expansion
Rather than just use d.getVar(X), use the more explict d.getVar(X, False)
since at some point in the future, having the default of expansion would
be nice. This is the first step towards that.

This patch was mostly made using the command:

sed -e 's:\(getVar([^,()]*\)\s*):\1, False):g' -i `grep -ril getVar *`

(From OE-Core rev: ab7c1d239b122c8e549e8112c88fd46c9e2b061b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-06-23 11:57:25 +01:00
Lucian Musat fa5970e0d9 oeqa/targetcontrol: Add support for poky-tiny in QemuTarget.
(From OE-Core rev: 8f1a52a3f72506911154769e6ad4a44f32c3112e)

Signed-off-by: Lucian Musat <george.l.musat@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-04-10 18:10:27 +01:00
Richard Purdie 7dcf6c9d45 machine/qemu: Switch from ext3 to ext4
There is no good reason not to use ext4 at this point, it has advantages
and few drawbacks. Therefore switch the qemu machines over (and the default
runqemu script options).

(From OE-Core rev: 430b9ae71b1aa76f8421127d17e0e0723d4818d3)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-21 22:05:37 +00:00
Corneliu Stoicescu 7b453165ab oeqa/targetcontrol.py: Separate the matching of supported image fstypes from the resulting value check.
Because we used a bb.fatal call inside the get_image_fstype classmethod, this caused problems when accessed without instantiating the object with a valid bb environment.

Separating the matching part of the classmethod(that is usable by outside scripts) from the check of the resulting value.
The matching is done within a new classmethod and the latter keeps the old method name and internal functionality, this way we don't have to change any other target controllers code.

(From OE-Core rev: 50ddd5d0149666ad60133d8eb6cc789c5b97e5e4)

Signed-off-by: Corneliu Stoicescu <corneliux.stoicescu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-06-24 19:54:10 +01:00
Corneliu Stoicescu a5aa889d63 targetcontrol.py: Add a classmethod to get extra files needed by the target controllers
YB: #6254

Add a new classmethod that can be used by outside scripts to get the extra files needed by the target controllers.
An outside script can predict rootfs, manifest and kernel files needed by a target controller, but sometimes there are other files needed.

(From OE-Core rev: fea627022473cfb73299d0988628962ad8e80f89)

Signed-off-by: Corneliu Stoicescu <corneliux.stoicescu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-06-13 12:52:21 +01:00
Corneliu Stoicescu af38422017 targetcontrol.py: make possible dynamical determination of rootfs type
YB: #6375

Added a new method get_image_fstype() that autodetermines what fstype to use for the rootfs file.
This method uses a new list variable 'supported_image_fstypes' that contains image fstypes supported by the target controller.

This method is also a classmethod which means outside scripts can get the image fstype.

(From OE-Core rev: 39d5aa5c9f2916700f81d15adc220a30c6b120d1)

Signed-off-by: Corneliu Stoicescu <corneliux.stoicescu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-06-13 12:52:20 +01:00
Paul Eggleton abdd8e708d classes/testimage: if start fails, don't try to stop
If we couldn't start the target, it doesn't make sense to try and stop
it here since logically it shouldn't now be in any kind of "started"
state. (It's the start function's job to clean up after itself if it
fails - to that end, fix up the QemuTarget class so that it does.)

(From OE-Core rev: 819ebddae6b78120e5e082423793ff988419b5c4)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-04-30 21:52:32 +01:00
Stefan Stanacar bd64b91314 oeqa/targetcontrol: restart method shouldn't be abstract
And drop the un-needed and un-used restart methods.
Only qemu ever used this and actually does it safely.

(From OE-Core rev: 1dd1edb5ea551c8a01538b130aa4d0c361eae14d)

Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-04-30 21:52:32 +01:00
Stefan Stanacar 724b83d141 oeqa/targetcontrol: fix loading a controller using a class name
This was wrong and if one would do TEST_TARGET = "SimpleRemoteTarget"
instead of TEST_TARGET = "simpleremote" it would complain
that there is no such controller when there is.

(From OE-Core rev: 47d2049d13ab71e0310e9eedaf307d6c3e530b44)

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-03-11 08:11:41 -07:00
Stefan Stanacar 517bc165bb oeqa/targetcontrol: allow a custom port for SimpleRemoteTarget
We had the ability to use a custom port for the ssh connection,
but we weren't using it.

(From OE-Core rev: c1f2a3c41969df0b7f08cf314b2cb7c9a6030092)

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-03-11 08:11:41 -07:00
Stefan Stanacar 9744e0fb0a oeqa/targetcontrol: make BaseTarget an abstract class
This should make it clear what methods a subclass
needs to redefine.

(From OE-Core rev: a4e4de4189cec3076a863c32c98e02766187ab48)

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-28 14:01:13 +00:00
Stefan Stanacar 3ab2b7f10c oeqa/targetcontrol: properly get the host ip
For the SimpleRemote target where we need the host ip and
it wasn't set in conf, we tried to determine it automatically.
However ip route output isn't the same for every network, we
need the last field from the first line.

(From OE-Core rev: 19af3ac53690b1bd2fee54827090f59c525d2236)

Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-02-25 17:53:04 +00:00
Sipke Vriend c99622e38b lib/oeqa: allow multiple layers to provide their own TEST_TARGET class
Use a python module "folder" rather than a single module within
layers to ensure multiple layers can define a TEST_TARGET class.
Current implementation using controllers.py module will only allow
a single layer to define test targets.

Add a controllers folder as well as a TestTargetLoader class whose
job is to load the given TEST_TARGET class from any number of
python modules within the oeqa/controllers/ directory of any
layer.
The only condition will be that layers will need to ensure
the TEST_TARGET class name they provide is unique otherwise there
is no guarantee which class is instantiated. a bb.warn is used
to alude to this if it happens.

(From OE-Core rev: 3f25705f4a986e06cbd397aaea52b841c1a1e054)

Signed-off-by: Sipke Vriend <sipke.vriend@xilinx.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-02-02 22:37:41 +00:00
Stefan Stanacar bf7383de87 lib/oeqa: allow a layer to provide it's own TEST_TARGET class
Allows a layer to define new classes in <layer>/lib/oeqa/utils/controllers.py
and completely control or extend deployment of a target. (core currently
has QemuTarget and SimpleRemoteTarget).
The value of TEST_TARGET must be the name of the new class.

(From OE-Core rev: 9b81aff0aca42353d448b1e9522f89842e23c7b2)

Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-01-19 16:32:09 +00:00
Stefan Stanacar 17e3dc2cb5 lib/oeqa: targetcontrol.py: add abstraction for running tests on different targets
Add a new module which abstracts the target object used by testimage.bbclass

The purpose of this module is to move the deployment of a target from testimage.bbclass,
basically abstracting different implementations of how we setup a target and how it runs commands.
It allows to select one implementation or another by setting TEST_TARGET (currently to: "qemu" and "simpleremote").

QemuTarget is used to start a qemu instance (as it's currently done in testimage.bbclass)
SimpleRemoteTarget is meant for a remote machine (by setting TEST_TARGET_IP) that's already up and running
with network and ssh.
Simply put, it opens the door for running the tests on different types of targets by adding new classes
(maybe qemu-nfsroot or remote-special etc.). One could also override BaseTarget which currently uses
the existing SSHControl module and add a serial implementation.

[ YOCTO #5554 ]

(From OE-Core rev: c1bfd4017f6f6502a68ceb3edf7d2027d02a309d)

Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-12-03 17:45:52 +00:00