Skip to content

Commit

Permalink
Update remaining SKIPPED results and references
Browse files Browse the repository at this point in the history
Signed-off-by: Sae86 <[email protected]>
  • Loading branch information
Sae86 committed Oct 13, 2023
1 parent 5544c92 commit 06952e1
Show file tree
Hide file tree
Showing 12 changed files with 11 additions and 30 deletions.
3 changes: 0 additions & 3 deletions chipsec/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@ def run(self, module_argv):
if self.mod_obj.res == ModuleResult.NOTAPPLICABLE:
result = ModuleResult.NOTAPPLICABLE
self.logger.log(f'Skipping module {self.name} since it is not applicable in this environment and/or platform')
else:
result = ModuleResult.SKIPPED
self.logger.log(f'Skipping module {self.name} since it is not supported in this environment and/or platform')

return result

Expand Down
3 changes: 0 additions & 3 deletions chipsec/module_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class ModuleResult:
FAILED = 0
PASSED = 1
WARNING = 2
SKIPPED = 3
DEPRECATED = 4
INFORMATION = 5
NOTAPPLICABLE = 6
Expand Down Expand Up @@ -112,7 +111,6 @@ def getReturnCode(self, result: int) -> int:
ModuleResult.PASSED: 0,
ModuleResult.NOTAPPLICABLE: 0,
ModuleResult.DEPRECATED: 0,
ModuleResult.SKIPPED: 0,
ModuleResult.INFORMATION: 1,
ModuleResult.WARNING: 2,
ModuleResult.FAILED: 3,
Expand All @@ -123,7 +121,6 @@ def getReturnCode(self, result: int) -> int:
ModuleResult.FAILED: 'Failed',
ModuleResult.PASSED: 'Passed',
ModuleResult.WARNING: 'Warning',
ModuleResult.SKIPPED: 'Skipped',
ModuleResult.DEPRECATED: 'Deprecated',
ModuleResult.INFORMATION: 'Information',
ModuleResult.ERROR: 'Error',
Expand Down
2 changes: 1 addition & 1 deletion chipsec/modules/common/smm.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def check_SMRAMC(self):
res = ModuleResult.FAILED
self.logger.log_failed("Compatible SMRAM is not properly locked. Expected ( D_LCK = 1, D_OPEN = 0 )")
else:
res = ModuleResult.SKIPPED
res = ModuleResult.NOTAPPLICABLE
self.logger.log("[*] Compatible SMRAM is not enabled. Skipping..")

return res
Expand Down
2 changes: 1 addition & 1 deletion chipsec/modules/common/uefi/access_uefispec.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def check_vars(self, do_modify):
if vars is None:
self.logger.log_warning('Could not enumerate UEFI Variables from runtime.')
self.logger.log_important("Note that UEFI variables may still exist, OS just did not expose runtime UEFI Variable API to read them.\nYou can extract variables directly from ROM file via 'chipsec_util.py uefi nvram bios.bin' command and verify their attributes manually.")
return ModuleResult.SKIPPED
return ModuleResult.WARNING

uefispec_concern = []
ro_concern = []
Expand Down
2 changes: 1 addition & 1 deletion chipsec/modules/tools/secureboot/te.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ def run(self, module_argv):
if len(bootloader_paths) == 0:
self.logger.log("[*] no bootloaders to replace. Exit...")
self.rc_res.setStatusBit(self.rc_res.status.FEATURE_DISABLED)
return self.rc_res.getReturnCode(ModuleResult.SKIPPED)
return self.rc_res.getReturnCode(ModuleResult.WARNING)

do_mount = self.cs.os_helper.is_windows() # @TODO
if 'restore_bootloader' == mode:
Expand Down
12 changes: 1 addition & 11 deletions chipsec/testcase.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

