summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/utils/qemurunner.py
Commit message (Collapse)AuthorAgeFilesLines
* qemurunner: add parameter to method 'start'Ed Bartosh2016-02-151-22/+23
| | | | | | | | | | | | | | | | | | | | | | | QemuRunner requires pair of ip addresses provided through kernel commandline for method 'start' to work. These ip addresses are used to connect to the image using ssh and run tests there. However, this functionality should not be mandatory as testing doesn't always require ssh connection. Some tests can be run using serial console. Added new parameter 'get_ip' to QemuRunner.start to make it possible to skip getting pair of ip addresses from kernel command line. This should allow oe-selftest to test images without modifying kernel command line. [YOCTO #8498] (From OE-Core rev: 3f8b734ebb81d035849288091bb0b97b9c4fba34) (From OE-Core rev: 4c90daaeb946f1adf58b2f71f1af8eb7f5906474) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oeqa/qemurunner: pass nographic to runqemu if DISPLAY isn't setRoss Burton2015-12-011-6/+6
| | | | | | | | | | Not everyone wants to run the tests with a qemu that has a graphical output, so allow display to be None and pass nographic to runqemu in that case. (From OE-Core rev: b1d85f13e79f8a493b9849551357a1a5cf0d0fec) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* qemurunner: Remove the timeout in run_serialMariano Lopez2015-11-161-8/+10
| | | | | | | | | | | | | | | | | | | | | Sometmes when there is high load in the server the commands executed in the target take a lot of time to complete and this lead to incorrect dump files or empty files. This is caused because run_serial has a timeout of five seconds when running the commands in the target. This change removes the timeout and just keep reading the socket until it finds the prompt from the target or when the socket is not ready to be read. [YOCTO #8510] (From OE-Core rev: d1a97475b4e6c7066a3161cb9cec1d4b27644518) 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>
* qemurunner: Enable timestamps on kernel boot-upLeonardo Sandoval2015-11-161-1/+1
| | | | | | | | | | | | Having the timestamps in the log is useful when debugging those cases when the booting time takes longer than expected. printk.times=1 enables stamping into every printk Kernel call. (From OE-Core rev: 8f8db89a91142bf71d009df881107b4c1fc61237) Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* qemurunner: Show the output of runqemu scriptMariano Lopez2015-10-271-0/+1
| | | | | | | | | | | | | | This change will show runqemu output in the logs when running the runtime tests. This is helpful for debugging testimage errors. [YOCTO #8550] (From OE-Core rev: 751a3fec83792037aff23c8cca1bc60664f7b581) 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>
* oeqa/utils/qemurunner: Add support for Unicode from qemuMariano Lopez2015-10-071-4/+11
| | | | | | | | | | | | | | | | | | | The current state of qemurunner will drop the Unicode characters received from qemu, this is because error report web had problems with Unicode characters; now that the server support Unicode, it is possible to log all the output from qemu. So far the only Unicode character seen is the copyright symbol. This patch allows to get Unicode characters from the qemu target and save the log in an UTF-8 file for latter use. [YOCTO #8225] (From OE-Core rev: 4708a55879e1d8fe830d230b0621029cc40de9c3) Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* qemurunner: Sanitize output from qemu and qemu pidMariano Lopez2015-10-011-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | Currently the output from qemu could contain control or Unicode characters; having such characters in the log will cause an internal server error when sending the report to error reporting web. Control characters can be found in the command line used to run quemu too. This change sanitize the output from qemu and the command line used to run qemu, this way the logs doesn't contain control or Unicode characters and this will solve the issue of error reporting web and generate better logs. The only Unicode character found in the qemu output is the copyright symbol, it really doesn't interfer removing Unicode characters with debugging. [YOCTO #8225] (From OE-Core rev: 9f25f723828d6709aad581267ccc63d2ade1ff5c) Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* qemurunner: Handle qemu start failure correctlyRichard Purdie2015-09-281-2/+2
| | | | | | | | | | If qemu didn't start correctly, we may not have registered the child signal. This results in a nasty traceback which confuses the underlying issue. Cleanup this code and make the handler cleanup conditional. (From OE-Core rev: 0ead936925c61aaaa7a819f6c5b999ba3a4daeda) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oeqa/utils/qemurunner.py: Remove duplicate message on LoggingThread startAníbal Limón2015-09-231-1/+0
| | | | | | | | | | The Starting logging thread message is also executed on run() inside LoggingThread class. (From OE-Core rev: 2ad7308ee7166641eff99f3b9fe6794de143f6bc) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oeqa/utils/qemurunner.py: Fix HIGH CPU usage on LoggingThreadAníbal Limón2015-09-231-3/+3
| | | | | | | | | | | | | | 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. (From OE-Core rev: 7b6c9b6327638c9731cea80a52d30d4a8fb6e081) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oeqa: Test failure/cleanup improvementsRichard Purdie2015-09-121-0/+1
| | | | | | | | | | | | | | | | | | | 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) (From OE-Core rev: c77b57e2fa8a4cf90543038fe1939f6ca9b12bd1) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* qemurunner: Fix killpg pid usageRichard Purdie2015-09-091-2/+2
| | | | | | | | killpg should be being called with a pgid, not a pid. (From OE-Core rev: d23bf86f305a04a47d19236d72979c1027a31620) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* qemurunner: Ensure runqemu doesn't survive SIGKILLRichard Purdie2015-09-091-0/+27
| | | | | | | | | | | | | | | | | | | | | | 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. (From OE-Core rev: 99428eafb5352bd39bc4329bdba07c6d6f17b03f) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* qemurunner: Drop error to a warning to improve user feedbackRichard Purdie2015-09-091-1/+1
| | | | | | | | | | | 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. (From OE-Core rev: 4ccef5543649262a1630bff586ef9048fe164016) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oeqa: Test failure/cleanup improvementsRichard Purdie2015-09-061-10/+25
| | | | | | | | | | | | | | | | | 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>
* qemurunner: Handle lack of data on run serial gracefullyMariano Lopez2015-09-031-9/+12
| | | | | | | | | | | | | | | 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] (From OE-Core rev: 4770a766389b94ddd5639d7a92e196abac38da22) Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* qemurunner: Added host dumps when there are errorsMariano Lopez2015-09-031-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* qemurunner: Don't loop on EWOULDBLOCK in logging thread.Randy Witt2015-08-291-14/+14
| | | | | | | | | | | EAGAIN/EWOULDBLOCK can be followed by no data. So don't tight loop waiting for data. (From OE-Core rev: 3aad1f489f38e999914ee6ccbf87367b9a75ee5e) 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>
* qemurunner: In the logging thread retry on EAGAIN, EWOULDBLOCKRandy Witt2015-08-261-4/+25
| | | | | | | | | | | 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. (From OE-Core rev: 2f5cbfee0ab1189fbb83f0e785d79c8d123fccc2) Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* qemurunner: Shut down logging thread successfully when test failsRandy Witt2015-08-251-1/+2
| | | | | | | | | | | | | | | 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. (From OE-Core rev: 6497fddf7f6c4a59e16dab4a9daeb3614a61a8dc) Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* runqemu: Add a tcpserial optionRandy Witt2015-08-241-2/+2
| | | | | | | | | | | | | | | | | | | 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. (From OE-Core rev: 849d65d55e4df5fa443b2cb7b4cee23913fc9d5a) Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* qemurunner: Use two serial ports and log console with a threadRandy Witt2015-08-241-2/+126
| | | | | | | | | | | | | | | | | | | | | | | | | 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. (From OE-Core rev: 2da3fee6b6d9f4dd4c4cb529f4ba393c20aa0f13) 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>
* qemurunner: Make create_socket() return data and use exceptionsRandy Witt2015-08-241-14/+15
| | | | | | | | | | | | | | | 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. (From OE-Core rev: b46d83a848cf23c7f639a6ebafbd0f2c1413584a) 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>
* qemurunner.py: Move some class variables that should only be localRandy Witt2015-08-241-10/+9
| | | | | | | | | | | | | | 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. (From OE-Core rev: 829a6e521f15bae93d5f1a02dc67bc56a8c606c8) 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>
* qemurunner.py: Performance improvements in run_serialMariano Lopez2015-08-161-8/+12
| | | | | | | | | | | | | | | 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] (From OE-Core rev: 600f35c0873a61f8cd02c0e5cc1495ce7785ea89) 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>
* qemurunner.py: Added raw mode in run_serialMariano Lopez2015-08-161-13/+18
| | | | | | | | | | | | | | | | | | 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] (From OE-Core rev: b8ead7c0929c4096e50b481a608f5d0c09eab29d) 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>
* qemurunner.py: Added login to start methodMariano Lopez2015-08-161-0/+11
| | | | | | | | | | | | | | | 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] (From OE-Core rev: cc2b1c28801399c6b525248fa0dabf7c42afc714) 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>
* qemurunner.py: Add method run_serialMariano Lopez2015-08-161-0/+30
| | | | | | | | | | | | | | | | | | | | 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] (From OE-Core rev: a82711fe4520538a732a16795d50573b6f1d4463) 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>
* oeqa/qemurunner: Improve runqemu log output debugRichard Purdie2015-08-091-5/+10
| | | | | | | | | | | 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. (From OE-Core rev: 0e0fa1461863ec586b4f028dfd7d641f091ea928) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* qemurunner: Improves checking for server and target IPs on qemus parametersAlejandro Hernandez2015-08-091-5/+8
| | | | | | | | | Fixes OS hanging infinitely waiting for qemus process to release bitbake.lock (From OE-Core rev: d168bf34c553dbe5de7511e158cd83869d7a88bc) Signed-off-by: Alejandro Hernandez <alejandro.hernandez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oeqa/qemurunner: Fix AttributeError: QemuRunner instance has no attribute ↵Richard Purdie2015-07-271-1/+1
| | | | | | | | | | | | | '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. (From OE-Core rev: 26fb69ec663afd05134822dc5e48fc8928ea5bf1) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* qemurunner: Show last 25 line of log, not 5Richard Purdie2015-07-271-2/+2
| | | | | | | | | For debugging purposes, 5 lines often isn't useful as it doesn't even cover a full backtrace. Show 25 instead. (From OE-Core rev: 5b3ff562b2c56df301fc402c8b84420d8d4e5705) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oeqa/utils/qemurunner: fix error handling if runqemu exits with an errorPaul Eggleton2015-07-271-1/+14
| | | | | | | | | | | | * 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) (From OE-Core rev: 1789b89de6c4642464abadd9f8a4746385e6b4a7) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oeqa/utils/qemurunner: avoid blocking on stty when running under oe-selftestPaul Eggleton2015-07-271-1/+5
| | | | | | | | | | | | | | | | | | | | | | | 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. (From OE-Core rev: a058d07cd7251749fa9c1c8eca3caa80144664fe) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oeqa/utils/qemurunner: fix loggingPaul Eggleton2015-07-271-25/+24
| | | | | | | | | | | | | | | | | | | | | | | | 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. (From OE-Core rev: 429b1971be06d5146bb1c14f4697966cddab3b33) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oeqa/qemurunner: don't assume hostname starts with qemuRoss Burton2015-07-251-1/+1
| | | | | | | | | | It's possible to customise the hostname trivially so don't assume that the hostname hasn't been configured. (From OE-Core rev: faf85728ed9a5a3af336f243f6f3567c773159cf) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oeqa/QemuRunner: don't use bb for loggingRoss Burton2015-07-231-29/+32
| | | | | | | | | | | | | 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(). (From OE-Core rev: 519e381278d40bdac79add340e4c0460a9f97e17) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oeqa/utils/qemurunner: search for login string in the entire boot logStefan Stanacar2014-03-111-2/+1
| | | | | | | | | | | | 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). (From OE-Core rev: 1117d25fdfabbf1afdc7030e05efc6a32df871e3) 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>
* oeqa/utils/qemurunner: use the right kill call so we don't send SIGTERM to ↵Stefan Stanacar2014-03-111-2/+2
| | | | | | | | | | | | | | | | | 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 (From OE-Core rev: f4bf21b40ec6fa07c4a7bb450e3cfae12128dc2c) Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* testimage: use the new targetcontrol.py module for running testsStefan Stanacar2013-12-031-20/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* qemurunner: disable grabs in automated testingRoss Burton2013-09-181-0/+3
| | | | | | | | | | | | | 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 ] (From OE-Core rev: 32f9575a565f350649264c11eceba8311584b0fd) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake.conf: include machine name in DEPLOY_DIR_IMAGEPaul Eggleton2013-09-141-1/+7
| | | | | | | | | | | | | | | | | | | 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> (From OE-Core rev: 7e90261aec61f79680b5eaeaf5b18c7b795412a4) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* lib/oeqa/qemurunner: Use a timeout in select() callRichard Purdie2013-09-061-1/+1
| | | | | | | | | | | | | | | | | | | | 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 :) (From OE-Core rev: c0551436974d179df23418567f18a082830380f6) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* lib/oeqa/utils: qemurunner: fix when runqemu errors outStefan Stanacar2013-08-301-2/+2
| | | | | | | | | | | | | 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. (From OE-Core rev: 923d4bd548911caa0b419c10905895af1e8e7026) Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* lib/oeqa: make it possible to restart the targetStefan Stanacar2013-08-261-7/+21
| | | | | | | | | | | | | 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>
* lib/oeqa/utils: qemurunner: save host IP addressMihai Lindner2013-08-261-8/+3
| | | | | | | | | | | | | | 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. (From OE-Core rev: 1fcf10db10fa36430e37c95c9fee27197e73f7a5) 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> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oeqa/utils/qemurunner: get ip old fashioned way and use tcp serial consoleStefan Stanacar2013-08-131-42/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | 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 (From OE-Core rev: 55e78185110937b7e2b143cf1020426d8df58b72) 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>
* oeqa/utils/qemurunner: fix wrong var in messageStefan Stanacar2013-08-061-1/+1
| | | | | | | | | | | | | | If nothing matches we should print the text not the match, else we get a nice traceback. Changed in V2: - commit message (From OE-Core rev: 601738fee3e9b7909b63714ca725576c10eec1e3) 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>
* oeqa/utils/qemurunner: tweak console bootparam and ip commandStefan Stanacar2013-08-031-2/+2
| | | | | | | | | | | | | | 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). (From OE-Core rev: d5620c0b6782b88f3e6de97b1ddadcf21207fc57) 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>
* oeqa/utils/qemurunner: add comment and headerStefan Stanacar2013-08-031-0/+7
| | | | | | | | | | One of the files was missing comment/header, unlike the others. (From OE-Core rev: 054dba3b7b96349e1e20e3a58acd98bb68ab2536) 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>