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 55 56
|
Description: Fix go/internal/gccgoimporter tests for gccgo-7
Initially created by Martín for gccgo-6 in Stretch.
Updated by Anthony for gccgo-7 (7.1.0) and latest x/tools snapshot.
.
TODO: Perhaps TestObjImporter for "time", "unicode" and "imports" in
go/internal/gccgoimporter/importer_test.go would work with a
future gccgo release? See https://go-review.googlesource.com/c/34371/
"go/internal/gccgoimporter: accept missed portions of v2 format".
Author: Martín Ferrari <tincho@debian.org>
Author: Anthony Fok <foka@debian.org>
Origin: vendor
Bug: https://github.com/golang/go/issues/20932
Forwarded: no
Last-Update: 2017-07-07
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/go/internal/gccgoimporter/importer_test.go
+++ b/go/internal/gccgoimporter/importer_test.go
@@ -81,11 +81,14 @@
{pkgpath: "complexnums", name: "PN", want: "const PN untyped complex", wantval: "(1 + -1i)"},
{pkgpath: "complexnums", name: "PP", want: "const PP untyped complex", wantval: "(1 + 1i)"},
{pkgpath: "conversions", name: "Bits", want: "const Bits Units", wantval: `"bits"`},
+ // TODO (foka): Perhaps these will work with a future versions of gccgo-7 beyond 7.1.0?
+ /*
{pkgpath: "time", name: "Duration", want: "type Duration int64"},
{pkgpath: "time", name: "Nanosecond", want: "const Nanosecond Duration", wantval: "1"},
{pkgpath: "unicode", name: "IsUpper", want: "func IsUpper(r rune) bool"},
{pkgpath: "unicode", name: "MaxRune", want: "const MaxRune untyped rune", wantval: "1114111"},
{pkgpath: "imports", wantinits: []string{"imports..import", "fmt..import"}},
+ */
{pkgpath: "importsar", name: "Hello", want: "var Hello string"},
{pkgpath: "aliases", name: "A14", want: "type A14 = func(int, T0) chan T2"},
{pkgpath: "aliases", name: "C0", want: "type C0 struct{f1 C1; f2 C1}"},
--- a/go/internal/gccgoimporter/gccgoinstallation.go
+++ b/go/internal/gccgoimporter/gccgoinstallation.go
@@ -72,8 +72,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
@@ -87,6 +90,7 @@
}
paths = append(paths, spath)
}
+ }
paths = append(paths, inst.LibPaths...)
|