class ExitCode:
OK = 0
SKIPPED = 1
WARNING = 2
DEPRECATED = 4
FAIL = 8
Expand All @@ -45,7 +44,6 @@ class ExitCode:
CHIPSEC returns an integer exit code:
- Exit code is 0: all modules ran successfully and passed
- Exit code is not 0: each bit means the following:
- Bit 0: SKIPPED at least one module was skipped for the platform
- Bit 1: WARNING at least one module had a warning
- Bit 2: DEPRECATED at least one module uses deprecated API
- Bit 3: FAIL at least one module failed
Expand Down Expand Up @@ -122,7 +120,6 @@ def order_summaryL(self) -> Dict[str, List[TestCase]]:
failed = []
errors = []
warnings = []
skipped = []
information = []
notapplicable = []
executed = 0
Expand All @@ -137,8 +134,6 @@ def order_summaryL(self) -> Dict[str, List[TestCase]]:
errors.append(fields['name'])
elif fields['result'] == 'Warning':
warnings.append(fields['name'])
elif fields['result'] == 'Skipped':
skipped.append(fields['name'])
elif fields['result'] == 'Information':
information.append(fields['name'])
elif fields['result'] == 'NotApplicable':
Expand All @@ -149,7 +144,6 @@ def order_summaryL(self) -> Dict[str, List[TestCase]]:
ret['information'] = information
ret['failed'] = failed
ret['warnings'] = warnings
ret['skipped'] = skipped
ret['not applicable'] = notapplicable
ret['exceptions'] = self.exceptions
return ret
Expand All @@ -164,8 +158,6 @@ def get_return_codeL(self) -> int:
return ExitCode.FAIL
elif len(summary['warnings']) != 0:
return ExitCode.WARNING
elif len(summary['skipped']) != 0:
return ExitCode.SKIPPED
elif len(summary['not applicable']) != 0:
return ExitCode.NOTAPPLICABLE
elif len(summary['information']) != 0:
Expand Down Expand Up @@ -282,15 +274,13 @@ def markdown_full(self, name: str) -> str:
failed = []
error = []
warning = []
skipped = []
information = []
notapplicable = []
deprecated = []
destination = {'Passed': passed,
'Failed': failed,
'Error': error,
'Warning': warning,
'Skipped': skipped,
'Information': information,
'NotApplicable': notapplicable,
'Deprecated': deprecated
Expand Down Expand Up @@ -347,7 +337,7 @@ def print_summaryL(self, runtime: Optional[float] = None) -> None:
logger().log_information(mod)
elif result == 'failed':
logger().log_failed(mod)
elif result in ['not applicable', 'skipped']:
elif result in 'not applicable':
logger().log_not_applicable(mod)
logger().log('[CHIPSEC] *****************************************************************')

Expand Down
2 changes: 1 addition & 1 deletion chipsec_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def run_module(self, modx, module_argv):
if self.verify_module_tags(modx):
result = modx.run(module_argv)
else:
return module_common.ModuleResult.SKIPPED
return module_common.ModuleResult.NOTAPPLICABLE
except BaseException as msg:
if self.logger.DEBUG:
self.logger.log_bad(traceback.format_exc())
Expand Down
5 changes: 1 addition & 4 deletions docs/sphinx/usage/Interpreting-Results.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ messages and meaning of information returned by CHIPSEC.
Results
-------

Currently, the SKIPPED return value is ambiguous. The proposed **new**
definition of the return values is listed below:

.. list-table:: Generic results meanings
:widths: 25 25
:header-rows: 1
Expand All @@ -27,7 +24,7 @@ definition of the return values is listed below:
- A known **vulnerability** has been detected
* - WARNING
- We have detected something that could be a vulnerability but **manual analysis is required** to confirm (inconclusive)
* - NOT_APPLICABLE (SKIPPED)
* - NOT_APPLICABLE
- The issue checked by this module is not applicable to this platform. This result can be ignored
* - INFORMATION
- This module does not check for a vulnerability. It just prints information about the system
Expand Down
2 changes: 1 addition & 1 deletion tests/hardware/test_elitebook_1040_ubuntu.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class EliteBook1040UbuntuTest(test_ubuntu.GenericUbuntuTest):
"chipsec.modules.smm_dma",
]

SKIPPED = [
WARNING = [
"chipsec.modules.common.secureboot.variables",
"chipsec.modules.common.uefi.s3bootscript",
"chipsec.modules.common.uefi.access_uefispec",
Expand Down
4 changes: 2 additions & 2 deletions tests/hardware/test_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,5 @@ def _generic_main(self):
"At least one test raised an error")
for test in self.PASS:
self.assertIn("PASSED: {}".format(test), self.log)
for test in self.SKIPPED:
self.assertIn("SKIPPED: {}".format(test), self.log)
for test in self.WARNING:
self.assertIn("WARNING: {}".format(test), self.log)
2 changes: 1 addition & 1 deletion tests/hardware/test_x1_carbon_ubuntu.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class X1CarbonUbuntuTest(test_ubuntu.GenericUbuntuTest):
"chipsec.modules.smm_dma"
]

SKIPPED = []
WARNING = []

def test_main(self):
self._generic_main()
2 changes: 1 addition & 1 deletion tests/hardware/test_z420_ubuntu.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Z420UbuntuTest(test_ubuntu.GenericUbuntuTest):
]

# This platform does not support the following tests
SKIPPED = [
WARNING = [
"chipsec.modules.common.smm",
"chipsec.modules.remap",
"chipsec.modules.smm_dma"
Expand Down

0 comments on commit 06952e1

Please sign in to comment.