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