blob: 3a9b13ec483dbbea5bc844541afb5fd78f47c22b [file] [log] [blame]
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This test isn't really HW specific. It's testing /dev/watchdog API
# to make sure it works as expected. The most robust implementations is
# based on real HW but it doesn't have to be.
import logging
import errno
from autotest_lib.client.common_lib import error
from autotest_lib.server import test
from autotest_lib.server.cros.watchdog_tester import WatchdogTester
class platform_HWwatchdog(test.test):
"""Test to make sure that /dev/watchdog will reboot the system."""
version = 1
def _stop_watchdog(self, client, wd_dev):
# HW watchdog is open and closed "properly".
try:'echo "V" > %s' % wd_dev)
except error.AutoservRunError, e:
raise error.TestError('write to %s failed (%s)' %
(wd_dev, errno.errorcode[e.errno]))
def run_once(self, host=None):
tester = WatchdogTester(host)
# If watchdog not present, just skip this test
if not tester.is_supported():
error.TestNAError('%s or %s not present. Skipping test.' %
(tester.WD_DEV, tester.DAISYDOG_PATH))
with tester:
self._stop_watchdog(host, tester.WD_DEV)