1 # Copyright (c) 2012 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 logging, errno, shutil, os 6 from autotest_lib.client.bin import test, utils 7 from autotest_lib.client.common_lib import error 8 from autotest_lib.client.cros import rtc 9 from autotest_lib.client.cros.power import sys_power 10 11 SYSFS_CONSOLE_SUSPEND = '/sys/module/printk/parameters/console_suspend' 12 13 class power_NoConsoleSuspend(test.test): 14 """Test suspend/resume with no_console_suspend option set.""" 15 16 version = 1 17 18 def initialize(self): 19 # Save & disable console_suspend module param 20 self.old_console_suspend = utils.read_file(SYSFS_CONSOLE_SUSPEND) 21 utils.write_one_line(SYSFS_CONSOLE_SUSPEND, 'N') 22 23 def run_once(self): 24 sys_power.kernel_suspend(10) 25 26 def cleanup(self): 27 # Restore old console_suspend module param 28 logging.info('restoring value for console_suspend: %s', 29 self.old_console_suspend) 30 utils.open_write_close(SYSFS_CONSOLE_SUSPEND, self.old_console_suspend) 31