OLD | NEW |
1 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import logging, os | 5 import logging, os |
6 | 6 |
7 from autotest_lib.client.common_lib import error | 7 from autotest_lib.client.common_lib import error |
8 from autotest_lib.client.cros.crash_test import CrashTest as CrashTestDefs | 8 from autotest_lib.client.cros.crash_test import CrashTest as CrashTestDefs |
9 from autotest_lib.server import test | 9 from autotest_lib.server import test |
10 | 10 |
11 class platform_KernelErrorPaths(test.test): | 11 class platform_KernelErrorPaths(test.test): |
12 version = 1 | 12 version = 1 |
13 | 13 |
14 def breakme(self, text): | 14 def breakme(self, text): |
15 # This test is ensuring that the machine will reboot on any | 15 # This test is ensuring that the machine will reboot on any |
16 # tyoe of kernel panic. If the sysctls below are not set | 16 # tyoe of kernel panic. If the sysctls below are not set |
17 # correctly, the machine will not reboot. After verifying | 17 # correctly, the machine will not reboot. After verifying |
18 # that the machine has the proper sysctl state, we make it | 18 # that the machine has the proper sysctl state, we make it |
19 # reboot by writing to a /proc/breakme. | 19 # reboot by writing to a /proc/breakme. |
20 # | 20 # |
21 # 2011.03.09: ARM machines will currently fail due to | 21 # 2011.03.09: ARM machines will currently fail due to |
22 # 'preserved RAM' not being enabled. | 22 # 'preserved RAM' not being enabled. |
23 self.client.run('sysctl kernel.panic|grep "kernel.panic = -1"'); | 23 self.client.run('sysctl kernel.panic|grep "kernel.panic = -1"'); |
24 self.client.run('sysctl kernel.panic_on_oops|' | 24 self.client.run('sysctl kernel.panic_on_oops|' |
25 'grep kernel.panic_on_oops = 1'); | 25 'grep "kernel.panic_on_oops = 1"'); |
26 | 26 |
27 command = "echo %s > /proc/breakme" % text | 27 command = "echo %s > /proc/breakme" % text |
28 logging.info("KernelErrorPaths: executing '%s' on %s" % | 28 logging.info("KernelErrorPaths: executing '%s' on %s" % |
29 (command, self.client.hostname)) | 29 (command, self.client.hostname)) |
30 try: | 30 try: |
31 # Simple sending text into /proc/breakme resets the target | 31 # Simple sending text into /proc/breakme resets the target |
32 # immediately, leaving files unsaved to disk and the master ssh | 32 # immediately, leaving files unsaved to disk and the master ssh |
33 # connection wedged for a long time. The sequence below borrowed | 33 # connection wedged for a long time. The sequence below borrowed |
34 # from logging_KernelCrashServer.py makes sure that the test | 34 # from logging_KernelCrashServer.py makes sure that the test |
35 # proceeds smoothly. | 35 # proceeds smoothly. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 for action, text in test_tuples: | 84 for action, text in test_tuples: |
85 # Delete crash results, if any | 85 # Delete crash results, if any |
86 self.client.run('rm -f %s/*' % crash_log_dir) | 86 self.client.run('rm -f %s/*' % crash_log_dir) |
87 boot_id = self.client.get_boot_id() | 87 boot_id = self.client.get_boot_id() |
88 self.breakme(action) # This should cause target reset. | 88 self.breakme(action) # This should cause target reset. |
89 self.client.wait_for_restart(timeout=25, old_boot_id=boot_id) | 89 self.client.wait_for_restart(timeout=25, old_boot_id=boot_id) |
90 result = self.client.run('cat %s/kernel.*.kcrash' % crash_log_dir) | 90 result = self.client.run('cat %s/kernel.*.kcrash' % crash_log_dir) |
91 if text not in result.stdout: | 91 if text not in result.stdout: |
92 raise error.TestFail( | 92 raise error.TestFail( |
93 "No '%s' in the log after sending '%s'" % (text, action)) | 93 "No '%s' in the log after sending '%s'" % (text, action)) |
OLD | NEW |