From 478efa7f2f5af720ac23b860a65d458f3db39b0c Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Thu, 11 Apr 2024 12:04:52 +0200 Subject: pkg/cover: fix riscv tests The TestReportGenerator/linux-riscv64/good-pie-relocs is broken due to some misinteroperability between gcc riscv cross-compiler and llvm-addr2line. Run the test only with clang. --- pkg/cover/report_test.go | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'pkg') diff --git a/pkg/cover/report_test.go b/pkg/cover/report_test.go index ab0be490b..7d5fa00c3 100644 --- a/pkg/cover/report_test.go +++ b/pkg/cover/report_test.go @@ -111,9 +111,24 @@ func TestReportGenerator(t *testing.T) { LDFlags: []string{"-pie", "-Wl,--section-start=.text=0x33300000,--emit-relocs"}, DebugInfo: true, Supports: func(target *targets.Target) bool { - return target.OS == targets.Fuchsia || - target.OS == targets.Linux && target.Arch != targets.ARM64 && - target.Arch != targets.ARM && target.Arch != targets.I386 + if target.OS == targets.Fuchsia { + return true + } + if target.OS == targets.Linux { + if target.Arch == targets.RiscV64 { + // When the binary is compiled with gcc and parsed with + // llvm-addr2line, we get an invalid "func_name", which + // breaks our tests. + fmt.Printf("target.CCompiler=%s", target.CCompiler) + return target.CCompiler == "clang" + } + if target.Arch == targets.ARM64 || target.Arch == targets.ARM || + target.Arch == targets.I386 { + return false + } + return true + } + return false }, }, } -- cgit mrf-deployment