public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Anton Mikanovich <amikan@ilbers.de>
To: isar-users@googlegroups.com
Cc: Anton Mikanovich <amikan@ilbers.de>
Subject: [PATCH 3/6] CI: Adopt vm_start test logging
Date: Tue, 22 Feb 2022 10:12:56 +0300	[thread overview]
Message-ID: <20220222071259.157349-4-amikan@ilbers.de> (raw)
In-Reply-To: <20220222071259.157349-1-amikan@ilbers.de>

Adopt stderr output format to made QEMU start tests output logs in the
same way like build tests are.

Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
 testsuite/cibuilder.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/testsuite/cibuilder.py b/testsuite/cibuilder.py
index 2170ea6..52bb2a5 100755
--- a/testsuite/cibuilder.py
+++ b/testsuite/cibuilder.py
@@ -216,7 +216,7 @@ class CIBuilder(Test):
         timeout = time.time() + int(time_to_wait)
 
         p1 = subprocess.Popen(cmdline, stdout=subprocess.PIPE,
-                              stderr=subprocess.PIPE)
+                              stderr=subprocess.PIPE, universal_newlines=True)
         try:
             poller = select.poll()
             poller.register(p1.stdout, select.POLLIN)
@@ -224,6 +224,8 @@ class CIBuilder(Test):
             while time.time() < timeout and p1.poll() is None:
                 events = poller.poll(1000 * (timeout - time.time()))
                 for fd, event in events:
+                    if event != select.POLLIN:
+                        continue
                     if fd == p1.stdout.fileno():
                         # Wait for the complete string if it is read in chunks
                         # like "i", "sar", " login:"
@@ -232,7 +234,7 @@ class CIBuilder(Test):
                         if login_prompt in data:
                             raise CanBeFinished
                     if fd == p1.stderr.fileno():
-                        self.log.error(p1.stderr.readline())
+                        app_log.error(p1.stderr.readline().rstrip())
         except CanBeFinished:
             self.log.debug('Got login prompt')
         finally:
@@ -240,12 +242,12 @@ class CIBuilder(Test):
                 p1.kill()
             p1.wait()
 
-        if os.path.exists(output_file):
+        if os.path.exists(output_file) and os.path.getsize(output_file) > 0:
             with open(output_file, "rb") as f1:
                 data = f1.read()
                 if service_prompt in data and login_prompt in data:
                     return
                 else:
-                    self.log.error(data)
+                    app_log.error(data.decode(errors='replace'))
 
         self.fail('Log ' + output_file)
-- 
2.25.1


  parent reply	other threads:[~2022-02-22  7:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-22  7:12 [PATCH 0/6] Unify build and run test cases Anton Mikanovich
2022-02-22  7:12 ` [PATCH 1/6] CI: Reorganize testsuite folders Anton Mikanovich
2022-02-22  7:12 ` [PATCH 2/6] CI: Migrate all tests to one location Anton Mikanovich
2022-02-22  7:12 ` Anton Mikanovich [this message]
2022-02-22  7:12 ` [PATCH 4/6] CI: Do not run QEMU start tests from Gitlab Anton Mikanovich
2022-02-22  7:12 ` [PATCH 5/6] CI: Rename build_test.py to citest.py Anton Mikanovich
2022-02-22  7:12 ` [PATCH 6/6] CI: Change QEMU boot logs format Anton Mikanovich

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=20220222071259.157349-4-amikan@ilbers.de \
    --to=amikan@ilbers.de \
    --cc=isar-users@googlegroups.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