Home | History | Annotate | Download | only in platform_AnomalyCollector
      1 # Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 
      5 import os
      6 from autotest_lib.client.bin import test, utils
      7 
      8 class platform_AnomalyCollector(test.test):
      9     "Tests the anomaly collector daemon"
     10     version = 1
     11 
     12     def run_once(self):
     13         "Runs the test once"
     14 
     15         # Restart the anomaly collector daemon, trigger a test kernel warning,
     16         # and verify that a warning file is created.
     17         utils.system("stop anomaly-collector")
     18         utils.system("rm -rf /run/anomaly-collector")
     19         utils.system("start anomaly-collector")
     20         utils.system("sleep 0.1")
     21         lkdtm = "/sys/kernel/debug/provoke-crash/DIRECT"
     22         if os.path.exists(lkdtm):
     23             utils.system("echo WARNING > %s" % (lkdtm))
     24         else:
     25             utils.system("echo warning > /proc/breakme")
     26         utils.system("sleep 0.1")
     27         utils.system("test -f /run/anomaly-collector/warning")
     28