From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Yash Shinde <Yash.Shinde@windriver.com>,
Randy MacLeod <randy.macleod@windriver.com>,
openembedded-core@lists.openembedded.org
Cc: Umesh.Kallapa@windriver.com, Naveen.Gowda@windriver.com,
Sundeep.Kokkonda@windriver.com,
Shivaprasad.Moodalappa@windriver.com,
Joshua Watt <JPEWhacker@gmail.com>
Subject: Re: [PATCH] rust: Oe-selftest error log on console when it fails.
Date: Wed, 21 Feb 2024 12:21:09 +0000 [thread overview]
Message-ID: <1af50ab4ad85f2298641c88f6d96d342cc0c2565.camel@linuxfoundation.org> (raw)
In-Reply-To: <3e26d31e-b8bd-4549-8c04-540dd36c2f69@windriver.com>
On Wed, 2024-02-21 at 13:30 +0530, Yash Shinde wrote:
>
> The runCmd() returns the 'Result' object containing information about the command execution. It has the following attributes:
> result.command = command
> result.status = cmd.status
> result.output = cmd.output
> result.error = cmd.error
> result.pid = cmd.process.pid
> https://git.openembedded.org/openembedded-core/tree/meta/lib/oeqa/utils/commands.py#n198
>
> I tried to capture the return object value (stderr i.e result.error) and print it to the terminal, but that didn't work as expected.
> Even I tried to print some debug statements in rust.py file and it also didn't show up in the terminal or in the summary.txt file.
> I assume there's something in oe-selftest framework that doesn't print statements directly.
>
> Also, I see there's a "output_log" parameter in the runCmd function parameters, which I understand is used to redirect stdout of the
> command being executed. Currently, I am checking with different values by referring to other oe-selftests and their corresponding behavior with it.
>
>
>
>
> I am checking with some functions and procedures from unittest and subprocess.Popen frameworks to get the error logs:
>
>
>
>
> https://docs.python.org/3/library/unittest.html
> https://docs.python.org/3/library/subprocess.html#subprocess.Popen
>
I had a look at this and tried an experiment locally. This seemed to
work:
diff --git a/meta/lib/oeqa/selftest/cases/rust.py b/meta/lib/oeqa/selftest/cases/rust.py
index 120be6454fa..ad14189c6df 100644
--- a/meta/lib/oeqa/selftest/cases/rust.py
+++ b/meta/lib/oeqa/selftest/cases/rust.py
@@ -216,13 +216,16 @@ class RustSelfTestSystemEmulated(OESelftestTestCase, OEPTestResultTestCase):
cmd = cmd + " export RUST_TARGET_PATH=%s/rust-targets;" % rustlibpath
# Trigger testing.
cmd = cmd + " export TEST_DEVICE_ADDR=\"%s:12345\";" % qemu.ip
- cmd = cmd + " cd %s; python3 src/bootstrap/bootstrap.py test %s --target %s > summary.txt 2>&1;" % (builddir, testargs, targetsys)
- runCmd(cmd)
+ cmd = cmd + " cd %s; python3 src/bootstrap/bootstrap.py test %s --target %s" % (builddir, testargs, targetsys)
+ retval = runCmd(cmd)
end_time = time.time()
+ resultlog = rustlibpath + "/results-log.txt"
+ with open(resultlog, "w") as f:
+ f.write(retval.output)
+
ptestsuite = "rust"
- self.ptest_section(ptestsuite, duration = int(end_time - start_time), logfile = builddir + "/summary.txt")
- filename = builddir + "/summary.txt"
- test_results = parse_results(filename)
+ self.ptest_section(ptestsuite, duration = int(end_time - start_time), logfile=resultlog)
+ test_results = parse_results(resultlog)
for test in test_results:
self.ptest_result(ptestsuite, test, test_results[test])
I'm fairly sure we could improve it further but this does start that
process.
Cheers,
Richard
prev parent reply other threads:[~2024-02-21 12:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-13 13:04 [PATCH] rust: Oe-selftest error log on console when it fails Yash.Shinde
2024-02-13 18:12 ` Randy MacLeod
2024-02-13 18:21 ` [OE-core] " Alexander Kanavin
2024-02-21 8:00 ` Yash Shinde
2024-02-21 12:21 ` Richard Purdie [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1af50ab4ad85f2298641c88f6d96d342cc0c2565.camel@linuxfoundation.org \
--to=richard.purdie@linuxfoundation.org \
--cc=JPEWhacker@gmail.com \
--cc=Naveen.Gowda@windriver.com \
--cc=Shivaprasad.Moodalappa@windriver.com \
--cc=Sundeep.Kokkonda@windriver.com \
--cc=Umesh.Kallapa@windriver.com \
--cc=Yash.Shinde@windriver.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=randy.macleod@windriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox