Skip to content
This repository has been archived by the owner on Aug 14, 2020. It is now read-only.

Commit

Permalink
Bug 981593 - Autophone - Incorrect measurement of throbberstart, r=mc…
Browse files Browse the repository at this point in the history
…ote.
  • Loading branch information
bclary committed Mar 14, 2014
1 parent 14cdbd7 commit 32ddd4f
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions tests/s1s2test.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ def analyze_logcat(self, build_metadata):
self.loggerdeco.debug('analyze_logcat: base_time: %s' % base_time)
# we want the first throbberstart and throbberstop.
match = re_start_time.match(line)
if match:
if match and not start_time:
start_time = match.group(1)
self.loggerdeco.debug('analyze_logcat: start_time: %s' % start_time)
continue
Expand All @@ -470,9 +470,11 @@ def analyze_logcat(self, build_metadata):
throbber_stop_time = match.group(1)
self.loggerdeco.debug('analyze_logcat: throbber_stop_time: %s' % throbber_stop_time)
continue
if throbber_start_time and throbber_stop_time:
if start_time and throbber_start_time and throbber_stop_time:
break
if throbber_start_time == 0 or throbber_stop_time == 0:
if (start_time == 0 or
throbber_start_time == 0 or
throbber_stop_time == 0):
sleep(wait_time)
attempt += 1
if self.check_for_crashes():
Expand Down Expand Up @@ -500,6 +502,12 @@ def analyze_logcat(self, build_metadata):
throbber_start_time = parse(year, throbber_start_time)
throbber_stop_time = parse(year, throbber_stop_time)

self.loggerdeco.debug('analyze_logcat: before year adjustment '
'base: %s, start: %s, '
'throbber start: %s' %
(base_time, start_time,
throbber_start_time))

if base_time > start_time:
base_time.replace(year=year-1)
elif start_time > throbber_start_time:
Expand All @@ -510,6 +518,12 @@ def analyze_logcat(self, build_metadata):
start_time.replace(year=year-1)
throbber_start_time.replace(year-1)

self.loggerdeco.debug('analyze_logcat: after year adjustment '
'base: %s, start: %s, '
'throbber start: %s' %
(base_time, start_time,
throbber_start_time))

# Convert the times to milliseconds from the base time.
convert = lambda t1, t2: round((t2 - t1).total_seconds() * 1000.0)

Expand All @@ -523,9 +537,20 @@ def analyze_logcat(self, build_metadata):
(base_time, start_time,
throbber_start_time, throbber_stop_time,
throbber_stop_time - throbber_start_time))

if (start_time > throbber_start_time or
start_time > throbber_stop_time or
throbber_start_time > throbber_stop_time):
self.loggerdeco.warning('analyze_logcat: inconsistent measurements: '
'start: %s, '
'throbber start: %s, throbber stop: %s ' %
(start_time,
throbber_start_time,
throbber_stop_time))
start_time = throbber_start_time = throbber_stop_time = 0
else:
self.loggerdeco.warning(
'analyze_logcat: failed to get throbbers '
'analyze_logcat: failed to get measurements '
'start_time: %s, throbber start: %s, throbber stop: %s' % (
start_time, throbber_start_time, throbber_stop_time))
start_time = throbber_start_time = throbber_stop_time = 0
Expand Down

0 comments on commit 32ddd4f

Please sign in to comment.