aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcmtice <cmtice@google.com>2014-07-08 11:17:21 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-07-08 21:22:40 +0000
commit4536ef6c9da0f8c0c544552798c0bcf516519f73 (patch)
tree0351ea39d0241eaeeb05d6a45ef6080b7bcbd7a4
parent6367e17c2a01a67fe015f4a94a1cbb30d7958dfc (diff)
downloadtoolchain-utils-4536ef6c9da0f8c0c544552798c0bcf516519f73.tar.gz
Minor fixes to weekly report generation.
Update test_toolchains.py to clean out old (stale) data before copying current image tar files to reports directory. Update weekly_report.py to generate report for previous 6 days, depending on when report is run, rather than being hard-coded to start the report on a particular day. BUG=Non TEST=Ran test_toolchains.py as part of nightly test; it worked properly. Ran weekly_report.py and it did the right thing. Change-Id: Id173ccaa3146c76e19636501984bab11a41f8568 Reviewed-on: https://chrome-internal-review.googlesource.com/168465 Reviewed-by: Yunlian Jiang <yunlian@google.com> Commit-Queue: Caroline Tice <cmtice@google.com> Tested-by: Caroline Tice <cmtice@google.com>
-rw-r--r--test_toolchains.py4
-rw-r--r--weekly_report.py24
2 files changed, 24 insertions, 4 deletions
diff --git a/test_toolchains.py b/test_toolchains.py
index 57051e7e..aae035a1 100644
--- a/test_toolchains.py
+++ b/test_toolchains.py
@@ -248,6 +248,10 @@ class ToolchainComparator(ChromeOSCheckout):
dest_dir = os.path.join (data_dir, weekday)
if not os.path.exists(dest_dir):
os.makedirs(dest_dir)
+ # Make sure dest_dir is empty (clean out last week's data).
+ cmd = "cd %s; rm -Rf %s_*_image*" % (dest_dir, weekday)
+ self._ce.RunCommand(cmd)
+ # Now create new tar files and copy them over.
for l in labels:
test_path = os.path.join(images_path, l)
if os.path.exists(test_path):
diff --git a/weekly_report.py b/weekly_report.py
index e4ceb6f8..3a0ad60a 100644
--- a/weekly_report.py
+++ b/weekly_report.py
@@ -2,15 +2,16 @@
#
# Copyright Google Inc. 2014
-import sys
-import time
+import datetime
import optparse
import os
+import sys
+import time
from utils import constants
from utils import command_executer
-WEEKDAYS = ['Sat', 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri']
+WEEKDAYS = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
DATA_ROOT_DIR = os.path.join(constants.CROSTC_WORKSPACE,
'weekly_test_data')
@@ -134,13 +135,28 @@ def Main(argv):
cmd_executer = command_executer.GetCommandExecuter(log_level="average")
+ # Find starting index, for cycling through days of week, generating
+ # reports starting 6 days ago from today. Generate list of indices for
+ # order in which to look at weekdays for report:
+ todays_index = datetime.datetime.today().isoweekday()
+ indices = []
+ start = todays_index + 1
+ end = start + 7
+ for i in range(start,end):
+ indices.append(i % 7)
+ # E.g. if today is Sunday, then start report with last Monday, so
+ # indices = [1, 2, 3, 4, 5, 6, 0].
+
+
+
# Find all the test image tar files, untar them and add them to
# the list. Also find and untar vanilla image tar files, and keep
# track of the first vanilla image.
report_image_paths = []
vanilla_image_paths = []
first_vanilla_image = None
- for day in WEEKDAYS:
+ for i in indices:
+ day = WEEKDAYS[i]
data_path = os.path.join(DATA_ROOT_DIR, options.board, day)
if os.path.exists(data_path):
# First, untar the test image.