From 83e51e232df3ec62a9aaecc60e518529601194b1 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Wed, 26 Jun 2024 12:24:19 +0200 Subject: 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) --- pkg/csource/build.go | 4 ++++ 1 file changed, 4 insertions(+) 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 { -- cgit mrf-deployment