aboutsummaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/utils
AgeCommit message (Collapse)Author
2014-03-11oeqa/utils/qemurunner: search for login string in the entire boot logStefan Stanacar
If some service is to spammy we might miss the login, so search in the entire log instead of just the last few lines. Use qemu in regex too (to avoid a login string from some service). 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-11oeqa/utils/qemurunner: use the right kill call so we don't send SIGTERM to ↵Stefan Stanacar
bitbake-worker After recent bitbake-worker changes [1] this was killing the bitbake-worker, which isn't what we want and kill(-pid) was the wrong call anyway. runqemu.pid is the right PGID as the process was started with preexec_fn=setpgrp (so no need to do os.getpgid(self.runqemu.pid)) [1] http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=15688798520896690561824b2fdc227c8a365c82 Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-02-11oeqa/utils: targetbuild: take proxy into accountStefan Stanacar
A previous commit broke downloads when proxies are involved, let's fix it. Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-02-08oeqa/utils: targetbuild: don't use bb.fetch anymoreStefan Stanacar
When running tests outside of the build system we can't use bb.fetch anymore. It was nice but tests and their modules need to rely on the data storage only as that gets exported. This module is used by the oeqa/runtime/build* tests. Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2014-02-02oeqa/utils: sshcontrol: rewrite the SSHControl classStefan Stanacar
Split the class in two, one to handle the process and the timeout based on output and one for the actual ssh/scp commands. The ssh/scp methods now use the same run method. It does the same thing as before but: - it looks cleaner. - adds support for using a different user than root - optionally, raises an exception when exit code != 0 (that's useful for code outside of tests, where you wouldn't want to check the return code every time as the tests do) Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2014-01-28lib/oeqa: sshcontrol: Allow alternate port for SSHControlSipke Vriend
Add an optional parameter to SSHControl so the user can specify and alternate port to the default (22). Signed-off-by: Sipke Vriend <sipke.vriend@xilinx.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-01-22lib/oeqa: sshcontrol: fix false timeout failuresStefan Stanacar
Ocasionally AB shows odd false fails like: http://autobuilder.yoctoproject.org/main/builders/nightly-arm/builds/1/steps/Running%20Sanity%20Tests/logs/stdio This should fix that by checking for eof instead of polling the return code of the ssh process, because the process might still be there. Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-01-16lib/oeqa: allow a layer to provide it's own TEST_TARGET classStefan Stanacar
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. Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-12-03testimage: use the new targetcontrol.py module for running testsStefan Stanacar
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 ] Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-12-03scripts/oe-selftest: script to run builds as unittest against bitbake or ↵Stefan Stanacar
various scripts The purpose of oe-selftest is to run unittest modules added from meta/lib/oeqa/selftest, which are tests against bitbake tools. Right now the script it's useful for simple tests like: - "bitbake --someoption, change some metadata, bitbake X, check something" type scenarios (PR service, error output, etc) - or "bitbake-layers <...>" type scripts and yocto-bsp tools. This commit also adds some helper modules that the tests will use and a base class. Also, most of the tests will have a dependency on a meta-selftest layer which contains specially modified recipes/bbappends/include files for the purpose of the tests. The tests themselves will usually write to ".inc" files from the layer or in conf/selftest.inc (which is added as an include in local.conf at the start and removed at the end) It's a simple matter or sourcing the enviroment, adding the meta-selftest layer to bblayers.conf and running: oe-selftest to get some results. It would finish faster if at least a core-image-minimal was built before. [ YOCTO #4740 ] Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-11-08lib/oeqa/utils: sshcontrol: make timeout depend on outputStefan Stanacar
Instead of running the commands with a fixed timeout, we should kill the command if there is no output for timeout seconds. Also changed some strings/comments. Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2013-11-04lib/oeqa: add oeTest superclassStefan Stanacar
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. Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2013-09-20lib/oeqa/utils: sshcontrol: log how long the last command takeStefan Stanacar
It might be useful for debugging to have in the ssh log the number of seconds a command has run. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-09-18qemurunner: disable grabs in automated testingRoss Burton
Use the new QEMU_DONT_GRAB environment variable to disable grabs, finally/hopefully solving the random hangs that the autobuilder has been hitting for a while. [ YOCTO #5131 ] Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-09-12bitbake.conf: include machine name in DEPLOY_DIR_IMAGEPaul Eggleton
This allows a clean seperation between image outputs from different machines, and makes it possible to have convenience symlinks to make the output ready to deploy. This did require some surgery in runqemu; if explicit paths to the image and kernel are not supplied then DEPLOY_DIR_IMAGE needs to be determined from bitbake or set in the environment. However the script does try to avoid requiring it unless it really is needed. Corresponding changes were made in the automated testing code as well. Based on an RFC patch by Koen Kooi <koen@dominion.thruhere.net> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-09-06lib/oeqa/qemurunner: Use a timeout in select() callRichard Purdie
A 0 value to select.select() immediately returns with no timeout. This was pegging the cpu at 100% for the python process which was bad and may be contributing to some of the timeout problems. Profile from -P of a core-image-minimal before: 97526792 function calls (97525652 primitive calls) in 45.189 seconds and after: 50204 function calls (49064 primitive calls) in 17.318 seconds Saving 97.5 million function calls has to be good :) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-09-06oeqa/utils/sshcontrol: tweak ssh optionsMihai Lindner
Add ssh_options to be used, the same, by ssh and scp: Decrease LogLevel to ERROR, to suppress warnings (e.g. ssh host verifications, two warnings in case of having openssh with hpn patches); We no longer presume that the first line is a warning. Signed-off-by: Mihai Lindner <mihaix.lindner@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-09-03lib/oeqa/runtime: smart: serve repo on host ip only and increase timeoutStefan Stanacar
Don't start the http server on 0.0.0.0, listen on host ip (end of tap interface) only. Also use the timeout option (default is 300s for ssh commands) for all the commands run in this module (mostly because smart update timeouts on mips). Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-08-30lib/oeqa/utils: qemurunner: fix when runqemu errors outStefan Stanacar
When qemu doesn't start or runqemu errors out (some wrong option passed or sudo needs a password for setting tap) we want to display the output but oe-core commit 9de7fe11967576f4a8b24e653c6b9a02e5f6d85b/ poky commit 51588936d4a8cde3c9bb05800240c0a0f5dedf8d changed the kill method and broke this code, so let's fix it. Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-08-26lib/oeqa/utils: targetbuild: Add helper class for building packages on targetMihai Prica
This class can be used for test cases that configure and build packages on target. Signed-off-by: Mihai Prica <mihai.prica@intel.com> Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2013-08-26lib/oeqa: make it possible to restart the targetStefan Stanacar
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. Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2013-08-26lib/oeqa/utils: decorators: return the decorated methodMihai Lindner
Decorators should return whatever the decorated methods return. Signed-off-by: Mihai Lindner <mihaix.lindner@linux.intel.com> Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2013-08-26lib/oeqa/utils: qemurunner: save host IP addressMihai Lindner
Save host IP address to host_ip. Read /proc/PID/cmdline on host to look for IPs of target and host; instead of running 'ps'. Also removed some extra empty lines from file. Signed-off-by: Mihai Lindner <mihaix.lindner@linux.intel.com> Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2013-08-26lib/oeqa/utils: new file: httpserver.py useful for serving files over HTTP ↵Mihai Lindner
to the target It can be used by smart repo/channel tests to serve deploy_dir. Signed-off-by: Mihai Lindner <mihaix.lindner@linux.intel.com> Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2013-08-13oeqa/utils/qemurunner: get ip old fashioned way and use tcp serial consoleStefan Stanacar
The way we read data from the serial console was unreliable and blocking (AutoBuilder seems to hit that often), so change the serial console type from unix socket to tcp and reverse the connection - don't let qemu act as server (wait for a connection). So now the serial console is used to save the boot log and make sure that we reached the login prompt. Until a better way is found this should solve some of the AutoBuilder failures (one being YB#4904). Also we need to use the same method as the old qemuimagetest to get the ip (from the qemu process arguments), because that it's more reliable. The first version used here was to log into the target and use the output of "ip addr show eth0" but then systemd decides that it should rename interfaces, so that was changed to get the ip of the interface that has the default gw, but if there is no default gw we'll get the loopback ip and we end up trying to ssh into the host machine (some recent AutoBuilder runs showed that). Changed in V2: - use -ww for ps, as output might get truncated Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2013-08-05oeqa/utils/qemurunner: fix wrong var in messageStefan Stanacar
If nothing matches we should print the text not the match, else we get a nice traceback. Changed in V2: - commit message Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2013-08-01oeqa/utils/qemurunner: tweak console bootparam and ip commandStefan Stanacar
Sync serial baud rate with default inittab which should help with apparent boot fails. Also keep a console on tty1. Also we shouldn't assume eth0 it the right interface. (systemd images can rename interfaces to something else). Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2013-08-01oeqa/utils/qemurunner: add comment and headerStefan Stanacar
One of the files was missing comment/header, unlike the others. Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2013-08-01oeqa/utils/sshcontrol: increase and log timeout in outputStefan Stanacar
Increase a bit the timeout for ssh commands and also write in the output that the command timed out (it's easier to see that in a test fail than checking the ssh log) Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2013-07-15lib/oeqa: fix dependecy checkStefan Stanacar
Adds missing skip for smart test and fix the check (which I somehow broke a while ago). Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2013-07-15testimage.bbclass, lib/oeqa: add headers and commentsStefan Stanacar
Adds some comments to testimage.bbclass and the files it calls, just to give an ideea of what it does. Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2013-07-15classes/testimage.bbclass: use a copy of rootfs for testsStefan Stanacar
Make a copy of the rootfs and test that. We can now drop the snapshot option. Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2013-07-15testimage.bbclass, lib/oeqa/utils/qemurunner.py: make boot timeout ↵Stefan Stanacar
configurable and increase it On a loaded host (such as an AB setup where multiple builds run) the 200 seconds timeout might not be enough to reach the login prompt. Also make it configurable so we can set it from local.conf/auto.conf Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2013-07-15lib/oeqa/utils/sshcontrol.py: fix passing command to subprocessStefan Stanacar
Don't use shlex.split in subprocess call and also prepend . /etc/profile, because PATH over ssh is always /usr/bin:/bin which isn't what many tests expect. Changed in v2: We now need to use a separate call for scp command. Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2013-07-09lib/oeqa/utils/decorators.py: decorators for test methodsRadu Moisan
Some skip decorators meant only for test methods, providing some kind of test methods dependency. They are used together with a test method name not a condition. These are complementary to python's unittest skip decorators. Signed-off-by: Radu Moisan <radu.moisan@intel.com> Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
2013-07-09lib/oeqa/utils/qemurunner.py: class to handle qemu instanceRadu Moisan
Handles qemu instances (launch, kill, restart, serial connection, logging) Launch is blocking until login prompt and returns to the task. A qemu serial connection is used to save the boot log and get the ip from the image. Changed runqemu script not to error out when using custom serial option. Signed-off-by: Radu Moisan <radu.moisan@intel.com> Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
2013-07-09lib/oeqa/utils/oeqemuconsole.py: handle qemu serial console connectionStefan Stanacar
Python's telnetlib Telnet class connects only to AF_INET sockets, but we want to use Unix domain socket for the qemu serial connection, so that's why we override it. Also we add a new read_all_timeout method similar to Telnet's read_all, that read until a match or timeout and logs all output. Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
2013-07-09lib/oeqa/utils/sshcontrol.py: helper module for running remote commandsStefan Stanacar
Provides a class for setting up ssh connections, running commands and copying files to/from a target. Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>