oeqa/runtime/ltp: Increase ltp test output timeout
PATCH 1/4 oeqa/runtime/ltp: Increase ltp test output timeout
On our slower arm server, the tests currently timeout leading to inconsistent test results. Increase the timeout to avoid this and aim to make the test results consistent.
--- meta/lib/oeqa/runtime/cases/ltp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/lib/oeqa/runtime/cases/ltp.py +1 -1
@@ -71,7 +71,7 @@ class LtpTest(LtpTestBase): cmd = '/opt/ltp/runltp -f %s -q -r /opt/ltp -l /opt/ltp/results/%s -I 1 -d /opt/ltp' % (ltp_group, ltp_group) starttime = time.time() - (status, output) = self.target.run(cmd) + (status, output) = self.target.run(cmd, timeout=1200) endtime = time.time() # Write the console log to disk for convenience
Signature · 1 line
2.39.2
PATCH 2/4 oeqa/ltp: Show warning for non-zero exit codes
When test command timeouts occur, there was no warning in the logs. Change this to ignore "exit 1" but report all other exit codes so that timeouts are clear.
--- meta/lib/oeqa/runtime/cases/ltp.py | 5 +++++ 1 file changed, 5 insertions(+)
meta/lib/oeqa/runtime/cases/ltp.py +5 -0
@@ -74,6 +74,11 @@ class LtpTest(LtpTestBase): (status, output) = self.target.run(cmd, timeout=1200) endtime = time.time() + # status of 1 is 'just' tests failing. 255 likely was a command output timeout + if status and status != 1: + msg = 'Command %s returned exit code %s' % (cmd, status) + self.target.logger.warning(msg) + # Write the console log to disk for convenience with open(os.path.join(self.ltptest_log_dir, "%s-raw.log" % ltp_group), 'w') as f: f.write(output)
Signature · 1 line
2.39.2
PATCH 3/4 ltp: Add lernel loopback module dependency
In reply to Richard PurdieThe qemuarm64 kernel builds loopback device support as a module and it isn't included in the image leading to ltp test failures on that platform.
Add the missing kernel module RRECOMMENDS to avoid this and fix those errors.
--- meta/recipes-extended/ltp/ltp_20230516.bb | 2 ++ 1 file changed, 2 insertions(+)
meta/recipes-extended/ltp/ltp_20230516.bb +2 -0
@@ -113,6 +113,8 @@ RDEPENDS:${PN} = "\ tar \ " +RRECOMMENDS:${PN} += "kernel-module-loop" + FILES:${PN} += "${prefix}/* ${prefix}/runtest/* ${prefix}/scenario_groups/* ${prefix}/testcases/bin/* ${prefix}/testcases/bin/*/bin/* ${prefix}/testscripts/* ${prefix}/testcases/open_posix_testsuite/* ${prefix}/testcases/open_posix_testsuite/conformance/* ${prefix}/testcases/open_posix_testsuite/Documentation/* ${prefix}/testcases/open_posix_testsuite/functional/* ${prefix}/testcases/open_posix_testsuite/include/* ${prefix}/testcases/open_posix_testsuite/scripts/* ${prefix}/testcases/open_posix_testsuite/stress/* ${prefix}/testcases/open_posix_testsuite/tools/* ${prefix}/testcases/data/nm01/lib.a ${prefix}/lib/libmem.a" # Avoid stripping some generated binaries otherwise some of the ltp tests such as ldd01 & nm01 fail
Signature · 1 line
2.39.2
PATCH 4/4 target/ssh: Ensure exit code set for commands
In reply to Richard PurdieAs spotted by Joshua Watt, the returncode isn't set until .poll() or .wait() is called so we need to call this after the .kill() call.
This fixes return code reporting so that timeouts for example now return an exit code when they didn't before.
--- meta/lib/oeqa/core/target/ssh.py | 3 +++ 1 file changed, 3 insertions(+)
meta/lib/oeqa/core/target/ssh.py +3 -0
@@ -265,6 +265,7 @@ def SSHCall(command, logger, timeout=None, **opts): time.sleep(5) try: process.kill() + process.wait() except OSError: logger.debug('OSError when killing process') pass
@@ -287,6 +288,7 @@ def SSHCall(command, logger, timeout=None, **opts): except TimeoutExpired: try: process.kill() + process.wait() except OSError: logger.debug('OSError') pass
@@ -316,6 +318,7 @@ def SSHCall(command, logger, timeout=None, **opts): # whilst running and ensure we don't leave a process behind. if process.poll() is None: process.kill() + process.wait() logger.debug('Something went wrong, killing SSH process') raise
Signature · 1 line
2.39.2
Re: [OE-core] [PATCH 4/4] target/ssh: Ensure exit code set for commands
Quoted 17 lines · Richard Purdie
As spotted by Joshua Watt, the returncode isn't set until .poll() or .wait() is called so we need to call this after the .kill() call.
This fixes return code reporting so that timeouts for example now return an exit code when they didn't before.
Signed-off-by Richard Purdie <[email protected]>--- meta/lib/oeqa/core/target/ssh.py | 3 +++ 1 file changed, 3 insertions(+)meta/lib/oeqa/core/target/ssh.py +0
-0
meta/lib/oeqa/core/target/ssh.py def SSHCall(command, logger, timeout=None, **opts): · line 268
Quoted 4 lines
meta/lib/oeqa/core/target/ssh.py +1
-0@@ -265,6 +265,7 @@ def SSHCall(command, logger, timeout=None, **opts): time.sleep(5) try: process.kill() + process.wait()
I think this can still result in a orphaned process; if the process.terminate() on the line above is successful, the process will exit and then process.kill() here will raise an exception and will call wait. This is true generally everywhere; wait() must be called regardless of if kill() successed, because kill() will fail if the process is already dead. It's a little tricky because process.commuinicate() calls wait(), so you can't unconditionally call wait(), but my solution was to remove all the kill() and wait() calls that already exist and add:
try:
run()
except:
logger.debug(....)
raise finally:
if process.returncode is None:
try:
process.wait(timeout=5)
except TimeoutExpired:
try:
process.kill()
except OSError:
pass
process.wait()
Quoted 31 lines
meta/lib/oeqa/core/target/ssh.py +2
-1except OSError: logger.debug('OSError when killing process') pass@@ -287,6 +288,7 @@ def SSHCall(command, logger, timeout=None, **opts): except TimeoutExpired: try: process.kill() + process.wait() except OSError: logger.debug('OSError') pass@@ -316,6 +318,7 @@ def SSHCall(command, logger, timeout=None, **opts): # whilst running and ensure we don't leave a process behind. if process.poll() is None: process.kill() + process.wait() logger.debug('Something went wrong, killing SSH process') raise --2.39.2
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#185024): https://lists.openembedded.org/g/openembedded-core/message/185024
Mute This Topic: https://lists.openembedded.org/mt/100408183/3616693
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [OE-core] [PATCH 4/4] target/ssh: Ensure exit code set for commands
Quoted 15 lines · Joshua Watt
Quoted 12 lines · Richard Purdie
As spotted by Joshua Watt, the returncode isn't set until .poll() or .wait() is called so we need to call this after the .kill() call.
This fixes return code reporting so that timeouts for example now return an exit code when they didn't before.
Signed-off-by Richard Purdie <[email protected]>--- meta/lib/oeqa/core/target/ssh.py | 3 +++ 1 file changed, 3 insertions(+)
Quoted 14 lines
meta/lib/oeqa/core/target/ssh.py def SSHCall(command, logger, timeout=None, **opts): · line 268
Quoted 9 lines
meta/lib/oeqa/core/target/ssh.py +1
-0@@ -265,6 +265,7 @@ def SSHCall(command, logger, timeout=None, **opts): time.sleep(5) try: process.kill() + process.wait()I think this can still result in a orphaned process; if the
process.terminate()on the line above is successful, the process will exit and thenprocess.kill()here will raise an exception and will call wait. This is true generally everywhere;wait()must be called
"will _not_ call wait" - Need to proofread better
Quoted 53 lines
regardless of if
kill()successed, becausekill()will fail if the process is already dead. It's a little tricky becauseprocess.commuinicate()callswait(), so you can't unconditionally callwait(), but my solution was to remove all thekill()andwait()calls that already exist and add:try:
run() except: logger.debug(....) raisefinally:
if process.returncode is None:
try:
process.wait(timeout=5)
except TimeoutExpired:
try:
process.kill()
except OSError:
pass
process.wait()Quoted 31 lines
meta/lib/oeqa/core/target/ssh.py +2
-1except OSError: logger.debug('OSError when killing process') pass@@ -287,6 +288,7 @@ def SSHCall(command, logger, timeout=None, **opts): except TimeoutExpired: try: process.kill() + process.wait() except OSError: logger.debug('OSError') pass@@ -316,6 +318,7 @@ def SSHCall(command, logger, timeout=None, **opts): # whilst running and ensure we don't leave a process behind. if process.poll() is None: process.kill() + process.wait() logger.debug('Something went wrong, killing SSH process') raise --2.39.2
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#185024): https://lists.openembedded.org/g/openembedded-core/message/185024
Mute This Topic: https://lists.openembedded.org/mt/100408183/3616693
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [OE-core] [PATCH 4/4] target/ssh: Ensure exit code set for commands
Quoted 31 lines · Joshua Watt
Quoted 15 lines · Joshua Watt
Quoted 12 lines · Richard Purdie
As spotted by Joshua Watt, the returncode isn't set until .poll() or .wait() is called so we need to call this after the .kill() call.
This fixes return code reporting so that timeouts for example now return an exit code when they didn't before.
Signed-off-by Richard Purdie <[email protected]>--- meta/lib/oeqa/core/target/ssh.py | 3 +++ 1 file changed, 3 insertions(+)Quoted 14 lines
meta/lib/oeqa/core/target/ssh.py def SSHCall(command, logger, timeout=None, **opts): · line 268
Quoted 9 lines
meta/lib/oeqa/core/target/ssh.py +1
-0@@ -265,6 +265,7 @@ def SSHCall(command, logger, timeout=None, **opts): time.sleep(5) try: process.kill() + process.wait()I think this can still result in a orphaned process; if the
process.terminate()on the line above is successful, the process will exit and thenprocess.kill()here will raise an exception and will call wait. This is true generally everywhere;wait()must be called
Quoted 25 lines
"will _not_ call wait" - Need to proofread better
Quoted 23 lines
regardless of if
kill()successed, becausekill()will fail if the process is already dead. It's a little tricky becauseprocess.commuinicate()callswait(), so you can't unconditionally callwait(), but my solution was to remove all thekill()andwait()calls that already exist and add:try:
run() except: logger.debug(....) raisefinally:
if process.returncode is None:
try:
process.wait(timeout=5)
except TimeoutExpired:
try:
process.kill()
except OSError:
pass
process.wait()
I think I'll probably merge this as it does work better than the existing code and lets me clean up the ltp test results but I'd take a further patch...
Cheers,
Richard