File: 0008-Fix_tests_for_gccgo.patch

package info (click to toggle)
golang-golang-x-tools 1%3A0.0~git20161028.0.b814a3b%2Bds-3~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 5,644 kB
  • sloc: yacc: 155; sh: 95; makefile: 27; asm: 18; xml: 11; ansic: 10
file content (54 lines) | stat: -rw-r--r-- 2,123 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
--- a/go/internal/gccgoimporter/importer_test.go
+++ b/go/internal/gccgoimporter/importer_test.go
@@ -140,7 +140,7 @@
 		ofile := filepath.Join(tmpdir, test.pkgpath+".o")
 		afile := filepath.Join(artmpdir, "lib"+test.pkgpath+".a")
 
-		cmd := exec.Command("gccgo", "-fgo-pkgpath="+test.pkgpath, "-c", "-o", ofile, gofile)
+		cmd := exec.Command("gccgo-6", "-fgo-pkgpath="+test.pkgpath, "-c", "-o", ofile, gofile)
 		out, err := cmd.CombinedOutput()
 		if err != nil {
 			t.Logf("%s", out)
--- a/go/internal/gccgoimporter/gccgoinstallation.go
+++ b/go/internal/gccgoimporter/gccgoinstallation.go
@@ -68,8 +68,11 @@
 
 // Return the list of export search paths for this GccgoInstallation.
 func (inst *GccgoInstallation) SearchPaths() (paths []string) {
+	// Gccgo in debian installs objects in .../go/x, not .../go/x.y.z
+	majorVersion := strings.Split(inst.GccVersion, ".")[0]
+	for _, version := range []string{majorVersion, inst.GccVersion} {
 	for _, lpath := range inst.LibPaths {
-		spath := filepath.Join(lpath, "go", inst.GccVersion)
+		spath := filepath.Join(lpath, "go", version)
 		fi, err := os.Stat(spath)
 		if err != nil || !fi.IsDir() {
 			continue
@@ -83,6 +86,7 @@
 		}
 		paths = append(paths, spath)
 	}
+	}
 
 	paths = append(paths, inst.LibPaths...)
 
--- a/go/internal/gccgoimporter/gccgoinstallation_test.go
+++ b/go/internal/gccgoimporter/gccgoinstallation_test.go
@@ -158,7 +158,7 @@
 	}
 
 	var inst GccgoInstallation
-	err := inst.InitFromDriver("gccgo")
+	err := inst.InitFromDriver("gccgo-6")
 	if err != nil {
 		t.Fatal(err)
 	}
@@ -183,7 +183,7 @@
 
 	// Test for certain specific entities in the imported data.
 	for _, test := range [...]importerTest{
-		{pkgpath: "io", name: "Reader", want: "type Reader interface{Read(p []uint8) (n int, err error)}"},
+		{pkgpath: "io", name: "Reader", want: "type Reader interface{Read(p []byte) (n int, err error)}"},
 		{pkgpath: "io", name: "ReadWriter", want: "type ReadWriter interface{Reader; Writer}"},
 		{pkgpath: "math", name: "Pi", want: "const Pi untyped float"},
 		{pkgpath: "math", name: "Sin", want: "func Sin(x float64) float64"},