Skip to content
This repository has been archived by the owner on May 6, 2020. It is now read-only.

cc-check: Always run all tests #639

Merged

Conversation

jodh-intel
Copy link
Contributor

Change "cc-check" so that it always runs all commands before erroring.

Previously, it would fail on first error, but this could mask the real
reason for failure. For example, on a system with nesting and vhost
disabled, "cc-check" would fail with a nesting error. But the nesting
check is not strictly required (#281) whereas vhost definitely is which
lead to confusing results for users.

"cc-check" will now run all tests and display an error message at the end
if any errors were found in the set of tests run.

Fixes #638.

Signed-off-by: James O. D. Hunt [email protected]

cc-check.go Outdated
}

ccLog.Error(msg)
count += 1

Choose a reason for hiding this comment

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

should replace count += 1 with count++

cc-check.go Outdated
}

for module, details := range modules {
if !haveKernelModule(module) {
return fmt.Errorf("kernel module %q (%s) not found", module, details.desc)
ccLog.Errorf("kernel module %q (%s) not found", module, details.desc)
count += 1

Choose a reason for hiding this comment

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

should replace count += 1 with count++

cc-check.go Outdated
// checkKernelModules checks all required kernel modules and returns an error
// for fatal issues along with a count of the number of module errors seen
// (all such errors are logged by this function).
func checkKernelModules(modules map[string]kernelModule) (err error, count uint32) {

Choose a reason for hiding this comment

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

error should be the last type when returning multiple items

cc-check.go Outdated
return checkCPU("flag", cpuflags, required)
}

func checkCPUAttribs(cpuinfo string, attribs map[string]string) error {
func checkCPUAttribs(cpuinfo string, attribs map[string]string) (error, uint32) {

Choose a reason for hiding this comment

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

error should be the last type when returning multiple items

cc-check.go Outdated
}
func checkCPUFlags(cpuflags string, required map[string]string) error {
func checkCPUFlags(cpuflags string, required map[string]string) (error, uint32) {

Choose a reason for hiding this comment

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

error should be the last type when returning multiple items

cc-check.go Outdated
}

for attrib, desc := range attribs {
found := findAnchoredString(cpuinfo, attrib)
if !found {
return fmt.Errorf("CPU does not have required %v: %q (%s)", tag, desc, attrib)
ccLog.Errorf("CPU does not have required %v: %q (%s)", tag, desc, attrib)
count += 1

Choose a reason for hiding this comment

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

should replace count += 1 with count++

cc-check.go Outdated
// checkCPU checks all required CPU attributes modules and returns an error
// for fatal issues along with a count of the number of CPU attribute errors
// seen (all such errors are logged by this function).
func checkCPU(tag, cpuinfo string, attribs map[string]string) (err error, count uint32) {

Choose a reason for hiding this comment

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

error should be the last type when returning multiple items

@jodh-intel jodh-intel force-pushed the cc-check-always-run-all-tests branch from a3b844b to 8025fa7 Compare September 27, 2017 13:29
Change "cc-check" so that it always runs all commands before erroring.

Previously, it would fail on first error, but this could mask the real
reason for failure. For example, on a system with nesting and vhost
disabled, "cc-check" would fail with a nesting error. But the nesting
check is not strictly required (clearcontainers#281) whereas vhost definitely is which
lead to confusing results for users.

"cc-check" will now run all tests and display an error message at the end
if any errors were found in the set of tests run.

Fixes clearcontainers#638.

Signed-off-by: James O. D. Hunt <[email protected]>
KVM nesting support is not strictly necessary, so warn rather than
erroring if not available.

Fixes clearcontainers#281.

Signed-off-by: James O. D. Hunt <[email protected]>
@jodh-intel jodh-intel force-pushed the cc-check-always-run-all-tests branch from 8025fa7 to 413e2ed Compare September 27, 2017 13:35
@sameo
Copy link

sameo commented Sep 27, 2017

LGTM

Approved with PullApprove Approved with PullApprove

Copy link
Contributor

@grahamwhaley grahamwhaley left a comment

Choose a reason for hiding this comment

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

nice cleanup.
lgtm

@jodh-intel
Copy link
Contributor Author

Again, coverall is stuck - the report is here: https://coveralls.io/jobs/29737580 (successful).

@sameo sameo merged commit f5bc403 into clearcontainers:master Sep 27, 2017
@sameo sameo removed the in progress label Sep 27, 2017
@clearcontainersbot
Copy link

kubernetes qa-passed 👍

mcastelino pushed a commit to mcastelino/runtime that referenced this pull request Dec 6, 2018
…aller-than-image

config: Detect if VM memory smaller than image
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants