Fix all Go tests to build with "go build"

Tested against Go 1.6 through Go 1.13beta1, and gccgo.

Fixes #1607
This commit is contained in:
Ian Lance Taylor 2019-08-08 14:30:50 -07:00
commit 7aafe3d8b2
167 changed files with 246 additions and 392 deletions

View file

@ -1436,34 +1436,20 @@ scilab_clean:
GO = @GO@
GOGCC = @GOGCC@
GCCGO = @GCCGO@
GO1 = @GO1@
GO12 = @GO12@
GO13 = @GO13@
GO15 = @GO15@
GOC = @GOC@
GOOPT = @GOOPT@
GCCGOOPT = @GCCGOOPT@
GOVERSIONOPTION = @GOVERSIONOPTION@
GOSWIGARG = `if $(GOGCC) ; then echo -gccgo; fi`
GOCOMPILEARG = `if $(GO15); then echo tool compile; elif $(GO1) ; then echo tool $(GOC:c=g) ; fi` `if $(GO13) || $(GO15); then echo -pack ; fi`
GOSRCS = $(INTERFACE:.i=.go)
GOCSRCS = $(INTERFACE:.i=_gc.c)
GOLD = `if $(GO15); then echo link; else echo $(GOC:c=l); fi`
GOTOOL = `if $(GO1) ; then echo go tool; fi`
GOPACK = `if $(GO1) ; then echo go tool pack; else echo gopack; fi`
GOPACKAGE = $(notdir $(INTERFACE:.i=.a))
GOPATHPARENTDIR = gopath/$(GOMOD)/src
GOPATHDIR = $(GOPATHPARENTDIR)/$(INTERFACE:.i=)
GOOBJEXT = `if $(GO15); then echo o; else echo $(GOC:c=); fi`
GOGCOBJS = $(GOSRCS:.go=.$(GOOBJEXT))
GOGCCOBJS = $(GOSRCS:.go=.@OBJEXT@)
# ----------------------------------------------------------------
# Build a Go module (C)
# ----------------------------------------------------------------
@ -1478,49 +1464,13 @@ $(GOPATHPARENTDIR)/go.mod:
echo "go 1.12" >> $(GOPATHDIR)/go.mod
mv -f $(GOPATHDIR)/go.mod $(GOPATHPARENTDIR)/go.mod
go_nocgo: $(SRCDIR_SRCS)
$(SWIG) -go -no-cgo $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
if $(GO12) || $(GO13) || $(GO15) || $(GOGCC); then \
$(CC) -g -c $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES); \
else \
$(CC) -g -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES); \
$(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO); \
fi
if $(GOGCC) ; then \
$(COMPILETOOL) $(GCCGO) -g -c -I . $(GOSRCS); \
else \
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(GOSRCS); \
$(COMPILETOOL) $(GOTOOL) $(GOC) -I $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`} $(GOCSRCS); \
rm -f $(GOPACKAGE); \
if $(GO13) || $(GO15); then \
cp $(GOGCOBJS) $(GOPACKAGE); \
$(COMPILETOOL) $(GOPACK) r $(GOPACKAGE) $(GOCSRCS:.c=.$(GOOBJEXT)) $(OBJS) $(IOBJS); \
elif $(GO12); then \
$(COMPILETOOL) $(GOPACK) grc $(GOPACKAGE) $(GOGCOBJS) $(GOCSRCS:.c=.$(GOOBJEXT)) $(OBJS) $(IOBJS); \
else \
$(COMPILETOOL) $(GOPACK) grc $(GOPACKAGE) $(GOGCOBJS) $(GOCSRCS:.c=.$(GOOBJEXT)); \
fi; \
fi
if test -f $(SRCDIR)$(RUNME).go; then \
if $(GOGCC) ; then \
$(COMPILETOOL) $(GCCGO) -g -c $(SRCDIR)$(RUNME).go; \
$(COMPILETOOL) $(GCCGO) -o $(RUNME) $(RUNME).@OBJEXT@ $(GOGCCOBJS) $(OBJS) $(IOBJS); \
elif $(GO12) || $(GO13) || $(GO15); then \
$(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld "$(CC)" -extldflags "$(CFLAGS) $(LDFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \
else \
$(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $(RUNME) $(RUNME).$(GOOBJEXT); \
fi; \
fi
go: $(SRCDIR_SRCS) $(GOPATHPARENTDIR)/go.mod
$(SWIG) -go -import-prefix swigtests $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
@mkdir gopath 2>/dev/null || true
@mkdir gopath/$(GOMOD) 2>/dev/null || true
@mkdir gopath/$(GOMOD)/src 2>/dev/null || true
@mkdir $(GOPATHDIR) 2>/dev/null || true
rm -f $(GOPATHDIR)/*
rm -rf $(GOPATHDIR)/*
cp $(ISRCS) $(GOPATHDIR)/
if test -f $(IWRAP:.i=.h); then \
cp $(IWRAP:.i=.h) $(GOPATHDIR)/; \
@ -1529,6 +1479,13 @@ go: $(SRCDIR_SRCS) $(GOPATHPARENTDIR)/go.mod
cp $(SRCDIR_SRCS) $(GOPATHDIR)/; \
fi
cp $(GOSRCS) $(GOPATHDIR)/
@if test -f $(SRCDIR)$(RUNME).go; then \
mkdir gopath/$(GOMOD)/src/runme 2>/dev/null || true; \
rm -f gopath/$(GOMOD)/src/runme/*; \
fi
if test -f $(SRCDIR)$(RUNME).go; then \
cp $(SRCDIR)/$(RUNME).go gopath/$(GOMOD)/src/runme/; \
fi
GOPATH=`pwd`/gopath/$(GOMOD); \
export GOPATH; \
CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) -I `cd $(SRCDIR) && pwd` -I `pwd`"; \
@ -1537,82 +1494,29 @@ go: $(SRCDIR_SRCS) $(GOPATHPARENTDIR)/go.mod
export CGO_CFLAGS; \
CGO_LDFLAGS="$(LDFLAGS) -lm"; \
export CGO_LDFLAGS; \
(cd $(GOPATHDIR)/ && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o $(GOPACKAGE))
(cd $(GOPATHDIR)/ && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o $(GOPACKAGE)); \
if $(GOGCC); then \
cp $(GOPATHDIR)/$(GOPACKAGE) $(GOPATHDIR)/$(GOPACKAGE:.a=.gox); \
fi
fi; \
if test -f $(SRCDIR)$(RUNME).go; then \
if $(GOGCC) ; then \
$(COMPILETOOL) $(GCCGO) -c -g -I $(GOPATHDIR) $(SRCDIR)$(RUNME).go; \
$(COMPILETOOL) $(GCCGO) -o $(RUNME) $(RUNME).@OBJEXT@ $(GOPATHDIR)/$(GOPACKAGE); \
elif $(GO12) || $(GO13) || $(GO15); then \
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I $(GOPATHDIR) -o $(RUNME).$(GOOBJEXT) $(SRCDIR)$(RUNME).go; \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -L $(GOPATHDIR) -linkmode external -extld "$(CC)" -extldflags "$(CFLAGS) $(LDFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \
else \
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $(RUNME) $(RUNME).$(GOOBJEXT); \
fi; \
mkdir gopath/$(GOMOD)/src/swigtests 2>/dev/null || true; \
mkdir gopath/$(GOMOD)/src/swigtests/$(INTERFACE:.i=) 2>/dev/null || true; \
cp $(GOPATHDIR)/* gopath/$(GOMOD)/src/swigtests/$(INTERFACE:.i=)/; \
(cd gopath/$(GOMOD)/src/runme && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o runme $(RUNME).go); \
cp gopath/$(GOMOD)/src/runme/runme $(RUNME); \
fi
# ----------------------------------------------------------------
# Build a Go module (C++)
# ----------------------------------------------------------------
go_cpp_nocgo: $(SRCDIR_SRCS)
$(SWIG) -go -c++ -no-cgo $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
if $(GO12) || $(GO13) || $(GO15) || $(GOGCC); then \
if test -n "$(SRCDIR_CXXSRCS)$(SRCDIR_SRCS)"; then \
$(CXX) -g -c $(CPPFLAGS) $(CXXFLAGS) $(SRCDIR_CXXSRCS) $(SRCDIR_SRCS) $(INCLUDES); \
fi; \
$(foreach f,$(ICXXSRCS), \
$(CXX) -g -c $(CPPFLAGS) $(CXXFLAGS) -o $(addsuffix .@OBJEXT@,$(basename $f)) $f $(INCLUDES); \
) \
else \
$(CXX) -g -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES); \
$(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO); \
fi
if ! $(GOGCC) ; then \
$(foreach f,$(GOSRCS), \
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . -o $(addsuffix .$(GOOBJEXT),$(basename $f)) $f \
); \
$(foreach f,$(GOCSRCS), \
$(COMPILETOOL) $(GOTOOL) $(GOC) -I $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`} \
-o $(addsuffix .$(GOOBJEXT),$(basename $f)) $f; \
) \
rm -f $(GOPACKAGE); \
if $(GO13) || $(GO15); then \
cp $(GOGCOBJS) $(GOPACKAGE); \
$(COMPILETOOL) $(GOPACK) r $(GOPACKAGE) $(GOCSRCS:.c=.$(GOOBJEXT)) $(OBJS) $(IOBJS); \
elif $(GO12); then \
$(COMPILETOOL) $(GOPACK) grc $(GOPACKAGE) $(GOGCOBJS) $(GOCSRCS:.c=.$(GOOBJEXT)) $(OBJS) $(IOBJS); \
else \
$(COMPILETOOL) $(GOPACK) grc $(GOPACKAGE) $(GOGCOBJS) $(GOCSRCS:.c=.$(GOOBJEXT)); \
fi; \
else \
$(foreach f,$(GOSRCS), \
$(COMPILETOOL) $(GCCGO) -g -c -I . -o $(addsuffix .@OBJEXT@,$(basename $f)) $f \
); \
fi
if test -f $(SRCDIR)$(RUNME).go; then \
if $(GOGCC) ; then \
$(COMPILETOOL) $(GCCGO) -g -c $(SRCDIR)$(RUNME).go; \
$(COMPILETOOL) $(GCCGO) -o $(RUNME) $(RUNME).@OBJEXT@ $(GOGCCOBJS) $(OBJS) $(IOBJS) -lstdc++; \
elif $(GO12) || $(GO13) || $(GO15); then \
$(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld "$(CXX)" -extldflags "$(CXXFLAGS) $(LDFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \
else \
$(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $(RUNME) $(RUNME).$(GOOBJEXT); \
fi; \
fi
go_cpp: $(SRCDIR_SRCS) $(GOPATHPARENTDIR)/go.mod
$(SWIG) -go -c++ -import-prefix swigtests $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
@mkdir gopath 2>/dev/null || true
@mkdir gopath/$(GOMOD) 2>/dev/null || true
@mkdir gopath/$(GOMOD)/src 2>/dev/null || true
@mkdir $(GOPATHDIR) 2>/dev/null || true
rm -f $(GOPATHDIR)/*
rm -rf $(GOPATHDIR)/*
cp $(ICXXSRCS) $(GOPATHDIR)/
if test -f $(IWRAP:.i=.h); then \
cp $(IWRAP:.i=.h) $(GOPATHDIR)/; \
@ -1624,6 +1528,13 @@ go_cpp: $(SRCDIR_SRCS) $(GOPATHPARENTDIR)/go.mod
cp $(SRCDIR_SRCS) $(GOPATHDIR)/; \
fi
cp $(GOSRCS) $(GOPATHDIR)/
@if test -f $(SRCDIR)$(RUNME).go; then \
mkdir gopath/$(GOMOD)/src/runme 2>/dev/null || true; \
rm -f gopath/$(GOMOD)/src/runme/*; \
fi
if test -f $(SRCDIR)$(RUNME).go; then \
cp $(SRCDIR)/$(RUNME).go gopath/$(GOMOD)/src/runme/; \
fi
GOPATH=`pwd`/gopath/$(GOMOD); \
export GOPATH; \
CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) -I `cd $(SRCDIR) && pwd` -I `pwd`"; \
@ -1634,21 +1545,16 @@ go_cpp: $(SRCDIR_SRCS) $(GOPATHPARENTDIR)/go.mod
export CGO_CXXFLAGS; \
CGO_LDFLAGS="$(LDFLAGS) -lm"; \
export CGO_LDFLAGS; \
(cd $(GOPATHDIR) && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o $(GOPACKAGE))
(cd $(GOPATHDIR) && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o $(GOPACKAGE)); \
if $(GOGCC); then \
cp $(GOPATHDIR)/$(GOPACKAGE) $(GOPATHDIR)/$(GOPACKAGE:.a=.gox); \
fi
fi; \
if test -f $(SRCDIR)$(RUNME).go; then \
if $(GOGCC) ; then \
$(COMPILETOOL) $(GCCGO) -g -c -I $(GOPATHDIR) $(SRCDIR)$(RUNME).go; \
$(COMPILETOOL) $(GCCGO) -o $(RUNME) $(RUNME).@OBJEXT@ $(GOPATHDIR)/$(GOPACKAGE) -lstdc++; \
elif $(GO12) || $(GO13) || $(GO15); then \
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I $(GOPATHDIR) -o $(RUNME).$(GOOBJEXT) $(SRCDIR)$(RUNME).go; \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -L $(GOPATHDIR) -linkmode external -extld "$(CXX)" -extldflags "$(CXXFLAGS) $(LDFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \
else \
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $(RUNME) $(RUNME).$(GOOBJEXT); \
fi; \
mkdir gopath/$(GOMOD)/src/swigtests 2>/dev/null || true; \
mkdir gopath/$(GOMOD)/src/swigtests/$(INTERFACE:.i=) 2>/dev/null || true; \
cp $(GOPATHDIR)/* gopath/$(GOMOD)/src/swigtests/$(INTERFACE:.i=)/; \
(cd gopath/$(GOMOD)/src/runme && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o runme $(RUNME).go); \
cp gopath/$(GOMOD)/src/runme/runme $(RUNME); \
fi
# -----------------------------------------------------------------

View file

@ -3,7 +3,7 @@ package main
import (
"fmt"
. "example"
. "swigtests/example"
)
func main() {

View file

@ -5,7 +5,7 @@ package main
import (
"fmt"
. "example"
. "swigtests/example"
)
func main() {

View file

@ -3,7 +3,7 @@ package main
import (
"fmt"
"example"
"swigtests/example"
)
func main() {

View file

@ -4,7 +4,7 @@ import (
"fmt"
"os"
"example"
"swigtests/example"
)
func Compare(name string, got string, exp string) error {

View file

@ -3,7 +3,7 @@ package main
import (
"fmt"
. "example"
. "swigtests/example"
)
func main() {

View file

@ -5,7 +5,7 @@ package main
import (
"fmt"
. "example"
. "swigtests/example"
)
func main() {

View file

@ -3,7 +3,7 @@ package main
import (
"fmt"
. "example"
. "swigtests/example"
)
func main() {

View file

@ -3,7 +3,7 @@ package main
import (
"fmt"
. "example"
. "swigtests/example"
)
func main() {

View file

@ -3,7 +3,7 @@ package main
import (
"fmt"
. "example"
. "swigtests/example"
)
func main() {

View file

@ -5,7 +5,7 @@ package main
import (
"fmt"
. "example"
. "swigtests/example"
)
func main() {

View file

@ -3,7 +3,7 @@ package main
import (
"fmt"
"example"
"swigtests/example"
)
func main() {

View file

@ -5,7 +5,7 @@ package main
import (
"fmt"
. "example"
. "swigtests/example"
)
func main() {

View file

@ -5,7 +5,7 @@ package main
import (
"fmt"
"example"
"swigtests/example"
)
func main() {

View file

@ -6,24 +6,10 @@ LANGUAGE = go
GO = @GO@
GOGCC = @GOGCC@
GCCGO = @GCCGO@
GO1 = @GO1@
GO12 = @GO12@
GO13 = @GO13@
GO15 = @GO15@
GOC = @GOC@
GOVERSIONOPTION = @GOVERSIONOPTION@
host = @host@
SCRIPTSUFFIX = _runme.go
GOCOMPILEARG = `if $(GO15); then echo tool compile; elif $(GO1); then echo tool $(GOC:c=g); fi`
GOLD = `if $(GO15); then echo link; else echo $(GOC:c=l); fi`
GOTOOL = `if $(GO1) ; then echo go tool; fi`
GOPACK = `if $(GO1) ; then echo go tool pack; else echo gopack; fi`
GOOBJEXT = `if $(GO15); then echo o; else echo $(GOC:c=); fi`
OSXOLDGOLINKFLAGS = `if [ -n "\`$(GO) $(GOVERSIONOPTION) | grep -E 'go1($|.0|.1|.2|.3)'\`" ] && [ -n "\`echo $(host) | grep darwin\`" ]; then echo "-Wl,-U,__cgo_topofstack"; fi`
SO = @SO@
srcdir = @srcdir@
@ -49,27 +35,11 @@ INCLUDES = -I$(abs_top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)
$(setup)
+$(swig_and_compile_cpp)
$(run_testcase_cpp)
if ! $(GO15); then \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
INCLUDES='$(INCLUDES)' SWIGOPT='$(SWIGOPT)' NOLINK=true \
TARGET='$(TARGETPREFIX)$*$(TARGETSUFFIX)' INTERFACEDIR='$(INTERFACEDIR)' INTERFACE='$*.i' \
$(LANGUAGE)$(VARIANT)_cpp_nocgo && \
$(run_testcase_cpp); \
fi
%.ctest:
$(setup)
+$(swig_and_compile_c)
$(run_testcase)
if ! $(GO15); then \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' CSRCS='$(CSRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
INCLUDES='$(INCLUDES)' SWIGOPT='$(SWIGOPT)' NOLINK=true \
TARGET='$(TARGETPREFIX)$*$(TARGETSUFFIX)' INTERFACEDIR='$(INTERFACEDIR)' INTERFACE='$*.i' \
$(LANGUAGE)$(VARIANT)_nocgo && \
$(run_testcase); \
fi
%.multicpptest:
$(setup)
@ -136,54 +106,66 @@ go_subdir_import.multicpptest:
# Runs the testcase.
run_testcase = \
if test -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \
if $(GOGCC) ; then \
$(COMPILETOOL) $(GCCGO) -c -g -I gopath/src/$* $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
$(COMPILETOOL) $(GCCGO) -o $*_runme $(SCRIPTPREFIX)$*_runme.@OBJEXT@ gopath/src/$*/$*.a; \
elif $(GO12) || $(GO13) || $(GO15); then \
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I gopath/src/$* $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -L gopath/src/$* -linkmode external -extld $(CC) -extldflags "$(CFLAGS) $(OSXOLDGOLINKFLAGS)" -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
else \
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -L . -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
fi && \
GOPATH=`pwd`/gopath/; \
export GOPATH; \
CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) -I `cd $(SRCDIR) && pwd` -I `pwd`"; \
export CGO_CPPFLAGS; \
CGO_CFLAGS="$(CFLAGS)"; \
export CGO_CFLAGS; \
CGO_CXXFLAGS="$(CXXFLAGS)"; \
export CGO_CXXFLAGS; \
CGO_LDFLAGS="$(LDFLAGS) -lm"; \
export CGO_LDFLAGS; \
mkdir gopath/src/swigtests 2>/dev/null || true; \
mkdir gopath/src/swigtests/$* 2>/dev/null || true; \
cp gopath/src/$*/* gopath/src/swigtests/$*/; \
mkdir gopath/src/$*/runme 2>/dev/null || true; \
cp $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) gopath/src/$*/runme/runme.go; \
(cd gopath/src/$*/runme && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o runme runme.go); \
cp gopath/src/$*/runme/runme $*_runme; \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) ./$*_runme; \
fi
run_testcase_cpp = \
if test -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \
if $(GOGCC) ; then \
$(COMPILETOOL) $(GCCGO) -c -g -I gopath/src/$* $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
$(COMPILETOOL) $(GCCGO) -o $*_runme $(SCRIPTPREFIX)$*_runme.@OBJEXT@ gopath/src/$*/$*.a -lstdc++; \
elif $(GO12) || $(GO13) || $(GO15); then \
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I gopath/src/$* $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -L gopath/src/$* -linkmode external -extld $(CXX) -extldflags "$(CXXFLAGS) $(OSXOLDGOLINKFLAGS)" -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
else \
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -L . -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
fi && \
GOPATH=`pwd`/gopath/; \
export GOPATH; \
CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) -I `cd $(SRCDIR) && pwd` -I `pwd`"; \
export CGO_CPPFLAGS; \
CGO_CFLAGS="$(CFLAGS)"; \
export CGO_CFLAGS; \
CGO_CXXFLAGS="$(CXXFLAGS)"; \
export CGO_CXXFLAGS; \
CGO_LDFLAGS="$(LDFLAGS) -lm"; \
export CGO_LDFLAGS; \
mkdir gopath/src/swigtests 2>/dev/null || true; \
mkdir gopath/src/swigtests/$* 2>/dev/null || true; \
cp gopath/src/$*/* gopath/src/swigtests/$*/; \
mkdir gopath/src/$*/runme 2>/dev/null || true; \
cp $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) gopath/src/$*/runme/runme.go; \
(cd gopath/src/$*/runme && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o runme runme.go); \
cp gopath/src/$*/runme/runme $*_runme; \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) ./$*_runme; \
fi
run_multi_testcase = \
if test -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \
if $(GO15) || $(GOGCC); then \
files=`cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list`; \
mkdir gopath/$*/src/$* 2>/dev/null || true; \
cp $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) gopath/$*/src/$*; \
GOPATH="`pwd`/gopath/$*"; \
export GOPATH; \
CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) `for f in $$files; do echo -I ../$$f; done`"; \
export CGO_CPPFLAGS; \
CGO_CFLAGS="$(CFLAGS)"; \
export CGO_CFLAGS; \
CGO_CXXFLAGS="$(CXXFLAGS)"; \
export CGO_CXXFLAGS; \
CGO_LDFLAGS="$(LDFLAGS) -lm"; \
export CGO_LDFLAGS; \
(cd gopath/$*/src/$* && \
$(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o ../../../../$*_runme) && \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) ./$*_runme; \
fi; \
files=`cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list`; \
mkdir gopath/$*/src/$* 2>/dev/null || true; \
cp $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) gopath/$*/src/$*; \
GOPATH="`pwd`/gopath/$*"; \
export GOPATH; \
CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) `for f in $$files; do echo -I ../$$f; done`"; \
export CGO_CPPFLAGS; \
CGO_CFLAGS="$(CFLAGS)"; \
export CGO_CFLAGS; \
CGO_CXXFLAGS="$(CXXFLAGS)"; \
export CGO_CXXFLAGS; \
CGO_LDFLAGS="$(LDFLAGS) -lm"; \
export CGO_LDFLAGS; \
(cd gopath/$*/src/$* && \
$(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o ../../../../$*_runme) && \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) ./$*_runme; \
fi
%.clean:

