From 1ed59cadaae04a119bbffcc6fcfc41f7b269c5e5 Mon Sep 17 00:00:00 2001 From: Vadim Rutkovsky Date: Tue, 29 Apr 2014 13:43:58 +0200 Subject: tests: attach journald logs to html report --- tests/environment.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/environment.py b/tests/environment.py index a9098e6904..0a8dc5c74c 100644 --- a/tests/environment.py +++ b/tests/environment.py @@ -1,6 +1,6 @@ # -*- coding: UTF-8 -*- -from time import sleep +from time import sleep, localtime, strftime from dogtail.utils import isA11yEnabled, enableA11y if not isA11yEnabled(): enableA11y(True) @@ -29,6 +29,9 @@ def before_all(context): # Cleanup existing data before any test cleanup() + # Store scenario start time for session logs + context.log_start_time = strftime("%Y-%m-%d %H:%M:%S", localtime()) + context.app_class = App('evolution') except Exception as e: @@ -57,6 +60,13 @@ def after_scenario(context, scenario): # Stop evolution context.app_class.kill() + # Attach journalctl logs + if hasattr(context, "embed"): + os.system("journalctl /usr/bin/gnome-session --no-pager -o cat --since='%s'> /tmp/journal-session.log" % context.log_start_time) + data = open("/tmp/journal-session.log", 'r').read() + if data: + context.embed('text/plain', data) + # Make some pause after scenario sleep(1) except Exception as e: -- cgit v1.2.3