aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/build/linux.go
diff options
context:
space:
mode:
authorGreg Steuck <blackgnezdo@gmail.com>2019-02-11 02:09:05 -0800
committerDmitry Vyukov <dvyukov@google.com>2019-02-11 11:09:05 +0100
commit5e5bb28ebfd9b28ed8fcdc9def45ee0b1d8a5d4a (patch)
tree4c94f8155f108687bdbb8fa3e14fca13252590b6 /pkg/build/linux.go
parentb4f792e401f416ff9fc75716d2500971ba63d1db (diff)
pkg/build: share extractRootCause with openbsd
* pkg/build: share extractRootCause with openbsd This should get kernel build errors reported in syz-ci console. * Add a test * lint
Diffstat (limited to 'pkg/build/linux.go')
-rw-r--r--pkg/build/linux.go37
1 files changed, 0 insertions, 37 deletions
diff --git a/pkg/build/linux.go b/pkg/build/linux.go
index dbe9cfbb7..f4dff538f 100644
--- a/pkg/build/linux.go
+++ b/pkg/build/linux.go
@@ -10,7 +10,6 @@
package build
import (
- "bytes"
"fmt"
"io/ioutil"
"os"
@@ -124,39 +123,3 @@ func (linux) clean(kernelDir string) error {
_, err := osutil.Run(10*time.Minute, cmd)
return err
}
-
-func extractRootCause(err error) error {
- verr, ok := err.(*osutil.VerboseError)
- if !ok {
- return err
- }
- var cause []byte
- for _, line := range bytes.Split(verr.Output, []byte{'\n'}) {
- for _, pattern := range buildFailureCauses {
- if pattern.weak && cause != nil {
- continue
- }
- if bytes.Contains(line, pattern.pattern) {
- cause = line
- break
- }
- }
- }
- if cause != nil {
- verr.Title = string(cause)
- }
- return KernelBuildError{verr}
-}
-
-type buildFailureCause struct {
- pattern []byte
- weak bool
-}
-
-var buildFailureCauses = [...]buildFailureCause{
- {pattern: []byte(": error: ")},
- {pattern: []byte(": fatal error: ")},
- {pattern: []byte(": undefined reference to")},
- {weak: true, pattern: []byte(": final link failed: ")},
- {weak: true, pattern: []byte("collect2: error: ")},
-}