Commit Graph

76 Commits

Author SHA1 Message Date
Nathaniel Mitchell be074e9d7c Update distro check in test_generic
platform.linux_distribution was deprecated in 3.5 and removed in 3.7.

Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2024-09-19 23:58:49 -07:00
Nathaniel Mitchell 7aedf7ebdf Use more generic 'codename' for mSystem in test_generic
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2024-09-09 16:37:01 -07:00
jun2zhou d619c5f746 Update linux distro api (#2282)
* Update linux distro api

Signed-off-by: Jason Zhou <jun2.zhou@intel.com>
2024-09-09 16:35:45 -07:00
Nathaniel Mitchell 6e43a6edae Fix record/replay helpers to capture exceptions
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2024-08-26 16:38:52 -07:00
Nathaniel Mitchell aedaa7531f Fix bug when msgbus_cmd returns wrong value type in windows
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2024-07-30 14:12:32 -07:00
Nathaniel Mitchell cb2da0145f Add more tests for windows helper
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2024-06-17 16:35:52 -07:00
Nathaniel Mitchell 39cf4bb620 Add UTs for ec_cmd and config_cmd
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2024-05-28 16:42:16 -07:00
Nathaniel Mitchell ed9c6e2896 Update how ACPI Tables are found
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2024-04-17 15:27:21 -07:00
Dan Scott 2a412e0cc0 Enumerate modules in modules folder using '-lm' 2024-03-28 13:49:05 -07:00
Sae86 4a7afd23cb Add unit testing for msr_cmd, mmcfg_cmd, mmcfg_base_cmd, desc_cmd and cpu_cmd
Signed-off-by: Sae86 <sara.batllori@intel.com>
2024-03-28 11:06:56 -07:00
Dan Scott 0e8192cfd0 Move files to library folder 2024-03-22 14:26:59 -07:00
Dan Scott a933b1337d Update references to functions in new library files 2024-03-22 14:26:59 -07:00
Sae86 6adf3dfae0 Add unit tests for acpi_cmd, chipset_cmd, cmos_cmd
Signed-off-by: Sae86 <sara.batllori@intel.com>
2023-12-11 13:35:11 -08:00
Nathaniel Mitchell 05805dd1f6 Set the logger.HAL flag to false for unit tests
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-12-11 10:46:46 -08:00
Nathaniel Mitchell bf69ab9391 Fix tgl debugenabled unit test replay
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-12-01 13:39:59 -08:00
Nathaniel Mitchell 0e44e6ae19 Remove mistakenly added log filters from tgl tests
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-11-20 16:37:42 -08:00
Nathaniel Mitchell f005fba0c6 Make sure DID/VID is printed when platform is unknown
And fixes unit tests

Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-11-13 16:36:49 -08:00
Nathaniel Mitchell a198b99b41 Add _logger.disable() to tests to reduce prints
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-11-09 16:17:50 -08:00
Sae86 c282cd9e2c Add tpm_cmd and txt_cmd unit testing
Signed-off-by: Sae86 <sara.batllori@intel.com>
2023-10-26 08:42:24 -07:00
Nathaniel Mitchell 4759db046f Add tgl tests for all modules
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-10-25 21:29:36 -07:00
Nathaniel Mitchell b1533ea07c Update strip_record to fix bug and update run_chipsec_module
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-10-25 16:34:37 -07:00
Nathaniel Mitchell a7df794272 Update sgx_check unit test and add script to shorten recordings
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-10-20 08:32:48 -07:00
Sae86 4a8057d904 Update remaining SKIPPED results and references
Signed-off-by: Sae86 <sara.batllori@intel.com>
2023-10-17 16:36:31 -07:00
Nathaniel Mitchell fbccec7756 Fix import and possible unbound errors
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-10-16 16:38:21 -07:00
Nathaniel Mitchell 6a23a6e968 Add initial windows helper unit tests
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-09-29 09:20:39 -07:00
Nathaniel Mitchell e3b4473bad Update assertRegexpMatch to assertRegex and base Helper to NoneHelper
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-08-21 16:36:12 -07:00
Nathaniel Mitchell 40413338a2 Update cfg_checker test to skip folders
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-08-18 01:16:48 -07:00
Nathaniel Mitchell 89f4be530f Update sgx_check and vbox_crash_apicbase
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-08-15 16:39:01 -07:00
Jason Zhou 1c74b78d41 Use better syntax remove close()
Signed-off-by: Jason Zhou <jun2.zhou@intel.com>
2023-08-07 16:37:50 -07:00
Jason Zhou dd5bd728b7 Fix helper record test
comparing test context by lines, ignore the Unix & window line ending difference.

Signed-off-by: Jason Zhou <jun2.zhou@intel.com>
2023-08-07 16:37:50 -07:00
Nathaniel Mitchell 483f9d99f6 Update unittests to match config parsing update
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-07-28 09:34:00 -07:00
Nathaniel Mitchell 435bf2ab06 Add cfg checking tests (non-unittest)
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-07-26 16:17:38 -07:00
Nathaniel Mitchell c3b27e7870 Add record and replay helpers
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-07-26 15:31:56 -07:00
Nathaniel Mitchell 27ee5eeb66 Clean up helper create/start/stop/delete functions
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-07-19 16:33:59 -07:00
jun2zhou e143924fdd Cpuinfo unittest (#1887)
* Add test cpu info unittest cases

Signed-off-by: Jason Zhou <jun2.zhou@intel.com>

* Add __init__.py to this folder to be picked up by cmd "py setup.py test"

Signed-off-by: Jason Zhou <jun2.zhou@intel.com>

* Remove unused import

Signed-off-by: Jason Zhou <jun2.zhou@intel.com>

---------

Signed-off-by: Jason Zhou <jun2.zhou@intel.com>
2023-07-11 16:37:29 -07:00
Nicolas Iooss f1dfa2dcdd Remove from_file from method start in base helper
Commit 99f9052438 ("Remove filehelper") removed `from_file` and
`to_file` from `OsHelper` but it remained in `BaseHelper`. Remove these
parameters too.

While at it, remove the similar parameters from the mock helper used in
tests.

Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
2023-07-10 16:42:07 -07:00
Jason Zhou 7f58472655 Fix test_pch_invalid() test failing on internal builds
the test invalid pch mock helper returned fake pch id, but valid plat id,
if plat id matched xml file defined reqs_pch=true, will cause exception,
the mocked plat id corresponding xml is reqs_pch=true.

Signed-off-by: Jason Zhou <jun2.zhou@intel.com>
2023-07-10 16:41:29 -07:00
Nathaniel Mitchell ede85bfcbf Fix mocked module scoping issue in unittest
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-06-26 16:36:48 -07:00
Frinzell, Aaron 41ecf2cdb1 Implement basehelper.py as an ABC
Signed-off-by: Frinzell, Aaron <aaron.frinzell@intel.com>
2023-06-23 08:27:17 -07:00
Nathaniel Mitchell 2fbfb5fb89 Add initial set of linuxhelper unittests
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-06-21 16:41:46 -07:00
Nicolas Iooss a61dbc8d2b Make mocked function read_phys_mem return bytes
In tests, `read_phys_mem` could return strings instead of bytes, which
prevents detecting issues with `chipsec_util.py gdt` and
`chipsec_util.py idt`.

Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
2023-05-31 16:39:35 -07:00
Nathaniel Mitchell 745ae9084e Clean up HALs and Helpers
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-05-26 18:33:08 -07:00
Nathaniel Mitchell 0016b0c14c Clean up oshelper
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-05-26 18:32:51 -07:00
Frinzell, Aaron 54789d6f51 Add cpu.py unit tests
Signed-off-by: Frinzell, Aaron <aaron.frinzell@intel.com>
2023-05-24 16:37:35 -07:00
Zhou, Jun2 63b772344b Add a fake cpuid func to support invalid platform unit test
Signed-off-by: Zhou Jun, jun2.zhou@intel.com
2022-12-05 11:27:03 -08:00
Frinzell, Aaron fbde218dff Update tests for decoupling parse_arg()
Signed-off-by: Frinzell, Aaron <aaron.frinzell@intel.com>
2022-12-05 12:16:00 -06:00
Nathaniel Mitchell 291632c0ee Apply flake8 code formatting rules against repo
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2022-07-28 09:17:10 -07:00
brentholtsclaw 0e53326a83 Create exceptions.py for chipsec exceptions
Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2021-08-26 10:50:51 -07:00
Nathaniel Mitchell c8c14e21be Remove shebang from all but the entry points. Update ep to py3
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2021-08-12 08:27:33 -07:00
Nicolas Iooss 41ff0d4530 Configure GitHub Actions to test some features
Introduce some configuration for GitHub Action jobs which:

* Build chipsec's Linux kernel module for several Linux distributions
  (using Docker containers).
* Build chipsec's Windows kernel driver (using the Visual Studio
  installation provided in Windows images of GitHub Actions) and run
  `python setup.py install` on Windows.
* Install chipsec in some Ubuntu virtual machines and run
  `python setup.py install` and `chipsec_main`.

For now, only x86_64 architecture is tested.
2021-05-18 20:07:47 -07:00