aboutsummaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/utils
AgeCommit message (Collapse)Author
2015-09-22oeqa/utils/qemurunner.py: Remove duplicate message on LoggingThread startAníbal Limón
The Starting logging thread message is also executed on run() inside LoggingThread class. Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-22oeqa/utils/qemurunner.py: Fix HIGH CPU usage on LoggingThreadAníbal Limón
LoggingThread is used for receive console output from QEMU over TCP, so add filter to only wake poll on read events, also change the event mask variable name to be more descriptive. This fixes HIGH CPU consume caused by wake on ready to write events. Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-15oeqa/decorators: Added decorator to restart the DUT in case of test hang.Lucian Musat
Once the DUT is hanged during testing, currently all the following test cases have to wait for default timeout to exit. Using this decorator the user can choose a timeout at case by case basis and what happens when the timeout is reached by overwriting the self.target.restart method. [YOCTO #7853] Signed-off-by: Lucian Musat <george.l.musat@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-12oeqa/targetbuild: Ensure we run gnu-configize so config files are up to dateRichard Purdie
On aarch64 we need to do this as the versions in the upstream source don't recognise the target triplet causing SDK test failures. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-12oeqa: Test failure/cleanup improvementsRichard Purdie
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: 77e9363feba53b72429154be5713c46b007ae0a4) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-09qemurunner: Fix killpg pid usageRichard Purdie
killpg should be being called with a pgid, not a pid. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-09qemurunner: Ensure runqemu doesn't survive SIGKILLRichard Purdie
Currently, we see runqemu and qemu-system-* processes left behind when bitbake is killed by buildbot. This is due to the use of setpgrp() in the runqemu subprocess call. We need the setpgrp call so that all runqemu processes can easily be killed (by killing their process group). This presents a problem if this controlling process itself is killed however since those processes don't notice the death of the parent and merrily continue on. Rather than hack runqemu to deal with this, we add something to qemurunner, at least for now to resolve the issue. Basically we fork off another process which holds an open pipe to the parent and also is setpgrp. If/when the pipe sees EOF from the parent dieing, it kills the process group. This is like pctrl's PDEATHSIG but for a process group rather than a single process. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-07qemurunner: Drop error to a warning to improve user feedbackRichard Purdie
If a task shows an error, the full log is surpressed since bitbake assumes the user has been shown what is wrong. In this code path that isn't the case and its much more helpful to show the user the full error. Therefore show a warning instead to aid usability. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-06oeqa/decorators: Fixed a problem with tests having the same names.Lucian Musat
When two or more tests had the same name but different classes then the decorator log whould have the output all wrong. This was because a comparison which was made only between method names but now it compares classes too. [YOCTO #8029] Signed-off-by: Lucian Musat <george.l.musat@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-05oeqa: Test failure/cleanup improvementsRichard Purdie
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 Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-03testimage: filter proper test cases by tagszjh
If a test case is decorate by oeqa.utils.decorators.tag, this case will by add a tag, testrunner will filter these tags by TEST_SUITES_TAGS [YOCTO #7849] Signed-off-by: zjh <junhuix.zhang@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-02qemurunner: Handle lack of data on run serial gracefullyMariano Lopez
This changes the behavior when data was not received over the serial console when a command is run. With this the socket is no longer closed but it throws and exception that can handled in upper layers. With this the test can continue without throwing errors for not having the socket anymore. [YOCTO #8118] Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-01qemurunner: Added host dumps when there are errorsMariano Lopez
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] Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-08-30oeqa/utils/dump: Handle empty commandlist gracefullyRichard Purdie
If the commandlist isn't available, the code currently gives a backtrace. At least stop doing that and return more gracefully. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-08-30dump: allow to have datastore vars on dump commandsMariano Lopez
This allows to have datastore variables in the dump commands and will get the data when a new instance it's created. Also this remove special cases from the commands. [YOCTO #8118] Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
2015-08-30dump: Created new classes for dump host and targetMariano Lopez
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] Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
2015-08-29qemurunner: Don't loop on EWOULDBLOCK in logging thread.Randy Witt
EAGAIN/EWOULDBLOCK can be followed by no data. So don't tight loop waiting for data. Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-08-26qemurunner: In the logging thread retry on EAGAIN, EWOULDBLOCKRandy Witt
On a nonblocking socket an exception can be generated for the EAGAIN and EWOULDBLOCK errnos. Since these aren't actually errors make sure to retry rather than bailing out. Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-08-25qemurunner: Shut down logging thread successfully when test failsRandy Witt
Before this change on a test failure an exception would be generated due to runqemu being killed before the logging thread which was on the other end of the socket. The exception was actually correct saying there was no data on a socket marked readable, but this was because the qemu process was killed before the listener thread. Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-08-24runqemu: Add a tcpserial optionRandy Witt
The option was added so that the qemurunner could start a second tcp serial port without adding machine conditional logic to qemurunner. The issue that made this necessary was that when "virt" is passed to qemu-system-aarch64, the normal mechanism for specifying a tcp serial port does not work. This is because the hardware for the "virt" machine is hardcoded in the device tree blob and the addition devices must be virtio devices. So runqemu can specify virtio for qemuarm64 whereas it seems all other qemu machines work with the "-serial tcp*" option. Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-08-24qemurunner: Use two serial ports and log console with a threadRandy Witt
qemu can freeze and stop responding if the socket buffer connected to a tcp serial connection fills up. This happens of course when the reader of the serial data doesn't actually read it. This happened in the qemurunner code, because after checking for the "login:" sentinel, data was never again read from the serial connection. This patch solves the potential freeze by adding a thread to continuously read the data from the console and log it. So it also will give a full log of the console, rather than just up to the login prompt. To simplify this patch, another serial port was also added to use for the sole purpose of watching for the sentinel as well as being the interactive serial port. This will also prevent the possibility of lots of debug data on the console preventing the sentinel value from being seen due to interleaved text. Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-08-24qemurunner: Make create_socket() return data and use exceptionsRandy Witt
So that create_socket() can be called more than once to create sockets, it now returns the socket and port rather than setting class variables directly. create_socket() now only uses exceptions for errors, not the return value from the function. Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-08-24qemurunner.py: Move some class variables that should only be localRandy Witt
The bootlog and qemusock variables were set in the class as part of the create_socket() routine. However those variables are never used outside of the same function and thus serve no purpose as class variables. This initializes those variables near where they are used. Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-08-19oeqa/targetbuild: Remove bashismRichard Purdie
Use '.' instead of 'source' so this works with dash as /bin/sh. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-08-16qemurunner.py: Performance improvements in run_serialMariano Lopez
This allow to search for the prompt after a command is run so it can avoid waiting for the timeout. Also corrected identation issues [YOCTO #8118] Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-08-16qemurunner.py: Added raw mode in run_serialMariano Lopez
Raw mode allows to send the command without sending 'echo $?' for validation; Also this doesn't remove the command or the prompt from the output returned. In raw mode validation is done if there is output. This raw mode would be useful for validate the prompt when a user logs in. [YOCTO #8118] Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-08-16qemurunner.py: Added login to start methodMariano Lopez
This adds the automatic login after the target finished booting. If the automatic login fails it won't stop the target or any test, it would only send a log to the file. [YOCTO #8118] Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-08-16qemurunner.py: Add method run_serialMariano Lopez
The only need for the console before this patch was to check if the target has booted. This allows to send commands to the terminal. This new method is based on the method with the same name of the QemuTinyRunner class. The difference here is it will remove the command and the prompt. The other diference is it will send an echo $? to check if the last command was successful. [YOCTO #8118] Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-08-09oeqa/qemurunner: Improve runqemu log output debugRichard Purdie
If runqemu fails, ensure the log output is shown as its invaluable to aid debugging. Its slightly convoluted since we need to ensure we don't block on reading the pipe which may still be executing hence the need for nonblocking IO. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-08-09qemurunner: Improves checking for server and target IPs on qemus parametersAlejandro Hernandez
Fixes OS hanging infinitely waiting for qemus process to release bitbake.lock Signed-off-by: Alejandro Hernandez <alejandro.hernandez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-07-31oeqa/commands: Increase qemu boot timeout to match testimage.bbclassRichard Purdie
This matches the value in testimage.bbclass, which makes sense since the autobuilders are usually contended. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-07-31sshcontrol: Use os.environ.copy() instead of copy.copy()Richard Purdie
os.environ is special and copy.copy() doesn't do what we'd expect, changes in the child object change the parent. copy.deepcopy() is also known to have issues with it. Use the dedicated .copy() method which will not influence the parent. This fixes selftest failures where the DISPLAY variable disappears. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-07-27oeqa/qemurunner: Fix AttributeError: QemuRunner instance has no attribute ↵Richard Purdie
'server_socket' If start() returns False due to create_socker() failing, stop() may still get called and currently this gives a track back since server_socket doesn't exist. Avoid this. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-07-27qemurunner: Show last 25 line of log, not 5Richard Purdie
For debugging purposes, 5 lines often isn't useful as it doesn't even cover a full backtrace. Show 25 instead. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-07-27oeqa/selftest/imagefeatures: Use QemuTarget codeRichard Purdie
Create a runqemu function which uses the QemuTarget() code from oeqa.targetcontrol to setup the QEMU instance, with all of the added robustness that that gives us. To do this, a datastore is needed for the recipe in question (core-image-minimal) so we do the work needed to set this up. We then use this runqemu function within the imagefeatures tests instead of a hand-rolled implementation. We can then use SSHControl to run the SSH tests rather than rolling our own code to do that as an added bonus. Fixed and extended by Paul Eggleton <paul.eggleton@linux.intel.com>. Part of the fix for [YOCTO #7994]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-07-27oeqa/utils/qemurunner: fix error handling if runqemu exits with an errorPaul Eggleton
* Don't wait for QEMU to start if it's never going to (because runqemu exited with an error) * Don't error out if killing the process fails with "no such process" (we don't care if it's already dead) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-07-27oeqa/utils/qemurunner: avoid blocking on stty when running under oe-selftestPaul Eggleton
runqemu-internal runs stty to return the terminal to its previous state in case QEMU hasn't done that properly (which it at least used to do when it crashed). For some reason I have yet to determine, stty blocks (on tcsetattr() according to gdb) when run within QemuRunner() under oe-selftest, with the result that we always wait until the timeout and then we kill the script, which adds an extra delay after QEMU is stopped. Naturally you would assume that this is something to do with the nature of the terminal under which it is being run; however no amount of playing around with stdin/stdout/stderr seemed to fix the issue, apart from passing in subprocess.PIPE as stdin which makes stty error out with "stty: standard input: Inappropriate ioctl for device". I was also unable to come up with a reliable test for the terminal which we could use inside runqemu-internal to avoid calling stty. For now, go with the stdin=subprocess.PIPE workaround to at least avoid the delay with minimal ill effect. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-07-27oeqa/utils/qemurunner: fix loggingPaul Eggleton
OE-Core commit 519e381278d40bdac79add340e4c0460a9f97e17 unfortunately broke logging in two different ways: 1) it prevented logging to the task log from working within bitbake -c testimage. This is due to the logger object being set up too early which interferes with BitBake's own logging. If we prefix the name with "BitBake." everything works (and we don't need to set the logging level). 2) Additionally because it called the log functions on the logging module and not the logger object it set up, this caused the oe-selftest logging to start printing everything from that point forward. Fix these two issues and return us to the desired behaviour for do_testimage. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-07-24oeqa/qemurunner: don't assume hostname starts with qemuRoss Burton
It's possible to customise the hostname trivially so don't assume that the hostname hasn't been configured. Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-07-24oeqa/sshcontrol: Ensure we don't trigger ssh-askpassRichard Purdie
If DISPLAY is set, ssh-askpass can be triggered which is not what we want in the middle of sanity tests. We can disable this by unsetting DISPLAY. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-07-22oeqa/QemuRunner: don't use bb for loggingRoss Burton
Instead of using bb.note() etc for logging use logging.Logger directly, allowing the use of QemuRunner outside of bitbake. Also clean up the logging/errors by moving create_socket() out of __init__()/restart() and into start(). Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-06-18lib/oeqa/utils/commands: ensure get_bb_var() works when value contains =Paul Eggleton
Only split on the first equals character so that values that contain equals characters (such as FAKEROOTENV) can be retrieved. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2015-06-11oeqa/utils: Added timeout decorator for testcases.Lucian Musat
Signed-off-by: Lucian Musat <george.l.musat@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-05-19recipetool: add appendfile subcommandPaul Eggleton
Locating which recipe provides a file in an image that you want to modify and then figuring out how to bbappend the recipe in order to replace it can be a tedious process. Thus, add a new appendfile subcommand to recipetool, providing the ability to create a bbappend file to add/replace any file in the target system. Without the -r option, it will search for the recipe packaging the specified file (using pkgdata from previously built recipes). The bbappend will be created at the appropriate path within the specified layer directory (which may or may not be in your bblayers.conf) or if one already exists it will be updated appropriately. Fairly extensive oe-selftest tests are also provided. Implements [YOCTO #6447]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-05-14oeqa/utils: Fixed a problem with get_bb_var not returning right variable.Lucian Musat
It searches using regex now and should be more accurate. Signed-off-by: Lucian Musat <george.l.musat@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-05-03oeqa/utils: Allow ~ in bblayersEd Bartosh
Bitbake can parse ~ in bblayer's paths. Added this functionality to oeqa code. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-04-29oeqa/targetbuild: Use DL_DIR for downloads if presentRichard Purdie
This isn't a test of wget so if the files we need are present in DL_DIR, use them from there and save a bit of speed/bandwidth and skip the wget. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-04-21oeqa/utils/decorators: Fix up frame selectionNathan Rossi
Use threading to get the current threads ident to select the current executing frame to ensure that the scanned stack is the expected stack. This allows for the decorators to be used within a process that has multiple threads executing. Signed-off-by: Nathan Rossi <nathan.rossi@xilinx.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-04-09oeqa/utils: Add runner for poky-tiny qemu.Lucian Musat
The connection and commands are done via serial. Signed-off-by: Lucian Musat <george.l.musat@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-04-09testimage: sort modules based on dependenciesPatrick Ohly
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. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>