linuxboot / fiano

Go-based tools for modifying UEFI firmware
BSD 3-Clause "New" or "Revised" License
299 stars 49 forks source link

Run visitor tests on ROMs other than OVMF #181

Open rjoleary opened 6 years ago

rjoleary commented 5 years ago

At the present the integration test performs the following:

  1. Extract OVMF image to folder A
  2. Assembly A to image X
  3. Extract X to folder B
  4. Assert diff --recursive A B == 0

The OVMF image and image X cannot be compared directly because they likely use different compression schemes. The integration test solves this problem by comparing the comparing the extracted (decompressed) files and their metadata.

This works fine for the OVMF image checked into the UTK source tree, but we found for some other images (such as the Tyan image publicly available on their downloads page) have a Firmware Volume which expands in size when the image is re-compressed in step 2. This causes the FV metadata and headers to differ between A and B. The difference causes the test to fail.

rjoleary commented 5 years ago

One possibility is to have a regression test. Essentially, the test would compare the metadata contained in the "summary.json" file to the "summary.json" file generated by the image in the previous commit. Each object in "summary.json" can contain a hash of the Buf to represent the file contents. Any new changes, intentional or unintentional, would have to be manually signed off at each commit.

GanShun commented 5 years ago

I like the hash idea! That's a good idea, we can hash only extracted file contents, skipping the headers.