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

Side by Side Diff: client/site_tests/logging_UncleanShutdown/logging_UncleanShutdown.py

Issue 5740004: Move site_chrome_test, site_logging, site_log_reader, site_crash_test into cros dir. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: patch Created 9 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 # Copyright (c) 2010 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, time 5 import logging, os, time
6 from autotest_lib.client.bin import site_log_reader, test 6 from autotest_lib.client.bin import utils
7 from autotest_lib.client.common_lib import error, utils 7 from autotest_lib.client.common_lib import error
8 from autotest_lib.client.cros import ui_test 8 from autotest_lib.client.cros import cros_logging, cros_ui_test
9 9
10 _CRASH_PATH = '/sbin/crash_reporter' 10 _CRASH_PATH = '/sbin/crash_reporter'
11 _PENDING_SHUTDOWN_PATH = '/var/lib/crash_reporter/pending_clean_shutdown' 11 _PENDING_SHUTDOWN_PATH = '/var/lib/crash_reporter/pending_clean_shutdown'
12 _UNCLEAN_SHUTDOWN_DETECTED_PATH = '/tmp/unclean-shutdown-detected' 12 _UNCLEAN_SHUTDOWN_DETECTED_PATH = '/tmp/unclean-shutdown-detected'
13 _UNCLEAN_SHUTDOWN_MESSAGE = 'Last shutdown was not clean' 13 _UNCLEAN_SHUTDOWN_MESSAGE = 'Last shutdown was not clean'
14 14
15 class logging_UncleanShutdown(ui_test.UITest): 15 class logging_UncleanShutdown(cros_ui_test.UITest):
16 version = 1 16 version = 1
17 auto_login = False 17 auto_login = False
18 18
19 19
20 def run_once(self): 20 def run_once(self):
21 if not os.path.exists(_PENDING_SHUTDOWN_PATH): 21 if not os.path.exists(_PENDING_SHUTDOWN_PATH):
22 raise error.TestFail('pending shutdown file, %s, not found' % 22 raise error.TestFail('pending shutdown file, %s, not found' %
23 _PENDING_SHUTDOWN_PATH) 23 _PENDING_SHUTDOWN_PATH)
24 24
25 log_reader = site_log_reader.LogReader() 25 log_reader = cros_logging.LogReader()
26 log_reader.set_start_by_reboot(-1) 26 log_reader.set_start_by_reboot(-1)
27 27
28 if log_reader.can_find(_UNCLEAN_SHUTDOWN_MESSAGE): 28 if log_reader.can_find(_UNCLEAN_SHUTDOWN_MESSAGE):
29 raise error.TestFail( 29 raise error.TestFail(
30 'Unexpectedly detected unclean shutdown during boot') 30 'Unexpectedly detected unclean shutdown during boot')
31 31
32 if os.path.exists(_UNCLEAN_SHUTDOWN_DETECTED_PATH): 32 if os.path.exists(_UNCLEAN_SHUTDOWN_DETECTED_PATH):
33 raise error.TestFail('an unclean shutdown file was detected') 33 raise error.TestFail('an unclean shutdown file was detected')
34 34
35 # Log in and out twice to make sure that doesn't cause 35 # Log in and out twice to make sure that doesn't cause
(...skipping 28 matching lines...) Expand all
64 log_reader.set_start_by_current() 64 log_reader.set_start_by_current()
65 utils.system('%s --init' % _CRASH_PATH) 65 utils.system('%s --init' % _CRASH_PATH)
66 66
67 if not log_reader.can_find(_UNCLEAN_SHUTDOWN_MESSAGE): 67 if not log_reader.can_find(_UNCLEAN_SHUTDOWN_MESSAGE):
68 raise error.TestFail('Did not signal unclean shutdown when should') 68 raise error.TestFail('Did not signal unclean shutdown when should')
69 69
70 if not os.path.exists(_UNCLEAN_SHUTDOWN_DETECTED_PATH): 70 if not os.path.exists(_UNCLEAN_SHUTDOWN_DETECTED_PATH):
71 raise error.TestFail('Did not touch unclean shutdown file') 71 raise error.TestFail('Did not touch unclean shutdown file')
72 72
73 os.remove(_UNCLEAN_SHUTDOWN_DETECTED_PATH) 73 os.remove(_UNCLEAN_SHUTDOWN_DETECTED_PATH)
OLDNEW
« no previous file with comments | « client/site_tests/logging_LogVolume/logging_LogVolume.py ('k') | client/site_tests/logging_UserCrash/logging_UserCrash.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698