From fdf90f622b4f956a77b51bdc10e382c134c221b8 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Wed, 27 May 2020 14:26:00 +0200 Subject: pkg/cover: add test for report generation Test various combinations of no debug info, no coverage instrumentation, no PCs, bad PCs, good PCs, and what errors we produce for these. Also implement support for cross-arch reports: prefix objdump with cross-compile prefix (e.g. aarch64-linux-gnu-objdump instead of objdump). --- sys/targets/targets.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'sys/targets') diff --git a/sys/targets/targets.go b/sys/targets/targets.go index ee42ea3ad..22333048b 100644 --- a/sys/targets/targets.go +++ b/sys/targets/targets.go @@ -67,6 +67,8 @@ type osCommon struct { CPP string // Common CFLAGS for this OS. cflags []string + // If set, this OS uses $SOURCEDIR to locate the toolchain. + NeedsSourceDir bool } func Get(OS, arch string) *Target { @@ -356,6 +358,7 @@ var oses = map[string]osCommon{ ExecutorUsesShmem: true, ExecutorUsesForkServer: true, KernelObject: "netbsd.gdb", + NeedsSourceDir: true, }, "openbsd": { SyscallNumbers: true, @@ -373,6 +376,7 @@ var oses = map[string]osCommon{ HostFuzzer: true, SyzExecutorCmd: "syz-executor", KernelObject: "zircon.elf", + NeedsSourceDir: true, }, "windows": { SyscallNumbers: false, @@ -389,6 +393,7 @@ var oses = map[string]osCommon{ ExecutorUsesForkServer: true, HostFuzzer: true, KernelObject: "akaros-kernel-64b", + NeedsSourceDir: true, }, "trusty": { SyscallNumbers: true, @@ -501,6 +506,9 @@ func (target *Target) lazyInit() { // On CI we want to fail loudly if cross-compilation breaks. if _, err := exec.LookPath(target.CCompiler); err != nil { target.BrokenCompiler = fmt.Sprintf("%v is missing", target.CCompiler) + if target.NeedsSourceDir && os.Getenv("SOURCEDIR") == "" { + target.BrokenCompiler = "SOURCEDIR is not set" + } return } } -- cgit mrf-deployment