Makefile.am (MOSTLYCLEANFILES): Remove testing files and logs.
authorIan Lance Taylor <iant@golang.org>
Thu, 29 Jun 2017 16:01:38 +0000 (16:01 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Thu, 29 Jun 2017 16:01:38 +0000 (16:01 +0000)
* Makefile.am (MOSTLYCLEANFILES): Remove testing files and logs.
(mostlyclean-local): Remove check-runtime-dir, cgo-test-dir,
carchive-test-dir.
(ECHO_ENV): Define.
(check-go-tool): Depend on cgo.  Write command to testlog.
(check-runtime): New target.
(check-cgo-test): New target.
(check-carchive-test): New target.
(check): Depend on check-runtime, check-cgo-test,
check-carchive-test.  Add @ to prettify output.
(.PHONY): Add check-runtime, check-cgo-test, check-carchive-test.
* Makefile.in: Rebuild.

From-SVN: r249799

gotools/ChangeLog
gotools/Makefile.am
gotools/Makefile.in

index 1efa2235a8430dd47b3510f3d5973358356a46d5..76028962dc6a5b1f4129f887f9f3c5f7ae2bffdb 100644 (file)
@@ -1,3 +1,18 @@
+2017-06-29  Ian Lance Taylor  <iant@golang.org>
+
+       * Makefile.am (MOSTLYCLEANFILES): Remove testing files and logs.
+       (mostlyclean-local): Remove check-runtime-dir, cgo-test-dir,
+       carchive-test-dir.
+       (ECHO_ENV): Define.
+       (check-go-tool): Depend on cgo.  Write command to testlog.
+       (check-runtime): New target.
+       (check-cgo-test): New target.
+       (check-carchive-test): New target.
+       (check): Depend on check-runtime, check-cgo-test,
+       check-carchive-test.  Add @ to prettify output.
+       (.PHONY): Add check-runtime, check-cgo-test, check-carchive-test.
+       * Makefile.in: Rebuild.
+
 2017-06-26  Ian Lance Taylor  <iant@golang.org>
 
        * Makefile.am (s-zdefaultcc): Don't record $(bindir) for defaultCC
index 17d197908de097fe976bbc0ce384a4bcb7e5eb80..787a3c3d09483648ec5aecbd81086c588768955f 100644 (file)
@@ -44,6 +44,7 @@ GOLINK = $(GOCOMPILER) $(GOCFLAGS) $(AM_GOCFLAGS) $(LDFLAGS) $(AM_LDFLAGS) -o $@
 
 libgosrcdir = $(srcdir)/../libgo/go
 cmdsrcdir = $(libgosrcdir)/cmd
+libgomiscdir = $(srcdir)/../libgo/misc
 
 go_cmd_go_files = \
        $(cmdsrcdir)/go/alldocs.go \
@@ -106,7 +107,12 @@ s-zdefaultcc: Makefile
        $(SHELL) $(srcdir)/../move-if-change zdefaultcc.go.tmp zdefaultcc.go
        $(STAMP) $@ 
 
-MOSTLYCLEANFILES = zdefaultcc.go s-zdefaultcc
+MOSTLYCLEANFILES = \
+       zdefaultcc.go s-zdefaultcc \
+       check-gccgo gotools.head *-testlog gotools.sum gotools.log
+
+mostlyclean-local:
+       rm -rf check-go-dir check-runtime-dir cgo-test-dir carchive-test-dir
 
 if NATIVE
 
@@ -156,6 +162,7 @@ check-gccgo: Makefile
        chmod +x $@
 
 # CHECK_ENV sets up the environment to run the newly built go tool.
+# If you change this, change ECHO_ENV, below.
 CHECK_ENV = \
        PATH=`echo $(abs_builddir):$${PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \
        export PATH; \
@@ -169,25 +176,81 @@ CHECK_ENV = \
        LD_LIBRARY_PATH=`echo $${abs_libgodir}/.libs:$${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \
        export LD_LIBRARY_PATH;
 
+# ECHO_ENV is a variant of CHECK_ENV to put into a testlog file.
+# It assumes that abs_libgodir is set.
+ECHO_ENV = PATH=`echo $(abs_builddir):$${PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'` GCCGO='$(abs_builddir)/check-gccgo' GCCGOTOOLDIR='$(abs_builddir)' GO_TESTING_GOTOOLS=yes LD_LIBRARY_PATH=`echo $${abs_libgodir}/.libs:$${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`
+
 # check-go-tools runs `go test cmd/go` in our environment.
-check-go-tool: go$(EXEEXT) check-head check-gccgo
-       rm -rf check-go-dir
+check-go-tool: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo
+       rm -rf check-go-dir cmd_go-testlog
        $(MKDIR_P) check-go-dir/src/cmd/go
        cp $(cmdsrcdir)/go/*.go check-go-dir/src/cmd/go/
        cp $(libgodir)/zstdpkglist.go check-go-dir/src/cmd/go/
        cp zdefaultcc.go check-go-dir/src/cmd/go/
        cp -r $(cmdsrcdir)/go/testdata check-go-dir/src/cmd/go/
+       @abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \
+       abs_checkdir=`cd check-go-dir && $(PWD_COMMAND)`; \
+       echo "cd check-go-dir/src/cmd/go && $(ECHO_ENV) GOPATH=$${abs_checkdir} $(abs_builddir)/go$(EXEEXT) test -test.short -test.v" > cmd_go-testlog
        $(CHECK_ENV) \
        GOPATH=`cd check-go-dir && $(PWD_COMMAND)`; \
        export GOPATH; \
        (cd check-go-dir/src/cmd/go && $(abs_builddir)/go$(EXEEXT) test -test.short -test.v) > cmd_go-testlog 2>&1 || true
        grep '^--- ' cmd_go-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/'
 
+# check-runtime runs `go test runtime` in our environment.
+# The runtime package is also tested as part of libgo,
+# but the runtime tests use the go tool heavily, so testing
+# here too will catch more problems.
+check-runtime: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo
+       rm -rf check-runtime-dir runtime-testlog
+       $(MKDIR_P) check-runtime-dir
+       @abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \
+       LD_LIBRARY_PATH=`echo $${abs_libgodir}/.libs:$${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \
+       GOARCH=`$(abs_builddir)/go$(EXEEXT) env GOARCH`; \
+       GOOS=`$(abs_builddir)/go$(EXEEXT) env GOOS`; \
+       files=`$(SHELL) $(libgosrcdir)/../match.sh --goarch=$${GOARCH} --goos=$${GOOS} --srcdir=$(libgosrcdir)/runtime --extrafiles="$(libgodir)/runtime_sysinfo.go $(libgodir)/sigtab.go" --tag=libffi`; \
+       echo "$(ECHO_ENV) GC='$(abs_builddir)/check-gccgo -fgo-compiling-runtime' GOARCH=$${GOARCH} GOOS=$${GOOS} $(SHELL) $(libgosrcdir)/../testsuite/gotest --goarch=$${GOARCH} --goos=$${GOOS} --basedir=$(libgosrcdir)/.. --srcdir=$(libgosrcdir)/runtime --pkgpath=runtime --pkgfiles='$${files}' -test.v" > runtime-testlog
+       $(CHECK_ENV) \
+       GC="$${GCCGO} -fgo-compiling-runtime"; \
+       export GC; \
+       GOARCH=`$(abs_builddir)/go$(EXEEXT) env GOARCH`; \
+       GOOS=`$(abs_builddir)/go$(EXEEXT) env GOOS`; \
+       files=`$(SHELL) $(libgosrcdir)/../match.sh --goarch=$${GOARCH} --goos=$${GOOS} --srcdir=$(libgosrcdir)/runtime --extrafiles="$(libgodir)/runtime_sysinfo.go $(libgodir)/sigtab.go" --tag=libffi`; \
+       $(SHELL) $(libgosrcdir)/../testsuite/gotest --goarch=$${GOARCH} --goos=$${GOOS} --basedir=$(libgosrcdir)/.. --srcdir=$(libgosrcdir)/runtime --pkgpath=runtime --pkgfiles="$${files}" -test.v >> runtime-testlog 2>&1 || true
+       grep '^--- ' runtime-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/'
+
+# check-cgo-test runs `go test misc/cgo/test` in our environment.
+check-cgo-test: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo
+       rm -rf cgo-test-dir cgo-testlog
+       $(MKDIR_P) cgo-test-dir/misc/cgo
+       cp -r $(libgomiscdir)/cgo/test cgo-test-dir/misc/cgo/
+       @abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \
+       echo "cd cgo-test-dir/misc/cgo/test && $(ECHO_ENV) GOTRACEBACK=2 $(abs_builddir)/go$(EXEEXT) test -test.short -test.v" > cgo-testlog
+       $(CHECK_ENV) \
+       GOTRACEBACK=2; \
+       export GOTRACEBACK; \
+       (cd cgo-test-dir/misc/cgo/test && $(abs_builddir)/go$(EXEEXT) test -test.short -test.v) >> cgo-testlog 2>&1 || true
+       grep '^--- ' cgo-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/'
+
+# check-carchive-test runs `go test misc/cgo/testcarchive/carchive_test.go`
+# in our environment.
+check-carchive-test: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo
+       rm -rf carchive-test-dir carchive-testlog
+       $(MKDIR_P) carchive-test-dir/misc/cgo
+       cp -r $(libgomiscdir)/cgo/testcarchive carchive-test-dir/misc/cgo/
+       @abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \
+       echo "cd carchive-test-dir/misc/cgo/testcarchive && $(ECHO_ENV) LIBRARY_PATH=`echo $${abs_libgodir}/.libs` $(abs_builddir)/go$(EXEEXT) test -test.v carchive_test.go" > carchive-testlog
+       $(CHECK_ENV) \
+       LIBRARY_PATH=`echo $${abs_libgodir}/.libs:$${LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \
+       export LIBRARY_PATH; \
+       (cd carchive-test-dir/misc/cgo/testcarchive && $(abs_builddir)/go$(EXEEXT) test -test.v carchive_test.go) >> carchive-testlog 2>&1 || true
+       grep '^--- ' carchive-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/'
+
 # The check targets runs the tests and assembles the output files.
-check: check-head check-go-tool
-       mv gotools.head gotools.sum
-       cp gotools.sum gotools.log
-       for file in cmd_go-testlog; do \
+check: check-head check-go-tool check-runtime check-cgo-test check-carchive-test
+       @mv gotools.head gotools.sum
+       @cp gotools.sum gotools.log
+       @for file in cmd_go-testlog runtime-testlog cgo-testlog carchive-testlog; do \
          testname=`echo $${file} | sed -e 's/-testlog//' -e 's|_|/|'`; \
          echo "Running $${testname}" >> gotools.sum; \
          echo "Running $${testname}" >> gotools.log; \
@@ -196,24 +259,24 @@ check: check-head check-go-tool
        done
        @echo >> gotools.sum
        @echo "         === gotools Summary ===" >> gotools.sum
-       pass=`grep -c '^PASS' gotools.sum`; \
+       @pass=`grep -c '^PASS' gotools.sum`; \
        if test "$${pass}" -ne "0"; then \
          echo "# of expected passes            $${pass}" >> gotools.sum; \
        fi
-       fail=`grep -c '^FAIL' gotools.sum`; \
+       @fail=`grep -c '^FAIL' gotools.sum`; \
        if test "$${fail}" -ne "0"; then \
          echo "# of unexpected failures        $${fail}" >> gotools.sum; \
        fi
-       untested=`grep -c '^UNTESTED' gotools.sum`; \
+       @untested=`grep -c '^UNTESTED' gotools.sum`; \
        if test "$${untested}" -ne "0"; then \
          echo "# of untested testcases         $${untested}" >> gotools.sum; \
        fi
-       echo `echo $(GOC_FOR_TARGET) | sed -e 's/ .*//'`  `$(GOC_FOR_TARGET) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> gotools.sum
-       echo >> gotools.log
-       echo "runtest completed at `date`" >> gotools.log
-       if grep '^FAIL' gotools.sum >/dev/null 2>&1; then exit 1; fi
+       @echo `echo $(GOC_FOR_TARGET) | sed -e 's/ .*//'`  `$(GOC_FOR_TARGET) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> gotools.sum
+       @echo >> gotools.log
+       @echo "runtest completed at `date`" >> gotools.log
+       @if grep '^FAIL' gotools.sum >/dev/null 2>&1; then exit 1; fi
 
-.PHONY: check check-head check-go-tool
+.PHONY: check check-head check-go-tool check-runtime check-cgo-test check-carchive-test
 
 else
 
@@ -224,6 +287,3 @@ else
 # the go/build package.  Figure this out later.
 
 endif
-
-mostlyclean-local:
-       rm -rf check-go-dir
index cbd8c916b687ac1f279204c6ba6ae81bca98c295..8f4eefabda43ac2ea0541e42c26caceaa568e9ec 100644 (file)
@@ -263,6 +263,7 @@ AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs
 GOLINK = $(GOCOMPILER) $(GOCFLAGS) $(AM_GOCFLAGS) $(LDFLAGS) $(AM_LDFLAGS) -o $@
 libgosrcdir = $(srcdir)/../libgo/go
 cmdsrcdir = $(libgosrcdir)/cmd
+libgomiscdir = $(srcdir)/../libgo/misc
 go_cmd_go_files = \
        $(cmdsrcdir)/go/alldocs.go \
        $(cmdsrcdir)/go/bug.go \
@@ -313,7 +314,10 @@ go_cmd_cgo_files = \
 GCCGO_INSTALL_NAME := $(shell echo gccgo|sed '$(program_transform_name)')
 GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)')
 GXX_INSTALL_NAME := $(shell echo g++|sed '$(program_transform_name)')
-MOSTLYCLEANFILES = zdefaultcc.go s-zdefaultcc
+MOSTLYCLEANFILES = \
+       zdefaultcc.go s-zdefaultcc \
+       check-gccgo gotools.head *-testlog gotools.sum gotools.log
+
 
 # For a native build we build the programs using the newly built libgo
 # and install them as regular programs.
@@ -322,6 +326,7 @@ MOSTLYCLEANFILES = zdefaultcc.go s-zdefaultcc
 @NATIVE_TRUE@man_MANS = go.1 gofmt.1
 
 # CHECK_ENV sets up the environment to run the newly built go tool.
+# If you change this, change ECHO_ENV, below.
 @NATIVE_TRUE@CHECK_ENV = \
 @NATIVE_TRUE@  PATH=`echo $(abs_builddir):$${PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \
 @NATIVE_TRUE@  export PATH; \
@@ -335,6 +340,10 @@ MOSTLYCLEANFILES = zdefaultcc.go s-zdefaultcc
 @NATIVE_TRUE@  LD_LIBRARY_PATH=`echo $${abs_libgodir}/.libs:$${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \
 @NATIVE_TRUE@  export LD_LIBRARY_PATH;
 
+
+# ECHO_ENV is a variant of CHECK_ENV to put into a testlog file.
+# It assumes that abs_libgodir is set.
+@NATIVE_TRUE@ECHO_ENV = PATH=`echo $(abs_builddir):$${PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'` GCCGO='$(abs_builddir)/check-gccgo' GCCGOTOOLDIR='$(abs_builddir)' GO_TESTING_GOTOOLS=yes LD_LIBRARY_PATH=`echo $${abs_libgodir}/.libs:$${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`
 all: all-am
 
 .SUFFIXES:
@@ -582,8 +591,8 @@ distclean-generic:
 maintainer-clean-generic:
        @echo "This command is intended for maintainers to use"
        @echo "it deletes files that may require special tools to rebuild."
-@NATIVE_FALSE@install-exec-local:
 @NATIVE_FALSE@uninstall-local:
+@NATIVE_FALSE@install-exec-local:
 clean: clean-am
 
 clean-am: clean-binPROGRAMS clean-generic clean-noinstPROGRAMS \
@@ -688,6 +697,9 @@ s-zdefaultcc: Makefile
        $(SHELL) $(srcdir)/../move-if-change zdefaultcc.go.tmp zdefaultcc.go
        $(STAMP) $@ 
 
+mostlyclean-local:
+       rm -rf check-go-dir check-runtime-dir cgo-test-dir carchive-test-dir
+
 @NATIVE_TRUE@go$(EXEEXT): $(go_cmd_go_files) zdefaultcc.go $(LIBGODEP)
 @NATIVE_TRUE@  $(GOLINK) $(go_cmd_go_files) zdefaultcc.go $(LIBS) $(NET_LIBS)
 @NATIVE_TRUE@gofmt$(EXEEXT): $(go_cmd_gofmt_files) $(LIBGODEP)
@@ -727,24 +739,76 @@ s-zdefaultcc: Makefile
 @NATIVE_TRUE@  chmod +x $@
 
 # check-go-tools runs `go test cmd/go` in our environment.
-@NATIVE_TRUE@check-go-tool: go$(EXEEXT) check-head check-gccgo
-@NATIVE_TRUE@  rm -rf check-go-dir
+@NATIVE_TRUE@check-go-tool: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo
+@NATIVE_TRUE@  rm -rf check-go-dir cmd_go-testlog
 @NATIVE_TRUE@  $(MKDIR_P) check-go-dir/src/cmd/go
 @NATIVE_TRUE@  cp $(cmdsrcdir)/go/*.go check-go-dir/src/cmd/go/
 @NATIVE_TRUE@  cp $(libgodir)/zstdpkglist.go check-go-dir/src/cmd/go/
 @NATIVE_TRUE@  cp zdefaultcc.go check-go-dir/src/cmd/go/
 @NATIVE_TRUE@  cp -r $(cmdsrcdir)/go/testdata check-go-dir/src/cmd/go/
+@NATIVE_TRUE@  @abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \
+@NATIVE_TRUE@  abs_checkdir=`cd check-go-dir && $(PWD_COMMAND)`; \
+@NATIVE_TRUE@  echo "cd check-go-dir/src/cmd/go && $(ECHO_ENV) GOPATH=$${abs_checkdir} $(abs_builddir)/go$(EXEEXT) test -test.short -test.v" > cmd_go-testlog
 @NATIVE_TRUE@  $(CHECK_ENV) \
 @NATIVE_TRUE@  GOPATH=`cd check-go-dir && $(PWD_COMMAND)`; \
 @NATIVE_TRUE@  export GOPATH; \
 @NATIVE_TRUE@  (cd check-go-dir/src/cmd/go && $(abs_builddir)/go$(EXEEXT) test -test.short -test.v) > cmd_go-testlog 2>&1 || true
 @NATIVE_TRUE@  grep '^--- ' cmd_go-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/'
 
+# check-runtime runs `go test runtime` in our environment.
+# The runtime package is also tested as part of libgo,
+# but the runtime tests use the go tool heavily, so testing
+# here too will catch more problems.
+@NATIVE_TRUE@check-runtime: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo
+@NATIVE_TRUE@  rm -rf check-runtime-dir runtime-testlog
+@NATIVE_TRUE@  $(MKDIR_P) check-runtime-dir
+@NATIVE_TRUE@  @abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \
+@NATIVE_TRUE@  LD_LIBRARY_PATH=`echo $${abs_libgodir}/.libs:$${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \
+@NATIVE_TRUE@  GOARCH=`$(abs_builddir)/go$(EXEEXT) env GOARCH`; \
+@NATIVE_TRUE@  GOOS=`$(abs_builddir)/go$(EXEEXT) env GOOS`; \
+@NATIVE_TRUE@  files=`$(SHELL) $(libgosrcdir)/../match.sh --goarch=$${GOARCH} --goos=$${GOOS} --srcdir=$(libgosrcdir)/runtime --extrafiles="$(libgodir)/runtime_sysinfo.go $(libgodir)/sigtab.go" --tag=libffi`; \
+@NATIVE_TRUE@  echo "$(ECHO_ENV) GC='$(abs_builddir)/check-gccgo -fgo-compiling-runtime' GOARCH=$${GOARCH} GOOS=$${GOOS} $(SHELL) $(libgosrcdir)/../testsuite/gotest --goarch=$${GOARCH} --goos=$${GOOS} --basedir=$(libgosrcdir)/.. --srcdir=$(libgosrcdir)/runtime --pkgpath=runtime --pkgfiles='$${files}' -test.v" > runtime-testlog
+@NATIVE_TRUE@  $(CHECK_ENV) \
+@NATIVE_TRUE@  GC="$${GCCGO} -fgo-compiling-runtime"; \
+@NATIVE_TRUE@  export GC; \
+@NATIVE_TRUE@  GOARCH=`$(abs_builddir)/go$(EXEEXT) env GOARCH`; \
+@NATIVE_TRUE@  GOOS=`$(abs_builddir)/go$(EXEEXT) env GOOS`; \
+@NATIVE_TRUE@  files=`$(SHELL) $(libgosrcdir)/../match.sh --goarch=$${GOARCH} --goos=$${GOOS} --srcdir=$(libgosrcdir)/runtime --extrafiles="$(libgodir)/runtime_sysinfo.go $(libgodir)/sigtab.go" --tag=libffi`; \
+@NATIVE_TRUE@  $(SHELL) $(libgosrcdir)/../testsuite/gotest --goarch=$${GOARCH} --goos=$${GOOS} --basedir=$(libgosrcdir)/.. --srcdir=$(libgosrcdir)/runtime --pkgpath=runtime --pkgfiles="$${files}" -test.v >> runtime-testlog 2>&1 || true
+@NATIVE_TRUE@  grep '^--- ' runtime-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/'
+
+# check-cgo-test runs `go test misc/cgo/test` in our environment.
+@NATIVE_TRUE@check-cgo-test: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo
+@NATIVE_TRUE@  rm -rf cgo-test-dir cgo-testlog
+@NATIVE_TRUE@  $(MKDIR_P) cgo-test-dir/misc/cgo
+@NATIVE_TRUE@  cp -r $(libgomiscdir)/cgo/test cgo-test-dir/misc/cgo/
+@NATIVE_TRUE@  @abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \
+@NATIVE_TRUE@  echo "cd cgo-test-dir/misc/cgo/test && $(ECHO_ENV) GOTRACEBACK=2 $(abs_builddir)/go$(EXEEXT) test -test.short -test.v" > cgo-testlog
+@NATIVE_TRUE@  $(CHECK_ENV) \
+@NATIVE_TRUE@  GOTRACEBACK=2; \
+@NATIVE_TRUE@  export GOTRACEBACK; \
+@NATIVE_TRUE@  (cd cgo-test-dir/misc/cgo/test && $(abs_builddir)/go$(EXEEXT) test -test.short -test.v) >> cgo-testlog 2>&1 || true
+@NATIVE_TRUE@  grep '^--- ' cgo-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/'
+
+# check-carchive-test runs `go test misc/cgo/testcarchive/carchive_test.go`
+# in our environment.
+@NATIVE_TRUE@check-carchive-test: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo
+@NATIVE_TRUE@  rm -rf carchive-test-dir carchive-testlog
+@NATIVE_TRUE@  $(MKDIR_P) carchive-test-dir/misc/cgo
+@NATIVE_TRUE@  cp -r $(libgomiscdir)/cgo/testcarchive carchive-test-dir/misc/cgo/
+@NATIVE_TRUE@  @abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \
+@NATIVE_TRUE@  echo "cd carchive-test-dir/misc/cgo/testcarchive && $(ECHO_ENV) LIBRARY_PATH=`echo $${abs_libgodir}/.libs` $(abs_builddir)/go$(EXEEXT) test -test.v carchive_test.go" > carchive-testlog
+@NATIVE_TRUE@  $(CHECK_ENV) \
+@NATIVE_TRUE@  LIBRARY_PATH=`echo $${abs_libgodir}/.libs:$${LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \
+@NATIVE_TRUE@  export LIBRARY_PATH; \
+@NATIVE_TRUE@  (cd carchive-test-dir/misc/cgo/testcarchive && $(abs_builddir)/go$(EXEEXT) test -test.v carchive_test.go) >> carchive-testlog 2>&1 || true
+@NATIVE_TRUE@  grep '^--- ' carchive-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/'
+
 # The check targets runs the tests and assembles the output files.
-@NATIVE_TRUE@check: check-head check-go-tool
-@NATIVE_TRUE@  mv gotools.head gotools.sum
-@NATIVE_TRUE@  cp gotools.sum gotools.log
-@NATIVE_TRUE@  for file in cmd_go-testlog; do \
+@NATIVE_TRUE@check: check-head check-go-tool check-runtime check-cgo-test check-carchive-test
+@NATIVE_TRUE@  @mv gotools.head gotools.sum
+@NATIVE_TRUE@  @cp gotools.sum gotools.log
+@NATIVE_TRUE@  @for file in cmd_go-testlog runtime-testlog cgo-testlog carchive-testlog; do \
 @NATIVE_TRUE@    testname=`echo $${file} | sed -e 's/-testlog//' -e 's|_|/|'`; \
 @NATIVE_TRUE@    echo "Running $${testname}" >> gotools.sum; \
 @NATIVE_TRUE@    echo "Running $${testname}" >> gotools.log; \
@@ -753,24 +817,24 @@ s-zdefaultcc: Makefile
 @NATIVE_TRUE@  done
 @NATIVE_TRUE@  @echo >> gotools.sum
 @NATIVE_TRUE@  @echo "         === gotools Summary ===" >> gotools.sum
-@NATIVE_TRUE@  pass=`grep -c '^PASS' gotools.sum`; \
+@NATIVE_TRUE@  @pass=`grep -c '^PASS' gotools.sum`; \
 @NATIVE_TRUE@  if test "$${pass}" -ne "0"; then \
 @NATIVE_TRUE@    echo "# of expected passes            $${pass}" >> gotools.sum; \
 @NATIVE_TRUE@  fi
-@NATIVE_TRUE@  fail=`grep -c '^FAIL' gotools.sum`; \
+@NATIVE_TRUE@  @fail=`grep -c '^FAIL' gotools.sum`; \
 @NATIVE_TRUE@  if test "$${fail}" -ne "0"; then \
 @NATIVE_TRUE@    echo "# of unexpected failures        $${fail}" >> gotools.sum; \
 @NATIVE_TRUE@  fi
-@NATIVE_TRUE@  untested=`grep -c '^UNTESTED' gotools.sum`; \
+@NATIVE_TRUE@  @untested=`grep -c '^UNTESTED' gotools.sum`; \
 @NATIVE_TRUE@  if test "$${untested}" -ne "0"; then \
 @NATIVE_TRUE@    echo "# of untested testcases         $${untested}" >> gotools.sum; \
 @NATIVE_TRUE@  fi
-@NATIVE_TRUE@  echo `echo $(GOC_FOR_TARGET) | sed -e 's/ .*//'`  `$(GOC_FOR_TARGET) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> gotools.sum
-@NATIVE_TRUE@  echo >> gotools.log
-@NATIVE_TRUE@  echo "runtest completed at `date`" >> gotools.log
-@NATIVE_TRUE@  if grep '^FAIL' gotools.sum >/dev/null 2>&1; then exit 1; fi
+@NATIVE_TRUE@  @echo `echo $(GOC_FOR_TARGET) | sed -e 's/ .*//'`  `$(GOC_FOR_TARGET) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> gotools.sum
+@NATIVE_TRUE@  @echo >> gotools.log
+@NATIVE_TRUE@  @echo "runtest completed at `date`" >> gotools.log
+@NATIVE_TRUE@  @if grep '^FAIL' gotools.sum >/dev/null 2>&1; then exit 1; fi
 
-@NATIVE_TRUE@.PHONY: check check-head check-go-tool
+@NATIVE_TRUE@.PHONY: check check-head check-go-tool check-runtime check-cgo-test check-carchive-test
 
 # For a non-native build we have to build the programs using a
 # previously built host (or build -> host) Go compiler.  We should
@@ -778,9 +842,6 @@ s-zdefaultcc: Makefile
 # the right values for GOARCH and GOOS in the default build context in
 # the go/build package.  Figure this out later.
 
-mostlyclean-local:
-       rm -rf check-go-dir
-
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT: