From 1623c95de18e7743bc514fae929d37ece749bdf4 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 12 Jan 2018 15:20:51 +0100 Subject: sys/syz-extract: don't run mrproper if already clean mrproper takes unreasonable amount of time. --- sys/syz-extract/linux.go | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'sys') 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 { -- cgit mrf-deployment