Home | History | Annotate | Download | only in security_SMMLocked
      1 #!/usr/bin/python
      2 #
      3 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
      4 # Use of this source code is governed by a BSD-style license that can be
      5 # found in the LICENSE file.
      6 
      7 import logging, os
      8 from autotest_lib.client.bin import test, utils
      9 from autotest_lib.client.common_lib import error
     10 
     11 class security_SMMLocked(test.test):
     12     """
     13     Verify SMM has SMRAM unmapped and that the SMM registers are locked.
     14     """
     15     version = 1
     16     executable = 'smm'
     17 
     18     def setup(self):
     19         os.chdir(self.srcdir)
     20         utils.make(self.executable)
     21 
     22     def run_once(self):
     23         cpu_arch = utils.get_cpu_arch()
     24         if cpu_arch == "arm":
     25             logging.debug('ok: skipping SMM test for %s.', cpu_arch)
     26             return
     27 
     28         r = utils.run("%s/%s" % (self.srcdir, self.executable),
     29                       stdout_tee=utils.TEE_TO_LOGS,
     30                       stderr_tee=utils.TEE_TO_LOGS,
     31                       ignore_status=True)
     32         if r.exit_status != 0 or len(r.stderr) > 0:
     33             raise error.TestFail(r.stderr)
     34         if 'skipping' in r.stdout:
     35             logging.debug(r.stdout)
     36             return
     37         if 'ok' not in r.stdout:
     38             raise error.TestFail(r.stdout)
     39