Fix spec file and patch tests to run in package build

This commit is contained in:
Derek Parker 2019-02-20 14:10:25 -08:00
parent c3ae28ead2
commit 6a24acf8d5
3 changed files with 77 additions and 1 deletions

View File

@ -23,6 +23,9 @@ License: MIT
URL: %{gourl}
Source0: %{gosource}
Patch1: ./disable-default-compression-dwz-test.patch
Patch2: ./integration-test-symlinks.patch
BuildRequires: golang(github.com/cosiner/argv)
BuildRequires: golang(github.com/mattn/go-isatty)
BuildRequires: golang(github.com/peterh/liner)
@ -68,7 +71,17 @@ install -Dpm 0755 _bin/dlv %{buildroot}%{_bindir}/dlv
%if %{with check}
%check
%gochecks
# Copy to $GOPATH since modules aren't supported.
export GOPATH=%{gopath}
export GO111MODULE=off
mkdir -p %{gopath}/src/$(dirname %{goipath})
ln -s $(pwd)/. %{gopath}/src/%{goipath}
cd %{gopath}/src/%{goipath}
for i in $(go list ./... | grep -v scripts | grep -v cmd); do
pushd .${i##%{goipath}}
%{gotest}
popd
done
%endif

View File

@ -0,0 +1,36 @@
From 1f9597d3ca2e7d3497f9d28046bbae5522742306 Mon Sep 17 00:00:00 2001
From: Derek Parker <deparker@redhat.com>
Date: Wed, 20 Feb 2019 13:26:18 -0800
Subject: [PATCH] pkg/proc: Disable default compression on DWZ test
When compression is applied by default running the DWZ tool on the
resulting binary will crash.
The actual default compression code will look and see if compression
makes any difference and if so replace the normal `.debug_*` section
with `.zdebug_*`. This is why it may not have been hit before. On one of
my workstations I build with 1.12rc1 and no compression happens, but on
a Fedora VM I build and the binary results in compressed DWARF sections.
Adding this flag will make this test more consistent overall.
---
pkg/proc/test/support.go | 3 +++
1 file changed, 3 insertions(+)
diff --git a/pkg/proc/test/support.go b/pkg/proc/test/support.go
index 9e09da861ec53657bfa0fb9cf76620a4fcd485dc..ccfc1c4939ef6e9c8abbbc67f4fbeaaf0e623de1 100644
--- a/pkg/proc/test/support.go
+++ b/pkg/proc/test/support.go
@@ -125,6 +125,9 @@ func BuildFixture(name string, flags BuildFlags) Fixture {
if flags&BuildModePIE != 0 {
buildFlags = append(buildFlags, "-buildmode=pie")
}
+ if flags&EnableDWZCompression != 0 {
+ buildFlags = append(buildFlags, "-ldflags=-compressdwarf=false")
+ }
if path != "" {
buildFlags = append(buildFlags, name+".go")
}
--
2.16.5

View File

@ -0,0 +1,27 @@
From c4a4e442e2eee35bc26674cb1d2cb28336780891 Mon Sep 17 00:00:00 2001
From: Derek Parker <deparker@redhat.com>
Date: Wed, 20 Feb 2019 14:01:13 -0800
Subject: [PATCH] service/test: Follow symlinks in integration tests
---
service/test/common_test.go | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/service/test/common_test.go b/service/test/common_test.go
index 2b58e371a12472c71beaad0790b001cf4258934c..ee56a53350a45ab790229dd359c472f2c9a952b0 100644
--- a/service/test/common_test.go
+++ b/service/test/common_test.go
@@ -52,6 +52,10 @@ func testProgPath(t *testing.T, name string) string {
t.Fatal(err)
}
}
+ sympath, err := filepath.EvalSymlinks(fp)
+ if err == nil {
+ fp = strings.Replace(sympath, "\\", "/", -1)
+ }
return fp
}
--
2.16.5