Gooftool: Add Testlog data to the report archive
Add Testlog data to the report archive. After we complete the new
logging system for Testlog, we can deprecate Eventlog.
BUG=b:36868023
TEST=manually test on my local device
Cq-Depend: chromium:1724231
Change-Id: Ie0bf49f792a82231f8d97bf9403da0b97b9d2b43
Reviewed-on: https://chromium-review.googlesource.com/1708390
Tested-by: Chun-Tsen Kuo <chuntsen@chromium.org>
Commit-Ready: Chun-Tsen Kuo <chuntsen@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Wei-Han Chen <stimim@chromium.org>
Reviewed-by: Meng-Huan Yu <menghuan@chromium.org>
diff --git a/py/gooftool/commands.py b/py/gooftool/commands.py
index 7e5ca86..60ae204 100755
--- a/py/gooftool/commands.py
+++ b/py/gooftool/commands.py
@@ -35,6 +35,7 @@
from cros.factory.test import event_log
from cros.factory.test.rules import phase
from cros.factory.test.rules.privacy import FilterDict
+from cros.factory.test import state
from cros.factory.utils import argparse_utils
from cros.factory.utils.argparse_utils import CmdArg
from cros.factory.utils.argparse_utils import ParseCmdline
@@ -581,6 +582,12 @@
Returns:
Path to the archive.
"""
+ # Flush Testlog data to DATA_TESTLOG_DIR before creating a report archive.
+ result, reason = state.GetInstance().FlushTestlog(
+ uplink=False, local=True, timeout=10)
+ if not result:
+ logging.warning('Failed to flush testlog data: %s', reason)
+
def NormalizeAsFileName(token):
return re.sub(r'\W+', '', token).strip()
@@ -594,6 +601,7 @@
# Intentionally ignoring dotfiles in EVENT_LOG_DIR.
tar_cmd = 'cd %s ; tar cJf %s *' % (event_log.EVENT_LOG_DIR, target_path)
tar_cmd += ' %s' % paths.FACTORY_LOG_PATH
+ tar_cmd += ' %s' % paths.DATA_TESTLOG_DIR
if add_file:
for f in add_file:
# Require absolute paths since the tar command may change the