diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2017-09-24 11:13:37 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2017-09-25 15:19:06 +0200 |
| commit | af442a22d956464e7df703b290fa49d78dda3dfa (patch) | |
| tree | b50403630f29373cfb711a711fbfd24d632ce2ba /sys/syz-extract/linux.go | |
| parent | 255e8b5e54e93fc77302a546dbb7a932412d1bde (diff) | |
executor, sys/windows: initial windows support
Diffstat (limited to 'sys/syz-extract/linux.go')
| -rw-r--r-- | sys/syz-extract/linux.go | 33 |
1 files changed, 5 insertions, 28 deletions
diff --git a/sys/syz-extract/linux.go b/sys/syz-extract/linux.go index 8c38c75ee..7a0a226ef 100644 --- a/sys/syz-extract/linux.go +++ b/sys/syz-extract/linux.go @@ -9,7 +9,6 @@ import ( "os" "os/exec" "regexp" - "strconv" "strings" "time" @@ -21,6 +20,9 @@ import ( type linux struct{} func (*linux) prepare(sourcedir string, build bool, arches []string) error { + if sourcedir == "" { + return fmt.Errorf("provide path to kernel checkout via -sourcedir flag (or make extract SOURCEDIR)") + } if build { // Otherwise out-of-tree build fails. fmt.Printf("make mrproper\n") @@ -110,34 +112,9 @@ func (*linux) processFile(arch *Arch, info *compiler.ConstInfo) (map[string]uint } defer os.Remove(bin) - out, err = exec.Command(bin).CombinedOutput() + res, err := runBinaryAndParse(bin, vals, undeclared) if err != nil { - return nil, nil, fmt.Errorf("failed to run flags binary: %v\n%v", err, string(out)) - } - - flagVals := strings.Split(string(out), " ") - if len(out) == 0 { - flagVals = nil - } - if len(flagVals) != len(vals)-len(undeclared) { - return nil, nil, fmt.Errorf("fetched wrong number of values %v != %v - %v\nflagVals: %q\nvals: %q\nundeclared: %q", - len(flagVals), len(vals), len(undeclared), - flagVals, vals, undeclared) - } - res := make(map[string]uint64) - j := 0 - for _, v := range flagVals { - name := vals[j] - j++ - for undeclared[name] { - name = vals[j] - j++ - } - n, err := strconv.ParseUint(v, 10, 64) - if err != nil { - return nil, nil, fmt.Errorf("failed to parse value: %v (%v)", err, v) - } - res[name] = n + return nil, nil, err } return res, undeclared, nil } |
