tests: Show full logs if PPD_TEST_VERBOSE env is set and use it in meson

It can be useful to inspect the daemon logs in any case, so let's show
the logs details when running in meson.

Then it's up to use the `--verbose` parameter to decide whether to see
them or to inspect them from the generated logs.
This commit is contained in:
Marco Trevisan (Treviño) 2024-02-14 21:12:49 +01:00 committed by Marco Trevisan
parent 940c262b74
commit 37bf20bb55
2 changed files with 4 additions and 1 deletions

View file

@ -142,7 +142,9 @@ class Tests(dbusmock.DBusTestCase):
def run(self, result=None):
super().run(result)
if result and len(result.errors) + len(result.failures) > 0 and self.log:
if not result or not self.log:
return
if len(result.errors) + len(result.failures) or os.getenv("PPD_TEST_VERBOSE"):
with open(self.log.name, encoding="utf-8") as tmpf:
sys.stderr.write("\n-------------- daemon log: ----------------\n")
sys.stderr.write(tmpf.read())

View file

@ -1,4 +1,5 @@
envs = environment()
envs.set('PPD_TEST_VERBOSE', 'true')
envs.set ('top_builddir', meson.project_build_root())
envs.set ('top_srcdir', meson.project_source_root())