View file

@ -1,6 +1,6 @@
package main
import "abstract_access"
import "swigtests/abstract_access"
func main() {
d := abstract_access.NewD()

View file

@ -1,6 +1,6 @@
package main
import "abstract_typedef2"
import "swigtests/abstract_typedef2"
func main() {
abstract_typedef2.NewA_UF()

View file

@ -1,6 +1,6 @@
package main
import "abstract_typedef"
import "swigtests/abstract_typedef"
func main() {
e := abstract_typedef.NewEngine()

View file

@ -1,6 +1,6 @@
package main
import "abstract_virtual"
import "swigtests/abstract_virtual"
func main() {
abstract_virtual.NewD()

View file

@ -1,6 +1,6 @@
package main
import wrap "argout"
import wrap "swigtests/argout"
func main() {
ip := wrap.New_intp()

View file

@ -1,6 +1,6 @@
package main
import . "array_member"
import . "swigtests/array_member"
func main() {
f := NewFoo()

View file

@ -1,6 +1,6 @@
package main
import . "arrays_global"
import . "swigtests/arrays_global"
func main() {
SetArray_i(GetArray_const_i())

View file

@ -1,6 +1,6 @@
package main
import . "char_binary"
import . "swigtests/char_binary"
func main() {
t := NewTest()

View file

@ -1,6 +1,6 @@
package main
import "class_ignore"
import "swigtests/class_ignore"
func main() {
a := class_ignore.NewBar()

View file

@ -1,6 +1,6 @@
package main
import "class_scope_weird"
import "swigtests/class_scope_weird"
func main() {
f := class_scope_weird.NewFoo()

View file

@ -1,6 +1,6 @@
package main
import . "compactdefaultargs"
import . "swigtests/compactdefaultargs"
func main() {
defaults1 := NewDefaults1(1000)

View file

@ -4,7 +4,7 @@ import (
"fmt"
"os"
"constover"
"swigtests/constover"
)
func main() {

View file

@ -1,6 +1,6 @@
package main
import . "constructor_copy"
import . "swigtests/constructor_copy"
func main() {
f1 := NewFoo1(3)

View file

@ -1,6 +1,6 @@
package main
import "contract"
import "swigtests/contract"
func main() {
contract.Test_preassert(1, 2)

View file

@ -1,7 +1,7 @@
package main
import "fmt"
import . "cpp11_strongly_typed_enumerations"
import . "swigtests/cpp11_strongly_typed_enumerations"
func enumCheck(actual int, expected int) int {
if actual != expected {

View file

@ -1,6 +1,6 @@
package main
import "cpp_enum"
import "swigtests/cpp_enum"
func main() {
f := cpp_enum.NewFoo()

View file

@ -1,7 +1,7 @@
// Note: This example assumes that namespaces are flattened
package main
import "cpp_namespace"
import "swigtests/cpp_namespace"
func main() {
n := cpp_namespace.Fact(4)

View file

@ -1,6 +1,6 @@
package main
import . "cpp_static"
import . "swigtests/cpp_static"
func main() {
StaticFunctionTestStatic_func()

View file

@ -1,6 +1,6 @@
package main
import "default_args"
import "swigtests/default_args"
func main() {
if default_args.StaticsStaticmethod() != 60 {

View file

@ -1,6 +1,6 @@
package main
import dc "default_constructor"
import dc "swigtests/default_constructor"
func main() {
a := dc.NewA()

View file

@ -1,6 +1,6 @@
package main
import . "director_alternating"
import . "swigtests/director_alternating"
func main() {
id := GetBar().Id()

View file

@ -1,6 +1,6 @@
package main
import "director_basic"
import "swigtests/director_basic"
type GoFoo struct{}

View file

@ -1,7 +1,7 @@
package main
import "fmt"
import . "director_classic"
import . "swigtests/director_classic"
type TargetLangPerson struct{} // From Person
func (p *TargetLangPerson) Id() string {

View file

@ -1,6 +1,6 @@
package main
import . "director_default"
import . "swigtests/director_default"
func main() {
NewFoo()

View file

@ -1,6 +1,6 @@
package main
import "director_detect"
import "swigtests/director_detect"
type MyBar struct {
val int

View file

@ -1,6 +1,6 @@
package main
import "director_enum"
import "swigtests/director_enum"
type MyFoo struct{} // From director_enum.Foo
func (p *MyFoo) Say_hi(val director_enum.EnumDirectorHello) director_enum.EnumDirectorHello {

View file

@ -1,6 +1,6 @@
package main
import . "director_exception"
import . "swigtests/director_exception"
type Exception struct {
msg string

View file

@ -5,7 +5,7 @@
package main
import . "director_extend"
import . "swigtests/director_extend"
func main() {
m := NewSpObject()

View file

@ -1,6 +1,6 @@
package main
import . "director_finalizer"
import . "swigtests/director_finalizer"
type MyFoo struct{} // From Foo
func DeleteMyFoo(p Foo) {

View file

@ -1,6 +1,6 @@
package main
import . "director_frob"
import . "swigtests/director_frob"
func main() {
foo := NewBravo()

View file

@ -1,6 +1,6 @@
package main
import . "director_nested"
import . "swigtests/director_nested"
type A struct{} // From FooBar_int
func (p *A) Do_step() string {

View file

@ -1,7 +1,7 @@
package main
import "fmt"
import "director_profile"
import "swigtests/director_profile"
type MyB struct{} // From director_profile.B
func (p *MyB) Vfi(a int) int {

View file

@ -1,6 +1,6 @@
package main
import . "director_protected"
import . "swigtests/director_protected"
type FooBar struct{} // From Bar
func (p *FooBar) Ping() string {

View file

@ -1,6 +1,6 @@
package main
import . "director_string"
import . "swigtests/director_string"
type B struct { // From A
abi A

View file

@ -1,6 +1,6 @@
package main
import "director_unroll"
import "swigtests/director_unroll"
type MyFoo struct{} // From director_unroll.Foo
func (p *MyFoo) Ping() string {

View file

@ -1,6 +1,6 @@
package main
import . "disown"
import . "swigtests/disown"
func main() {
a := NewA()

View file

@ -1,6 +1,6 @@
package main
import "dynamic_cast"
import "swigtests/dynamic_cast"
func main() {
f := dynamic_cast.NewFoo()

View file

@ -1,6 +1,6 @@
package main
import _ "empty_c"
import _ "swigtests/empty_c"
func main() {
}

View file

@ -1,6 +1,6 @@
package main
import _ "empty"
import _ "swigtests/empty"
func main() {
}

View file

@ -1,6 +1,6 @@
package main
import "enum_template"
import "swigtests/enum_template"
func main() {
if enum_template.MakeETest() != 1 {

View file

@ -1,6 +1,6 @@
package main
import "enums"
import "swigtests/enums"
func main() {
enums.Bar2(1)

View file

@ -1,7 +1,7 @@
package main
import "strings"
import . "exception_order"
import . "swigtests/exception_order"
func main() {
a := NewA()

View file

@ -1,6 +1,6 @@
package main
import "extend_placement"
import "swigtests/extend_placement"
func main() {
foo := extend_placement.NewFoo()

View file

@ -1,6 +1,6 @@
package main
import . "extend_template_ns"
import . "swigtests/extend_template_ns"
func main() {
f := NewFoo_One()

View file

@ -1,6 +1,6 @@
package main
import "extend_template"
import "swigtests/extend_template"
func main() {
f := extend_template.NewFoo_0()

View file

@ -1,6 +1,6 @@
package main
import . "extend_variable"
import . "swigtests/extend_variable"
func main() {
if FooBar != 42 {

View file

@ -1,6 +1,6 @@
package main
import "extern_c"
import "swigtests/extern_c"
func main() {
extern_c.RealFunction(2)

View file

@ -1,6 +1,6 @@
package main
import "friends"
import "swigtests/friends"
func main() {
a := friends.NewA(2)

View file

@ -1,6 +1,6 @@
package main
import . "fvirtual"
import . "swigtests/fvirtual"
func main() {
sw := NewNodeSwitch()

View file

@ -1,6 +1,6 @@
package main
import . "global_ns_arg"
import . "swigtests/global_ns_arg"
func main() {
Foo(1)

View file

@ -1,7 +1,7 @@
package main
import (
wrap "go_director_inout"
wrap "swigtests/go_director_inout"
)
type GoMyClass struct {}

View file

@ -5,7 +5,7 @@ import (
"fmt"
"reflect"
"go_inout"
"swigtests/go_inout"
)
type S struct {

View file

@ -1,6 +1,6 @@
package main
import "grouping"
import "swigtests/grouping"
func main() {
x := grouping.Test1(42)

View file

@ -1,6 +1,6 @@
package main
import . "import_nomodule"
import . "swigtests/import_nomodule"
func main() {
f := Create_Foo()

View file

@ -1,6 +1,6 @@
package main
import "inctest"
import "swigtests/inctest"
func main() {
inctest.NewA()

View file

@ -1,6 +1,6 @@
package main
import wrap "inherit_member"
import wrap "swigtests/inherit_member"
func main() {
s := wrap.NewChild()

View file

@ -1,6 +1,6 @@
package main
import "inherit_missing"
import "swigtests/inherit_missing"
func main() {
a := inherit_missing.New_Foo()

View file

@ -1,6 +1,6 @@
package main
import . "input"
import . "swigtests/input"
func main() {
f := NewFoo()

View file

@ -1,6 +1,6 @@
package main
import "keyword_rename_c"
import "swigtests/keyword_rename_c"
func main() {
keyword_rename_c.Xgo(1)

View file

@ -1,6 +1,6 @@
package main
import "keyword_rename"
import "swigtests/keyword_rename"
func main() {
keyword_rename.Xgo(1)

View file

@ -1,6 +1,6 @@
package main
import "li_attribute"
import "swigtests/li_attribute"
func main() {
aa := li_attribute.NewA(1, 2, 3)

View file

@ -1,6 +1,6 @@
package main
import . "li_carrays_cpp"
import . "swigtests/li_carrays_cpp"
func main() {
d := NewDoubleArray(10)

View file

@ -1,6 +1,6 @@
package main
import . "li_carrays"
import . "swigtests/li_carrays"
func main() {
d := NewDoubleArray(10)

View file

@ -1,6 +1,6 @@
package main
import . "li_cdata_cpp"
import . "swigtests/li_cdata_cpp"
func main() {
s := "ABC abc"

View file

@ -1,6 +1,6 @@
package main
import . "li_cdata"
import . "swigtests/li_cdata"
func main() {
s := "ABC abc"

View file

@ -1,6 +1,6 @@
package main
import . "li_cmalloc"
import . "swigtests/li_cmalloc"
func main() {
p := Malloc_int()

View file

@ -1,6 +1,6 @@
package main
import . "li_cpointer_cpp"
import . "swigtests/li_cpointer_cpp"
func main() {
p := New_intp()

View file

@ -1,6 +1,6 @@
package main
import . "li_cpointer"
import . "swigtests/li_cpointer"
func main() {
p := New_intp()

View file

@ -1,6 +1,6 @@
package main
import "li_std_map"
import "swigtests/li_std_map"
func main() {
a1 := li_std_map.NewA(3)

View file

@ -1,6 +1,6 @@
package main
import . "li_std_vector_ptr"
import . "swigtests/li_std_vector_ptr"
import "fmt"
func check(val1 int, val2 int) {

View file

@ -3,7 +3,7 @@
package main
import "fmt"
import . "member_pointer"
import . "swigtests/member_pointer"
func check(what string, expected float64, actual float64) {
if expected != actual {

View file

@ -1,6 +1,6 @@
package main
import "memberin_extend_c"
import "swigtests/memberin_extend_c"
func main() {
t := memberin_extend_c.NewPerson()

View file

@ -1,7 +1,7 @@
package main
import "fmt"
import "minherit"
import "swigtests/minherit"
func main() {
a := minherit.NewFoo()

View file

@ -1,6 +1,6 @@
package main
import . "namespace_class"
import . "swigtests/namespace_class"
func main() {
EulerT3DToFrame(1, 1, 1)

View file

@ -1,6 +1,6 @@
package main
import . "namespace_typemap"
import . "swigtests/namespace_typemap"
func main() {
if Stest1("hello") != "hello" {

View file

@ -1,6 +1,6 @@
package main
import "namespace_virtual_method"
import "swigtests/namespace_virtual_method"
func main() {
_ = namespace_virtual_method.NewSpam()

View file

@ -1,6 +1,6 @@
package main
import . "naturalvar"
import . "swigtests/naturalvar"
func main() {
f := NewFoo()

View file

@ -1,6 +1,6 @@
package main
import . "nested_workaround"
import . "swigtests/nested_workaround"
func main() {
inner := NewInner(5)

View file

@ -1,6 +1,6 @@
package main
import . "overload_complicated"
import . "swigtests/overload_complicated"
func main() {
var pInt *int

View file

@ -1,6 +1,6 @@
package main
import . "overload_copy"
import . "swigtests/overload_copy"
func main() {
f := NewFoo()

View file

@ -1,6 +1,6 @@
package main
import "overload_extend2"
import "swigtests/overload_extend2"
func main() {
f := overload_extend2.NewFoo()

View file

@ -1,6 +1,6 @@
package main
import "overload_extend_c"
import "swigtests/overload_extend_c"
func main() {
f := overload_extend_c.NewFoo()

View file

@ -1,6 +1,6 @@
package main
import "overload_extend"
import "swigtests/overload_extend"
func main() {
f := overload_extend.NewFoo()

View file

@ -1,6 +1,6 @@
package main
import "overload_polymorphic"
import "swigtests/overload_polymorphic"
func main(){
t := overload_polymorphic.NewDerived()

View file

@ -1,6 +1,6 @@
package main
import "overload_rename"
import "swigtests/overload_rename"
func main() {
_ = overload_rename.NewFoo(float32(1))

Some files were not shown because too many files have changed in this diff Show more