1# Copyright (c) 2013 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
5from autotest_lib.client.common_lib import error
6from autotest_lib.server import test
7
8class kernel_IgnoreGptOptionServer(test.test):
9    """Test to check that the kernel is ignoring the cmd line option 'gpt'.
10    """
11    version = 1
12
13
14    def run_once(self, host=None):
15        # Check if gpt option is present on the command line.
16        try:
17            host.run('cat /proc/cmdline | grep -E "( gpt)|(gpt )"')
18        except error.AutoservRunError:
19            raise error.TestNAError('No need to check that "gpt" is ignored '
20                                    'by the kernel on this device.')
21
22        # Reboot the client
23        host.reboot()
24
25        try:
26            msg = 'Not forcing GPT even though \'gpt\' specified on cmd line.'
27            host.run ('dmesg | grep "%s"' % msg)
28        except error.AutoservRunError:
29            raise error.TestFail('The option "gpt" not ignored by the kernel.')
30