Skip to content

Refactor efi/preinstall#552

Merged
frederic-hoerni merged 9 commits into
masterfrom
refactor-preinstall
Jun 22, 2026
Merged

Refactor efi/preinstall#552
frederic-hoerni merged 9 commits into
masterfrom
refactor-preinstall

Conversation

@frederic-hoerni

@frederic-hoerni frederic-hoerni commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

This modification refactors part of efi/preinstall to reduce duplicated code in tests and split Run() into smaller functions.

It also adds license, readme and makefile to give a little more context about secboot.

@pedronis pedronis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small naming comment

Comment thread internal/efitest/wincert.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors parts of efi/preinstall to reduce test duplication and simplify error/action handling in RunChecksContext, while also adding top-level project metadata (license/readme/make targets) to improve repo usability.

Changes:

  • Extracts error classification/action derivation into RunChecksContext.convertErrorsToActions and simplifies Run() control flow.
  • Deduplicates a large amount of preinstall test setup by introducing shared mock MEI fw_status constants and a shared default EFI image set.
  • Adds README.md, COPYING, and a Makefile with convenient build/test/coverage targets; increases run-tests timeout.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
run-tests Extends go test timeout to 30m.
README.md Adds a brief project overview, features list, and license pointer.
Makefile Adds build + test convenience targets, including focused efi/preinstall coverage runs.
internal/efitest/wincert.go Splits Authenticode detached win-cert creation into a reusable base helper and adds “must” variant.
efi/preinstall/preinstall_test.go Precomputes a reusable WinCertificate instance for tests.
efi/preinstall/intel_mei_test.go Introduces shared mock fw_status register encodings for MEI/BootGuard tests.
efi/preinstall/efi_images_test.go Adds shared default mock EFI images + digests for tests.
efi/preinstall/checks_test.go Switches many tests to use shared MEI fw_status data and shared default images.
efi/preinstall/checks_context.go Refactors RunChecksContext.Run() by extracting error→actions conversion logic.
efi/preinstall/check_pcr7_test.go Uses shared digest constants to reduce repetition.
efi/preinstall/check_pcr4_test.go Uses shared digest constants to reduce repetition.
efi/preinstall/check_host_security_intel_test.go Uses shared MEI fw_status test vectors.
efi/preinstall/check_host_security_amd64_test.go Uses shared MEI fw_status test vectors.
COPYING Adds GPLv3 license text.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread efi/preinstall/checks_context.go
Comment thread internal/efitest/wincert.go
Comment thread efi/preinstall/intel_mei_test.go
Comment thread efi/preinstall/checks_test.go

@pedronis pedronis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@frederic-hoerni thanks for splitting the refactorings, some of the copilot comments seemsat least worth answering to

@frederic-hoerni

Copy link
Copy Markdown
Collaborator Author

I took into account the remarks. I will squash the relevant commits when all will be approved.

@pedronis pedronis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you

@frederic-hoerni
frederic-hoerni merged commit 2455c79 into master Jun 22, 2026
2 checks passed
@frederic-hoerni
frederic-hoerni deleted the refactor-preinstall branch June 23, 2026 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants