diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2024-06-26 12:24:19 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2024-06-26 11:52:11 +0000 |
| commit | 83e51e232df3ec62a9aaecc60e518529601194b1 (patch) | |
| tree | 24230017bd771d2382a9da5e397797a4e47b97dd | |
| parent | c6d33a012816b8e651cfc2284a27e9659832143b (diff) | |
pkg/csource: build executor w/o optimizations
Build executor w/o optimizations for tests.
Tests can build lots of versions of executor in parallel,
and on overloaded machines it can be slow. On my machine
this reduces executor build time from ~7.5 to ~3.5 secs.
Reduces pkg/runtest tests time considerably.
Before:
--- PASS: TestExecutor (8.89s)
--- SKIP: TestExecutor/386 (0.00s)
--- PASS: TestExecutor/riscv64 (30.76s)
--- PASS: TestExecutor/arm (32.56s)
--- PASS: TestExecutor/arm64 (33.01s)
--- PASS: TestExecutor/amd64 (31.83s)
--- SKIP: TestExecutor/ppc64le (26.56s)
--- PASS: TestExecutor/s390x (25.53s)
--- PASS: TestExecutor/mips64le (25.65s)
After:
--- PASS: TestExecutor (4.74s)
--- SKIP: TestExecutor/386 (0.00s)
--- PASS: TestExecutor/s390x (12.27s)
--- SKIP: TestExecutor/ppc64le (12.59s)
--- PASS: TestExecutor/amd64 (12.84s)
--- PASS: TestExecutor/riscv64 (12.89s)
--- PASS: TestExecutor/arm (11.53s)
--- PASS: TestExecutor/arm64 (11.88s)
--- PASS: TestExecutor/mips64le (12.82s)
| -rw-r--r-- | pkg/csource/build.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/pkg/csource/build.go b/pkg/csource/build.go index 0625e9a03..b7a897473 100644 --- a/pkg/csource/build.go +++ b/pkg/csource/build.go @@ -33,6 +33,10 @@ func BuildNoWarn(target *prog.Target, src []byte) (string, error) { // BuildExecutor builds the executor binary for tests. // rootDir must point to syzkaller root directory in slash notation. func BuildExecutor(t *testing.T, target *prog.Target, rootDir string, cflags ...string) string { + // Build w/o optimizations for tests. Tests can build lots of versions of executor in parallel, + // and on overloaded machines it can be slow. On my machine this reduces executor build time + // from ~7.5 to ~3.5 secs. + cflags = append(cflags, "-O0") bin, err := build(target, nil, filepath.FromSlash(rootDir), filepath.FromSlash("executor/executor.cc"), cflags...) if err != nil { |
