예제 #1
0
    def _chipsec_util(self, arg, helper_class=mock_helper.TestHelper):
        """Run the chipsec_util command with the arguments.

        Each test may setup a virtual helper to emulate the expected behaviour
        from the hardware. If no helper is provided, TestHelper will be used.
        It verifies that no error is being reported. self.log will be populated
        with the output.
        """
        oshelper.Helper.registry = [(helper_class.__name__, helper_class)]
        chipsec_util._cs = chipset.cs()
        util = chipsec_util.ChipsecUtil()
        util.VERBOSE = True
        util.set_logfile(self.log_file)
        err_code = util.main(["chipsec_utils.py"] + arg.split())
        logger.logger().close()
        self.log = open(self.log_file).read()
        self.assertEqual(err_code, 0)
예제 #2
0
파일: util.py 프로젝트: wxh0000mm/chipsec
    def _chipsec_util(self, arg, helper_class=mock_helper.TestHelper):
        """Run the chipsec_util command with the arguments.

        Each test may setup a virtual helper to emulate the expected behaviour
        from the hardware. If no helper is provided, TestHelper will be used.
        It verifies that no error is being reported. self.log will be populated
        with the output.
        """
        chipsec_util._cs = chipset.cs()
        chipsec_util._cs.helper.helper = helper_class()
        util = chipsec_util.ChipsecUtil(arg.split())
        util.VERBOSE = True
        logger.logger().HAL = True
        logger.logger().set_log_file(self.log_file)
        err_code = util.main()
        logger.logger().close()
        log = open(self.log_file, 'rb')
        self.log = log.read()
        log.close()
        self.assertEqual(err_code, 0)