Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests and command line tool #143

Closed
wants to merge 2 commits into from
Closed

Fix tests and command line tool #143

wants to merge 2 commits into from

Conversation

zaolin
Copy link
Collaborator

@zaolin zaolin commented Jul 30, 2020

See #142

@zaolin zaolin requested a review from ChriMarMe July 30, 2020 20:10
Copy link
Collaborator

@ChriMarMe ChriMarMe left a comment

Choose a reason for hiding this comment

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

Some things are questionable.

Comment on lines +53 to +63
func systemRunsCoreboot() (bool, error) {
firmware, err := tools.SMBIOSGetVendor()
if err != nil {
return false, err
}
if strings.Contains(*firmware, string(test.FWCoreboot)) {
return true, nil
}
return false, nil
}

Copy link
Collaborator

@ChriMarMe ChriMarMe Jul 31, 2020

Choose a reason for hiding this comment

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

This does not belong here.
Maybe a new test set for precondition tests, or move this to ACPI tests, because it's only relevant for this tests so far.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also a separate commit - "Implementing test to validate if system runs coreboot" or similar

Comment on lines -127 to -133
testnosiniterrors = Test{
Name: "SINIT ACM startup successful",
Required: false,
NonCritical: true,
function: NoSINITErrors,
Status: Implemented,
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why was this removed?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also seperate commit

func (t Result) String() string {
return [...]string{"TESTNOTRUN", "DEPENDENCY_FAILED", "INTERNAL_ERROR", "FAIL", "WARN", "PASS"}[t]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why remove the concept of warn?

Copy link
Collaborator

@ChriMarMe ChriMarMe Jul 31, 2020

Choose a reason for hiding this comment

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

Also separate commit.

Comment on lines -898 to +868
// AutoPromotionModeIsActive checks if TXT is in auto-promotion mode
func AutoPromotionModeIsActive(txtAPI hwapi.APIInterfaces) (bool, error, error) {
// TXTModeIsSet checks if a TXT mode is set
func TXTModeIsSet(txtAPI hwapi.APIInterfaces) (bool, error, error) {
pol1, pol2, err := readPSLCPPolicy(txtAPI)
if err != nil {
return false, nil, err
}
if pol1 != nil {
if pol1.PolicyType != tools.LCPPolicyTypeAny {
return false, fmt.Errorf("Signed Policy mode active"), nil
return true, fmt.Errorf("Signed Policy mode active"), nil
}
}
if pol2 != nil {
if pol2.PolicyType != tools.LCPPolicyTypeAny {
return false, fmt.Errorf("Signed Policy mode active"), nil
}
}
return true, nil, nil
}

// SignedPolicyModeIsActive checks if TXT is in signed policy mode
func SignedPolicyModeIsActive(txtAPI hwapi.APIInterfaces) (bool, error, error) {
pol1, pol2, err := readPSLCPPolicy(txtAPI)
if err != nil {
return false, nil, err
}
if pol1 != nil {
if pol1.PolicyType != tools.LCPPolicyTypeList {
return false, fmt.Errorf("Auto-promotion mode active"), nil
return true, fmt.Errorf("Auto-promotion mode active"), nil
}
}
if pol2 != nil {
if pol2.PolicyType != tools.LCPPolicyTypeAny {
return true, fmt.Errorf("Signed Policy mode active"), nil
}
if pol2.PolicyType != tools.LCPPolicyTypeList {
return false, fmt.Errorf("Auto-promotion mode active"), nil
return true, fmt.Errorf("Auto-promotion mode active"), nil
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why we dont keep the granularity?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe you guessed it ;) Separate commit

@@ -287,7 +286,7 @@ func IBBIsTrusted(txtAPI hwapi.APIInterfaces) (bool, error, error) {
if regs.BootStatus&(1<<59) != 0 && regs.BootStatus&(1<<63) != 0 {
return true, nil, nil
}
return false, fmt.Errorf("IBB not trusted"), err
return true, fmt.Errorf("IBB not trusted, MLE not running"), err
Copy link
Collaborator

Choose a reason for hiding this comment

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

That's impossible. If something returns true all error must be nil.

@@ -19,6 +19,7 @@ var (
Required: true,
function: CheckRSDPValid,
Status: Implemented,
Firmware: FWNoCoreboot,
Copy link
Collaborator

Choose a reason for hiding this comment

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

The new Field Firmware is just wrong, whatever it does. That's not clear from the commit message.

)

// SMBIOSGetVendor gets the vendor name from table 0
func SMBIOSGetVendor() (*string, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

that must be astracted over the hwapi.

@zaolin zaolin closed this Aug 7, 2020
@ChriMarMe ChriMarMe deleted the fb-fixes branch March 26, 2021 12:42
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.

3 participants