]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/dist: only run swig tests when a go directory is present in swiglib
authorMartin Möhrmann <moehrmann@google.com>
Fri, 19 Jan 2018 17:26:58 +0000 (18:26 +0100)
committerIan Lance Taylor <iant@golang.org>
Tue, 23 Jan 2018 04:18:23 +0000 (04:18 +0000)
When there is no go directory inside the swiglib directory then swig
was installed without Go support. Tests in misc/swig will fail when
swig is installed without Go support.

Add additional checks for the presence of a go directory in the directory
reported by 'swig -go -swiglib' to determine if misc/swig tests should
be run.

This avoids all.bash failing when swig but not swig-go is installed
using macports.

Tested on darwin with swig and with and without swig-go installed
using macports.

Fixes #23469

Change-Id: I173201221554982ea0d9f2bea70a3cb85b297cec
Reviewed-on: https://go-review.googlesource.com/88776
Reviewed-by: David Chase <drchase@google.com>
src/cmd/dist/test.go

index 6d76209e5d3c9caaa8b603dbb42bd65f2b925d5c..bc1f7339a20218c1630d37fd85d68986ff75574c 100644 (file)
@@ -1210,6 +1210,23 @@ func (t *tester) hasSwig() bool {
        if err != nil {
                return false
        }
+
+       // Check that swig was installed with Go support by checking
+       // that a go directory exists inside the swiglib directory.
+       // See https://golang.org/issue/23469.
+       output, err := exec.Command(swig, "-go", "-swiglib").Output()
+       if err != nil {
+               return false
+       }
+       swigDir := strings.TrimSpace(string(output))
+
+       _, err = os.Stat(filepath.Join(swigDir, "go"))
+       if err != nil {
+               return false
+       }
+
+       // Check that swig has a new enough version.
+       // See https://golang.org/issue/22858.
        out, err := exec.Command(swig, "-version").CombinedOutput()
        if err != nil {
                return false