aboutsummaryrefslogtreecommitdiffstats
path: root/sys/targets
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-05-27 14:26:00 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-05-27 14:38:28 +0200
commitfdf90f622b4f956a77b51bdc10e382c134c221b8 (patch)
tree4a57f176322d13caab12b13db77586316825aee4 /sys/targets
parent9072c1268eaa464b9adbba5c8e11d308f15d1a92 (diff)
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).
Diffstat (limited to 'sys/targets')
-rw-r--r--sys/targets/targets.go8
1 files changed, 8 insertions, 0 deletions
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
}
}