Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Unified Diff: client/site_tests/platform_AccurateTime/platform_AccurateTime.py

Issue 2217001: fixed test to use htpdate (Closed) Base URL: ssh://git@chromiumos-git/autotest.git
Patch Set: added missing edits back Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | client/site_tests/platform_DaemonsRespawn/test_respawn.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/site_tests/platform_AccurateTime/platform_AccurateTime.py
diff --git a/client/site_tests/platform_AccurateTime/platform_AccurateTime.py b/client/site_tests/platform_AccurateTime/platform_AccurateTime.py
index 954e780e17d847f9b301890d2212e6f2eee74ef9..5c30959fe0bb1c22501ed5fb9e6df6c4ce7b7a2d 100644
--- a/client/site_tests/platform_AccurateTime/platform_AccurateTime.py
+++ b/client/site_tests/platform_AccurateTime/platform_AccurateTime.py
@@ -11,12 +11,14 @@ class platform_AccurateTime(test.test):
def __get_offset(self, string):
- offset = re.search(r'(-?[\d+\.]+)s', string)
- if offset is None:
- # If string is empty, check the sys logs dumped later.
- raise error.TestError('Unable to find offset in %s' % string)
- return float(offset.group(1))
-
+ if (string.find('No time correction needed') > -1) :
+ return float(0.0)
+ else :
+ offset = re.search(r'Setting (-?[\d+\.]+) seconds', string)
+ if offset is None:
+ # If string is empty, check the sys logs dumped later.
+ raise error.TestError('Unable to find offset in %s' % string)
+ return float(offset.group(1))
def run_once(self):
reader = site_log_reader.LogReader()
@@ -28,8 +30,8 @@ class platform_AccurateTime(test.test):
utils.system('initctl stop ntp')
try:
# Now grab the current time and get its offset
- output = utils.system_output('ntpd -g -u ntp:ntp -q',
- retain_output=True)
+ cmd = '/usr/sbin/htpdate -u ntp:ntp -s -t -w www.google.com';
+ output = utils.system_output(cmd,retain_output=True)
server_offset = self.__get_offset(output)
logging.info("server time offset: %f" % server_offset)
« no previous file with comments | « no previous file | client/site_tests/platform_DaemonsRespawn/test_respawn.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698