summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/utils/qemurunner.py
Commit message (Collapse)AuthorAgeFilesLines
* oeqa/utils: Add StreamHandler to loggerFrancisco Pedraza2016-10-011-0/+1
| | | | | | | | | | StreamHandler was added due missing log information on the console in oe-selftest with Qemu Runner (From OE-Core rev: a4e2df151af781edbcb6b0e17b51b5ed226bf77f) Signed-off-by: Francisco Pedraza <francisco.j.pedraza.gonzalez@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* qemurunner: print out the runqemu commandbavery2016-09-161-3/+5
| | | | | | | | | | | | | This logs the launch command that was used for runqemu while running -c testimage. This way, if I'd like to easily launch qemu manually in order to debug a failed test, I know what commmand was run to create the qemu instance. (From OE-Core rev: 34aa20c6f323bbf7ad53beb643126e4e03634708) Signed-off-by: bavery <brian.avery@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oeqa: Use snapshot instead of copying the rootfs imageRichard Purdie2016-09-091-1/+1
| | | | | | | | | | | | | | Rather than copying images, use the snapshot option to qemu. This fixes a regression caused by the recent runqemu changes where the wrong images were being testes since the image is copied without the qemuboot.conf file. This means the latest image is found by runqemu rather than the specified one, leading to various confused testing results. It could be fixed by copying more files but use snapshot mode instead. (From OE-Core rev: eab91997d415b0e690b3482749a32087e6a8b00a) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* qemurunner.py/qemutinyrunner.py: remove runqemu-internalRobert Yang2016-09-091-1/+1
| | | | | | | | | There is no runqemu-internal any more. (From OE-Core rev: 14bacf7203ab7a638b67eb143225d8c75bbb703d) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* testimage: allow using kvm when running qemux86* machinesBill Randle2016-08-181-2/+9
| | | | | | | | | | | | Using kvm can provide significant speedups when running qemux86* machines on an x86* host. Enabled by using the new QEMU_USE_KVM variable. [YOCTO #9298] (From OE-Core rev: ebac2c8d1fcd09ebce0659a4abb445e4f1c18571) Signed-off-by: Bill Randle <william.c.randle@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* utils/qemurunner.py: QemuRunner.start() add support for specify extra kernel ↵Aníbal Limón2016-07-201-2/+6
| | | | | | | | | | | | | | | cmdline Add ability to specify extra_bootargs (kernel cmdline) in order to enable systemd debug log in images that enables systemd init. [YOCTO #9299] (From OE-Core rev: 09d62551c289b5607341a4f9c46eecd6390ad774) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* qemurunner: Use surrogateescape decodingRichard Purdie2016-06-021-1/+1
| | | | | | | | | | Since the stream can contain invalid binary characters (e.g. from ppc's bootloader) use surrogateescape decoding to ensure we do process the character stream, else it can hang/timeout. (From OE-Core rev: 28a0030430d4cfcaf5dfc3e71bda07cdbfbbf4a7) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* classes/lib: Complete transition to python3Richard Purdie2016-06-021-10/+12
| | | | | | | | | 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>
* qemurunner: convert data when working with socketEd Bartosh2016-06-021-2/+2
| | | | | | | | | | | | | Converted str to bytes before sending to socket. Converted bytes to str after receiving from socket. This should fix TypeError: 'str' does not support the buffer interface for qemurunner.run_serial method. (From OE-Core rev: 210e290c9251839dc74e3aabdcea3655dd707a50) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* classes/lib: Update to explictly create lists where neededRichard Purdie2016-06-021-1/+1
| | | | | | | | | Iterators now return views, not lists in python3. Where we need lists, handle this explicitly. (From OE-Core rev: caebd862bac7eed725e0f0321bf50793671b5312) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* classes/lib: Update to use python3 command pipeline decodingRichard Purdie2016-06-021-10/+16
| | | | | | | | | | | In python3, strings are unicode by default. We need to encode/decode from command pipelines and other places where we interface with the real world using the correct locales. This patch updates various call sites to use the correct encoding/decodings. (From OE-Core rev: bb4685af1bffe17b3aa92a6d21398f38a44ea874) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* meta: Update to modern exception syntaxRichard Purdie2016-05-211-2/+2
| | | | | | | | | Update older exception syntax to modern one required by python 3. Compatible with python 2.7. (From OE-Core rev: d13f0ac614f1d1e2ef2c8ddc71cbfcf76a8dc3f2) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* classes/oeqa: Update for print statements and file() -> open() for python3uninative-1.0Richard Purdie2016-05-161-1/+1
| | | | | | | | Found some more syntax cleanups needed for python3. (From OE-Core rev: 1181d86e8707c5b8e8d43d5e785d7d9cf01fa491) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* 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>