hwid: Refactors the HWID v3 framework.
This CL does:
1. Simplify the BOM class to record only `encoding_pattern_index`,
`image_id` and `components` because only these 3 items are enough
for encoding.
2. Revise the `transformer` module to match the change of `BOM`.
3. Re-write the unittest for `transformer` module so that it only test
whether that module works or not.
4. Revise the `verifier` module to match the change of `BOM`.
5. Re-write the unittest for `verifier` module so that it only test
whether that module works or not.
6. Remove unused method in `database` module.
7. Re-write the test code for `hwid_utils` module by a clear way
as now `BOM` class is much more simplier.
8. Adds unittest for `hwid_cmdline`.
BUG=chromium:689944
TEST=make test
Change-Id: I3034cb131b36df9996539b401bc7e5b394c077da
Reviewed-on: https://chromium-review.googlesource.com/861685
Commit-Ready: Yong Hong <yhong@google.com>
Tested-by: Yong Hong <yhong@google.com>
Reviewed-by: Yong Hong <yhong@google.com>
diff --git a/py/gooftool/commands.py b/py/gooftool/commands.py
index 904a34b..25de5d1 100755
--- a/py/gooftool/commands.py
+++ b/py/gooftool/commands.py
@@ -744,22 +744,19 @@
This is mainly for Gooftool to verify v3 HWID during finalize. For testing
and development purposes, please use `hwid` command.
"""
- db = GetGooftool(options).db
- encoded_string = options.hwid or GetGooftool(options).ReadHWID()
- if options.probe_results:
- probed_results = hwid_utils.GetProbedResults(infile=options.probe_results)
- else:
- probed_results = GetGooftool(options).Probe()
+ database = GetGooftool(options).db
- vpd = hwid_utils.GetVPDData(options.hwid_run_vpd, options.hwid_vpd_data_file)
+ encoded_string = options.hwid or GetGooftool(options).ReadHWID()
+
+ probed_results = hwid_utils.GetProbedResults(infile=options.probe_results)
+ vpd = hwid_utils.GetVPDData(run_vpd=options.hwid_run_vpd,
+ infile=options.hwid_vpd_data_file)
event_log.Log('probed_results', probed_results=FilterDict(probed_results))
event_log.Log('vpd', vpd=FilterDict(vpd) if vpd is None else None)
- bom = hwid_utils.GenerateBOMFromProbedResults(db, probed_results)
-
- hwid_utils.VerifyHWID(db, encoded_string, bom, vpd=vpd,
- rma_mode=options.rma_mode)
+ hwid_utils.VerifyHWID(database, encoded_string, probed_results=probed_results,
+ vpd=vpd, rma_mode=options.rma_mode)
event_log.Log('verified_hwid', hwid=encoded_string)