qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Thomas Huth" <thuth@redhat.com>,
	"Ani Sinha" <anisinha@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Daniel P. Berrangé" <berrange@redhat.com>
Subject: [PATCH v2 18/18] tests/functional: avoid accessing log_filename on earlier failures
Date: Thu, 21 Nov 2024 15:42:18 +0000	[thread overview]
Message-ID: <20241121154218.1423005-19-berrange@redhat.com> (raw)
In-Reply-To: <20241121154218.1423005-1-berrange@redhat.com>

If a failure occurs early in the QemuBaseTest constructor, the
'log_filename' object atttribute may not exist yet. This happens
most notably if the QEMU_TEST_QEMU_BINARY is not set. We can't
initialize 'log_filename' earlier as we use the binary to identify
the architecture which is then used to build the path in which the
logs are stored.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 tests/functional/qemu_test/testcase.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/tests/functional/qemu_test/testcase.py b/tests/functional/qemu_test/testcase.py
index fceafb32b0..90ae59eb54 100644
--- a/tests/functional/qemu_test/testcase.py
+++ b/tests/functional/qemu_test/testcase.py
@@ -81,10 +81,12 @@ def main():
         res = unittest.main(module = None, testRunner = tr, exit = False,
                             argv=["__dummy__", path])
         for (test, message) in res.result.errors + res.result.failures:
-            print('More information on ' + test.id() + ' could be found here:'
-                  '\n %s' % test.log_filename, file=sys.stderr)
-            if hasattr(test, 'console_log_name'):
-                print(' %s' % test.console_log_name, file=sys.stderr)
+
+            if hasattr(test, "log_filename"):
+                print('More information on ' + test.id() + ' could be found here:'
+                      '\n %s' % test.log_filename, file=sys.stderr)
+                if hasattr(test, 'console_log_name'):
+                    print(' %s' % test.console_log_name, file=sys.stderr)
         sys.exit(not res.result.wasSuccessful())
 
 
-- 
2.46.0



  parent reply	other threads:[~2024-11-21 15:47 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-21 15:42 [PATCH v2 00/18] test/functional: improve functional test debugging & fix tuxrun Daniel P. Berrangé
2024-11-21 15:42 ` [PATCH v2 01/18] tests/functional: fix mips64el test to honour workdir Daniel P. Berrangé
2024-11-21 15:42 ` [PATCH v2 02/18] tests/functional: automatically clean up scratch files after tests Daniel P. Berrangé
2024-11-21 15:42 ` [PATCH v2 03/18] tests/functional: remove "AVOCADO" from env variable name Daniel P. Berrangé
2024-11-21 15:42 ` [PATCH v2 04/18] tests/functional: remove todo wrt avocado.utils.wait_for Daniel P. Berrangé
2024-11-21 15:42 ` [PATCH v2 05/18] tests/functional: remove leftover :avocado: tags Daniel P. Berrangé
2024-11-21 15:42 ` [PATCH v2 06/18] tests/functional: remove obsolete reference to avocado bug Daniel P. Berrangé
2024-11-21 15:42 ` [PATCH v2 07/18] tests/functional: remove comments talking about avocado Daniel P. Berrangé
2024-11-21 15:42 ` [PATCH v2 08/18] tests/functional: honour self.workdir in ACPI bits tests Daniel P. Berrangé
2024-11-21 15:42 ` [PATCH v2 09/18] tests/functional: put QEMUMachine logs in testcase log directory Daniel P. Berrangé
2024-11-21 15:42 ` [PATCH v2 10/18] tests/functional: honour requested test VM name in QEMUMachine Daniel P. Berrangé
2024-11-21 15:42 ` [PATCH v2 11/18] tests/functional: enable debug logging for QEMUMachine Daniel P. Berrangé
2024-11-21 19:01   ` Thomas Huth
2024-11-21 15:42 ` [PATCH v2 12/18] tests/functional: logs details of console interaction operations Daniel P. Berrangé
2024-11-21 15:42 ` [PATCH v2 13/18] tests/functional: don't try to wait for the empty string Daniel P. Berrangé
2024-11-21 15:42 ` [PATCH v2 14/18] tests/functional: require non-NULL success_message for console wait Daniel P. Berrangé
2024-11-21 15:42 ` [PATCH v2 15/18] tests/functional: rewrite console handling to be bytewise Daniel P. Berrangé
2024-11-21 15:42 ` [PATCH v2 16/18] tests/functional: remove time.sleep usage from tuxrun tests Daniel P. Berrangé
2024-11-21 15:42 ` [PATCH v2 17/18] tests/functional: add a QMP backdoor for debugging stalled tests Daniel P. Berrangé
2024-11-21 15:42 ` Daniel P. Berrangé [this message]
2024-11-21 16:41 ` [PATCH v2 00/18] test/functional: improve functional test debugging & fix tuxrun Alex Bennée

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=20241121154218.1423005-19-berrange@redhat.com \
    --to=berrange@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=anisinha@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.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;
as well as URLs for NNTP newsgroup(s).