• 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.common_lib import error
8from autotest_lib.client.cros import rtc
9from autotest_lib.client.cros.power import sys_power
10
11SYSFS_CONSOLE_SUSPEND = '/sys/module/printk/parameters/console_suspend'
12
13class 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