[Pkg-golang-commits] [golang] 03/03: fix test failures during build

Michael Hudson-Doyle mwhudson-guest at moszumanska.debian.org
Tue Jan 30 03:33:46 UTC 2018


This is an automated email from the git hooks/post-receive script.

mwhudson-guest pushed a commit to branch golang-1.10
in repository golang.

commit 2867a73bb1d7ecc6d0b0c23bfd8745054ef019b2
Author: Michael Hudson-Doyle <michael.hudson at canonical.com>
Date:   Tue Jan 30 16:32:38 2018 +1300

    fix test failures during build
---
 debian/changelog                           |  5 ++++-
 debian/patches/0001-fix-pprof-tests.patch  | 17 +++++++++++++++++
 debian/patches/0003-fix-signal-tests.patch | 24 ++++++++++++++++++++++++
 debian/patches/series                      |  2 ++
 4 files changed, 47 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 33e9bcb..513aea4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,7 +1,10 @@
 golang-1.10 (1.10~rc1-1) UNRELEASED; urgency=medium
 
   * New upstream version 1.10~rc1
-  * Disable 0002-reproducible-BUILD_PATH_PREFIX_MAP.patch for now. Remove all other patches.
+  * Disable 0002-reproducible-BUILD_PATH_PREFIX_MAP.patch for now. Remove all
+    other patches.
+  * d/patches/{0001-fix-pprof-tests.patch, 0003-fix-signal-tests.patch}: add
+    to fix test failures running in a chroot.
 
  -- Michael Hudson-Doyle <mwhudson at debian.org>  Fri, 08 Dec 2017 14:35:16 +1300
 
diff --git a/debian/patches/0001-fix-pprof-tests.patch b/debian/patches/0001-fix-pprof-tests.patch
new file mode 100644
index 0000000..b784a0b
--- /dev/null
+++ b/debian/patches/0001-fix-pprof-tests.patch
@@ -0,0 +1,17 @@
+--- a/src/cmd/vendor/github.com/google/pprof/internal/driver/fetch_test.go
++++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/fetch_test.go
+@@ -362,6 +362,14 @@
+ 	if runtime.GOOS == "nacl" {
+ 		t.Skip("test assumes tcp available")
+ 	}
++	saveHome := os.Getenv(homeEnv())
++	tempdir, err := ioutil.TempDir("", "home")
++	if err != nil {
++		t.Fatal("creating temp dir: ", err)
++	}
++	defer os.RemoveAll(tempdir)
++	os.Setenv(homeEnv(), tempdir)
++	defer os.Setenv(homeEnv(), saveHome)
+ 
+ 	baseVars := pprofVariables
+ 	pprofVariables = baseVars.makeCopy()
diff --git a/debian/patches/0003-fix-signal-tests.patch b/debian/patches/0003-fix-signal-tests.patch
new file mode 100644
index 0000000..7f359f4
--- /dev/null
+++ b/debian/patches/0003-fix-signal-tests.patch
@@ -0,0 +1,24 @@
+--- a/src/os/signal/signal_cgo_test.go
++++ b/src/os/signal/signal_cgo_test.go
+@@ -27,7 +27,21 @@
+ 	"time"
+ )
+ 
++// Check if we are in a chroot by checking if the inode of / is
++// different from 2 (there is no better test available to non-root on
++// linux).
++func isChrooted(t *testing.T) bool {
++	root, err := os.Stat("/")
++	if err != nil {
++		t.Fatalf("cannot stat /: %v", err)
++	}
++	return root.Sys().(*syscall.Stat_t).Ino != 2
++}
++
+ func TestTerminalSignal(t *testing.T) {
++	if isChrooted(t) {
++		t.Skip("test cannot run in a chroot")
++	}
+ 	const enteringRead = "test program entering read"
+ 	if os.Getenv("GO_TEST_TERMINAL_SIGNALS") != "" {
+ 		var b [1]byte
diff --git a/debian/patches/series b/debian/patches/series
index 56765d3..14b7cf6 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,3 @@
 #0002-reproducible-BUILD_PATH_PREFIX_MAP.patch
+0001-fix-pprof-tests.patch
+0003-fix-signal-tests.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-golang/golang.git



More information about the pkg-golang-commits mailing list