diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2018-01-12 15:20:51 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2018-01-13 12:52:09 +0100 |
| commit | 1623c95de18e7743bc514fae929d37ece749bdf4 (patch) | |
| tree | 5a726778367d11d70596c357b2f506ac6c83b3df /sys | |
| parent | 125dadd3c967f34615d7ac0e54a2e0a0aff7f92c (diff) | |
sys/syz-extract: don't run mrproper if already clean
mrproper takes unreasonable amount of time.
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/syz-extract/linux.go | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/sys/syz-extract/linux.go b/sys/syz-extract/linux.go index 5a883e7e0..12fe5383d 100644 --- a/sys/syz-extract/linux.go +++ b/sys/syz-extract/linux.go @@ -5,6 +5,7 @@ package main import ( "fmt" + "path/filepath" "strings" "time" @@ -19,11 +20,17 @@ func (*linux) prepare(sourcedir string, build bool, arches []string) error { 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") - out, err := osutil.RunCmd(time.Hour, sourcedir, "make", "mrproper") - if err != nil { - return fmt.Errorf("make mrproper failed: %v\n%s\n", err, out) + // Run 'make mrproper', otherwise out-of-tree build fails. + // However, it takes unreasonable amount of time, + // so first check few files and if they are missing hope for best. + if osutil.IsExist(filepath.Join(sourcedir, ".config")) || + osutil.IsExist(filepath.Join(sourcedir, "init/main.o")) || + osutil.IsExist(filepath.Join(sourcedir, "include/generated/compile.h")) { + fmt.Printf("make mrproper\n") + out, err := osutil.RunCmd(time.Hour, sourcedir, "make", "mrproper") + if err != nil { + return fmt.Errorf("make mrproper failed: %v\n%s\n", err, out) + } } } else { if len(arches) > 1 { |
