fixed test to use htpdate
TEST="run_remote_tests.sh ..."
Review URL: http://codereview.chromium.org/2217001
(cherry picked from commit 29a201570ac9aaa0fe23bee4c49ad32a832b275e)
diff --git a/client/site_tests/platform_AccurateTime/platform_AccurateTime.py b/client/site_tests/platform_AccurateTime/platform_AccurateTime.py
index 954e780..5c30959 100644
--- a/client/site_tests/platform_AccurateTime/platform_AccurateTime.py
+++ b/client/site_tests/platform_AccurateTime/platform_AccurateTime.py
@@ -11,12 +11,14 @@
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 @@
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)
diff --git a/client/site_tests/platform_DaemonsRespawn/test_respawn.sh b/client/site_tests/platform_DaemonsRespawn/test_respawn.sh
index 9912b48..4ebf2a9 100755
--- a/client/site_tests/platform_DaemonsRespawn/test_respawn.sh
+++ b/client/site_tests/platform_DaemonsRespawn/test_respawn.sh
@@ -49,7 +49,7 @@
# The set of jobs (and corresponding daemon names) to test.
# TODO: Test more jobs that have the respawn stanza
-UPSTART_JOBS_TO_TEST="ntp:ntpd udev:udevd"
+UPSTART_JOBS_TO_TEST="htpdate:htpdate udev:udevd"
for job in $UPSTART_JOBS_TO_TEST ; do