| 1 |
# Makefile for gotools |
| 2 |
# Copyright (C) 2015-2016 Free Software Foundation, Inc. |
| 3 |
# |
| 4 |
# This file is free software; you can redistribute it and/or modify |
| 5 |
# it under the terms of the GNU General Public License as published by |
| 6 |
# the Free Software Foundation; either version 3 of the License, or |
| 7 |
# (at your option) any later version. |
| 8 |
# |
| 9 |
# This program is distributed in the hope that it will be useful, |
| 10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
# GNU General Public License for more details. |
| 13 |
# |
| 14 |
# You should have received a copy of the GNU General Public License |
| 15 |
# along with this program; see the file COPYING3. If not see |
| 16 |
# <http://www.gnu.org/licenses/>. |
| 17 |
|
| 18 |
ACLOCAL_AMFLAGS = -I ../config |
| 19 |
|
| 20 |
gcc_version := $(shell $(GCC_FOR_TARGET) -dumpversion) |
| 21 |
|
| 22 |
libexecsubdir = $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version) |
| 23 |
|
| 24 |
mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs |
| 25 |
PWD_COMMAND = $${PWDCMD-pwd} |
| 26 |
STAMP = echo timestamp > |
| 27 |
|
| 28 |
libgodir = ../$(target_noncanonical)/libgo |
| 29 |
LIBGODEP = $(libgodir)/libgo.la |
| 30 |
|
| 31 |
LIBGOTOOL = $(libgodir)/libgotool.a |
| 32 |
|
| 33 |
if NATIVE |
| 34 |
# Use the compiler we just built. |
| 35 |
GOCOMPILER = $(GOC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) |
| 36 |
else |
| 37 |
GOCOMPILER = $(GOC) |
| 38 |
endif |
| 39 |
|
| 40 |
GOCFLAGS = $(CFLAGS_FOR_TARGET) |
| 41 |
GOCOMPILE = $(GOCOMPILER) $(GOCFLAGS) |
| 42 |
|
| 43 |
AM_GOCFLAGS = -I $(libgodir) |
| 44 |
AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs |
| 45 |
GOLINK = $(GOCOMPILER) $(GOCFLAGS) $(AM_GOCFLAGS) $(LDFLAGS) $(AM_LDFLAGS) -o $@ |
| 46 |
|
| 47 |
libgosrcdir = $(srcdir)/../libgo/go |
| 48 |
cmdsrcdir = $(libgosrcdir)/cmd |
| 49 |
libgomiscdir = $(srcdir)/../libgo/misc |
| 50 |
|
| 51 |
go_cmd_go_files = \ |
| 52 |
$(cmdsrcdir)/go/alldocs.go \ |
| 53 |
$(cmdsrcdir)/go/go11.go \ |
| 54 |
$(cmdsrcdir)/go/main.go |
| 55 |
|
| 56 |
go_cmd_gofmt_files = \ |
| 57 |
$(cmdsrcdir)/gofmt/doc.go \ |
| 58 |
$(cmdsrcdir)/gofmt/gofmt.go \ |
| 59 |
$(cmdsrcdir)/gofmt/internal.go \ |
| 60 |
$(cmdsrcdir)/gofmt/rewrite.go \ |
| 61 |
$(cmdsrcdir)/gofmt/simplify.go |
| 62 |
|
| 63 |
go_cmd_cgo_files = \ |
| 64 |
$(cmdsrcdir)/cgo/ast.go \ |
| 65 |
$(cmdsrcdir)/cgo/ast_go118.go \ |
| 66 |
$(cmdsrcdir)/cgo/doc.go \ |
| 67 |
$(cmdsrcdir)/cgo/gcc.go \ |
| 68 |
$(cmdsrcdir)/cgo/godefs.go \ |
| 69 |
$(cmdsrcdir)/cgo/main.go \ |
| 70 |
$(cmdsrcdir)/cgo/out.go \ |
| 71 |
$(cmdsrcdir)/cgo/util.go |
| 72 |
|
| 73 |
go_cmd_vet_files = \ |
| 74 |
$(cmdsrcdir)/vet/doc.go \ |
| 75 |
$(cmdsrcdir)/vet/main.go |
| 76 |
|
| 77 |
go_cmd_buildid_files = \ |
| 78 |
$(cmdsrcdir)/buildid/buildid.go \ |
| 79 |
$(cmdsrcdir)/buildid/doc.go |
| 80 |
|
| 81 |
go_cmd_test2json_files = \ |
| 82 |
$(cmdsrcdir)/test2json/main.go |
| 83 |
|
| 84 |
GCCGO_INSTALL_NAME := $(shell echo gccgo|sed '$(program_transform_name)') |
| 85 |
GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)') |
| 86 |
GXX_INSTALL_NAME := $(shell echo g++|sed '$(program_transform_name)') |
| 87 |
|
| 88 |
zdefaultcc.go: s-zdefaultcc; @true |
| 89 |
s-zdefaultcc: Makefile |
| 90 |
echo 'package main' > zdefaultcc.go.tmp |
| 91 |
echo 'func defaultGCCGO(goos, goarch string) string { return "$(bindir)/$(GCCGO_INSTALL_NAME)" }' >> zdefaultcc.go.tmp |
| 92 |
echo 'func defaultCC(goos, goarch string) string { return "$(GCC_INSTALL_NAME)" }' >> zdefaultcc.go.tmp |
| 93 |
echo 'func defaultCXX(goos, goarch string) string { return "$(GXX_INSTALL_NAME)" }' >> zdefaultcc.go.tmp |
| 94 |
echo 'const defaultPkgConfig = "pkg-config"' >> zdefaultcc.go.tmp |
| 95 |
$(SHELL) $(srcdir)/../move-if-change zdefaultcc.go.tmp zdefaultcc.go |
| 96 |
$(STAMP) $@ |
| 97 |
|
| 98 |
MOSTLYCLEANFILES = \ |
| 99 |
zdefaultcc.go s-zdefaultcc \ |
| 100 |
check-gccgo check-gcc gotools.head *-testlog gotools.sum gotools.log \ |
| 101 |
*.sent |
| 102 |
|
| 103 |
mostlyclean-local: |
| 104 |
if test -d check-go-dir; then chmod -R u+w check-go-dir; fi |
| 105 |
rm -rf check-go-dir cgo-test-dir carchive-test-dir \ |
| 106 |
check-vet-dir check-embed-dir gocache-test |
| 107 |
|
| 108 |
if NATIVE |
| 109 |
|
| 110 |
# For a native build we build the programs using the newly built libgo |
| 111 |
# and install them as regular programs. |
| 112 |
|
| 113 |
bin_PROGRAMS = go$(EXEEXT) gofmt$(EXEEXT) |
| 114 |
noinst_PROGRAMS = cgo$(EXEEXT) vet$(EXEEXT) buildid$(EXEEXT) test2json$(EXEEXT) |
| 115 |
man_MANS = go.1 gofmt.1 |
| 116 |
|
| 117 |
go$(EXEEXT): $(go_cmd_go_files) $(LIBGOTOOL) $(LIBGODEP) |
| 118 |
$(GOLINK) $(go_cmd_go_files) $(LIBGOTOOL) $(LIBS) $(NET_LIBS) |
| 119 |
gofmt$(EXEEXT): $(go_cmd_gofmt_files) $(LIBGODEP) |
| 120 |
$(GOLINK) $(go_cmd_gofmt_files) $(LIBGOTOOL) $(LIBS) $(NET_LIBS) |
| 121 |
cgo$(EXEEXT): $(go_cmd_cgo_files) zdefaultcc.go $(LIBGOTOOL) $(LIBGODEP) |
| 122 |
$(GOLINK) $(go_cmd_cgo_files) zdefaultcc.go $(LIBGOTOOL) $(LIBS) $(NET_LIBS) |
| 123 |
vet$(EXEEXT): $(go_cmd_vet_files) $(LIBGOTOOL) $(LIBGODEP) |
| 124 |
$(GOLINK) $(go_cmd_vet_files) $(LIBGOTOOL) $(LIBS) $(NET_LIBS) |
| 125 |
buildid$(EXEEXT): $(go_cmd_buildid_files) $(LIBGOTOOL) $(LIBGODEP) |
| 126 |
$(GOLINK) $(go_cmd_buildid_files) $(LIBGOTOOL) $(LIBS) $(NET_LIBS) |
| 127 |
test2json$(EXEEXT): $(go_cmd_test2json_files) $(LIBGOTOOL) $(LIBGODEP) |
| 128 |
$(GOLINK) $(go_cmd_test2json_files) $(LIBGOTOOL) $(LIBS) $(NET_LIBS) |
| 129 |
|
| 130 |
install-exec-local: $(noinst_PROGRAMS) |
| 131 |
$(MKDIR_P) $(DESTDIR)$(libexecsubdir) |
| 132 |
for f in $(noinst_PROGRAMS); do \ |
| 133 |
rm -f $(DESTDIR)$(libexecsubdir)/$$f; \ |
| 134 |
$(INSTALL_PROGRAM) $$f $(DESTDIR)$(libexecsubdir)/$$f; \ |
| 135 |
done |
| 136 |
|
| 137 |
uninstall-local: |
| 138 |
for f in $(noinst_PROGRAMS); do \ |
| 139 |
rm -f $(DESTDIR)$(libexecsubdir)/$$f; \ |
| 140 |
done |
| 141 |
|
| 142 |
GOTESTFLAGS = |
| 143 |
|
| 144 |
# Number of seconds before tests time out. |
| 145 |
GOTOOLS_TEST_TIMEOUT = 1200 |
| 146 |
|
| 147 |
# Run tests using the go tool, and frob the output to look like that |
| 148 |
# generated by DejaGNU. The main output of this is two files: |
| 149 |
# gotools.sum and gotools.log. |
| 150 |
|
| 151 |
# check-head starts generating the log files in DejaGNU format. This |
| 152 |
# is a separate target so that the date is approximately when we start |
| 153 |
# running the tests. |
| 154 |
check-head: |
| 155 |
@echo "Test Run By $${USER} on `date`" > gotools.head |
| 156 |
@echo "Native configuration is $(host_triplet)" >> gotools.head |
| 157 |
@echo >> gotools.head |
| 158 |
@echo " === gotools tests ===" >> gotools.head |
| 159 |
@echo >> gotools.head |
| 160 |
|
| 161 |
# check-gccgo is a little shell script that executes gccgo with the |
| 162 |
# options to pick up the newly built libgo and libstdc++. |
| 163 |
check-gccgo: Makefile |
| 164 |
rm -f $@ [email protected] |
| 165 |
echo "#!/bin/sh" > [email protected] |
| 166 |
abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \ |
| 167 |
echo "$(GOCOMPILE)" '"$$@"' "-I $${abs_libgodir} -L $${abs_libgodir} -L $${abs_libgodir}/.libs -B$${abs_libgodir}/../libstdc++-v3/src/.libs -B$${abs_libgodir}/../libstdc++-v3/libsupc++/.libs" >> [email protected] |
| 168 |
chmod +x [email protected] |
| 169 |
mv -f [email protected] $@ |
| 170 |
|
| 171 |
# check-gcc is a little shell script that executes the newly built gcc |
| 172 |
# with the options to pick up the newly built libgo and libstdc++. |
| 173 |
check-gcc: Makefile |
| 174 |
rm -f $@ [email protected] |
| 175 |
echo "#!/bin/sh" > [email protected] |
| 176 |
abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \ |
| 177 |
echo "$(GCC_FOR_TARGET)" '"$$@"' "-L $${abs_libgodir} -L $${abs_libgodir}/.libs -B$${abs_libgodir}/../libstdc++-v3/src/.libs -B$${abs_libgodir}/../libstdc++-v3/libsupc++/.libs" >> [email protected] |
| 178 |
chmod +x [email protected] |
| 179 |
mv -f [email protected] $@ |
| 180 |
|
| 181 |
# CHECK_ENV sets up the environment to run the newly built go tool. |
| 182 |
# If you change this, change ECHO_ENV, below. |
| 183 |
# The fl shell variable is used to avoid having FAIL appear |
| 184 |
# in the log unnecessarily. |
| 185 |
CHECK_ENV = \ |
| 186 |
PATH=`echo $(abs_builddir):$${PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \ |
| 187 |
export PATH; \ |
| 188 |
GCCGO="$(abs_builddir)/check-gccgo"; \ |
| 189 |
export GCCGO; \ |
| 190 |
CC="$(abs_builddir)/check-gcc"; \ |
| 191 |
export CC; \ |
| 192 |
GCCGOTOOLDIR="$(abs_builddir)"; \ |
| 193 |
export GCCGOTOOLDIR; \ |
| 194 |
GO_TESTING_GOTOOLS=yes; \ |
| 195 |
export GO_TESTING_GOTOOLS; \ |
| 196 |
abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \ |
| 197 |
LD_LIBRARY_PATH=`echo $${abs_libgodir}/.libs:$${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \ |
| 198 |
export LD_LIBRARY_PATH; \ |
| 199 |
GOROOT=$${abs_libgodir}; \ |
| 200 |
export GOROOT; \ |
| 201 |
GOCACHE=$(abs_builddir)/gocache-test; \ |
| 202 |
export GOCACHE; \ |
| 203 |
fl1="FA"; fl2="IL"; fl="$${fl1}$${fl2}"; |
| 204 |
|
| 205 |
# ECHO_ENV is a variant of CHECK_ENV to put into a testlog file. |
| 206 |
# It assumes that abs_libgodir is set. |
| 207 |
ECHO_ENV = PATH=`echo $(abs_builddir):$${PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'` GCCGO='$(abs_builddir)/check-gccgo' CC='$(abs_builddir)/check-gcc' GCCGOTOOLDIR='$(abs_builddir)' GO_TESTING_GOTOOLS=yes LD_LIBRARY_PATH=`echo $${abs_libgodir}/.libs:$${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'` GOROOT=`echo $${abs_libgodir} GOCACHE='$(abs_builddir)/gocache-test'` |
| 208 |
|
| 209 |
# check-go-tool runs `go test cmd/go` in our environment. |
| 210 |
check-go-tool: go$(EXEEXT) $(noinst_PROGRAMS) check-head check-gccgo check-gcc |
| 211 |
if test -d check-go-dir; then chmod -R u+w check-go-dir; fi |
| 212 |
rm -rf check-go-dir cmd_go-testlog |
| 213 |
$(MKDIR_P) check-go-dir/src/cmd/go |
| 214 |
cp $(libgosrcdir)/go.mod check-go-dir/src/ |
| 215 |
cp $(cmdsrcdir)/go.mod check-go-dir/src/cmd/ |
| 216 |
$(MKDIR_P) check-go-dir/src/vendor check-go-dir/src/cmd/vendor |
| 217 |
cp $(libgosrcdir)/vendor/modules.txt check-go-dir/src/vendor/ |
| 218 |
cp $(libgosrcdir)/cmd/vendor/modules.txt check-go-dir/src/cmd/vendor/ |
| 219 |
cp $(cmdsrcdir)/go/*.go check-go-dir/src/cmd/go/ |
| 220 |
cp -r $(cmdsrcdir)/go/internal check-go-dir/src/cmd/go/ |
| 221 |
cp $(libgodir)/zdefaultcc.go check-go-dir/src/cmd/go/internal/cfg/ |
| 222 |
cp -r $(cmdsrcdir)/go/testdata check-go-dir/src/cmd/go/ |
| 223 |
cp -r $(cmdsrcdir)/internal check-go-dir/src/cmd/ |
| 224 |
$(MKDIR_P) check-go-dir/src/cmd/vendor/golang.org/x |
| 225 |
cp -r $(libgosrcdir)/golang.org/x/mod check-go-dir/src/cmd/vendor/golang.org/x/ |
| 226 |
cp -r $(libgosrcdir)/golang.org/x/crypto check-go-dir/src/cmd/vendor/golang.org/x/ |
| 227 |
cp -r $(libgosrcdir)/golang.org/x/xerrors check-go-dir/src/cmd/vendor/golang.org/x/ |
| 228 |
cp -r $(libgosrcdir)/golang.org/x/tools check-go-dir/src/cmd/vendor/golang.org/x/ |
| 229 |
cp $(libgodir)/objabi.go check-go-dir/src/cmd/internal/objabi/ |
| 230 |
@abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \ |
| 231 |
abs_checkdir=`cd check-go-dir && $(PWD_COMMAND)`; \ |
| 232 |
echo "cd check-go-dir/src/cmd/go && $(ECHO_ENV) GOPATH=$${abs_checkdir} $(abs_builddir)/go$(EXEEXT) test -test.short -test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v" > cmd_go-testlog |
| 233 |
$(CHECK_ENV) \ |
| 234 |
GOPATH=`cd check-go-dir && $(PWD_COMMAND)`; \ |
| 235 |
export GOPATH; \ |
| 236 |
(cd check-go-dir/src/cmd/go && $(abs_builddir)/go$(EXEEXT) test -test.short -test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v) >> cmd_go-testlog 2>&1 || echo "--- $${fl}: go test cmd/go (0.00s)" >> cmd_go-testlog |
| 237 |
grep '^--- ' cmd_go-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' | sort -k 2 |
| 238 |
|
| 239 |
# check-runtime runs `go test runtime` in our environment. |
| 240 |
# The runtime package is also tested as part of libgo, |
| 241 |
# but the runtime tests use the go tool heavily, so testing |
| 242 |
# here too will catch more problems. |
| 243 |
check-runtime: go$(EXEEXT) $(noinst_PROGRAMS) check-head check-gccgo check-gcc |
| 244 |
rm -f runtime-testlog |
| 245 |
@abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \ |
| 246 |
LD_LIBRARY_PATH=`echo $${abs_libgodir}/.libs:$${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \ |
| 247 |
export LD_LIBRARY_PATH; \ |
| 248 |
GOARCH=`$(abs_builddir)/go$(EXEEXT) env GOARCH`; \ |
| 249 |
GOOS=`$(abs_builddir)/go$(EXEEXT) env GOOS`; \ |
| 250 |
files=`$(SHELL) $(libgosrcdir)/../match.sh --goarch=$${GOARCH} --goos=$${GOOS} --srcdir=$(libgosrcdir)/runtime --extrafiles="$(libgodir)/runtime_linknames.go $(libgodir)/runtime_sysinfo.go $(libgodir)/sigtab.go $(libgodir)/goroot.go" --tag=libffi`; \ |
| 251 |
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}' $(GOTESTFLAGS) -test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v" > runtime-testlog |
| 252 |
$(CHECK_ENV) \ |
| 253 |
GC="$${GCCGO} -fgo-compiling-runtime"; \ |
| 254 |
export GC; \ |
| 255 |
GOARCH=`$(abs_builddir)/go$(EXEEXT) env GOARCH`; \ |
| 256 |
GOOS=`$(abs_builddir)/go$(EXEEXT) env GOOS`; \ |
| 257 |
files=`$(SHELL) $(libgosrcdir)/../match.sh --goarch=$${GOARCH} --goos=$${GOOS} --srcdir=$(libgosrcdir)/runtime --extrafiles="$(libgodir)/runtime_linknames.go $(libgodir)/runtime_sysinfo.go $(libgodir)/sigtab.go $(libgodir)/goroot.go" --tag=libffi`; \ |
| 258 |
$(SHELL) $(libgosrcdir)/../testsuite/gotest --goarch=$${GOARCH} --goos=$${GOOS} --basedir=$(libgosrcdir)/.. --srcdir=$(libgosrcdir)/runtime --pkgpath=runtime --pkgfiles="$${files}" $(GOTESTFLAGS) -test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v >> runtime-testlog 2>&1 || echo "--- $${fl}: go test runtime (0.00s)" >> runtime-testlog |
| 259 |
grep '^--- ' runtime-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' | sort -k 2 |
| 260 |
|
| 261 |
# check-cgo-test runs `go test` in misc/cgo/test. |
| 262 |
check-cgo-test: go$(EXEEXT) $(noinst_PROGRAMS) check-head check-gccgo check-gcc |
| 263 |
rm -rf cgo-test-dir cgo-testlog |
| 264 |
$(MKDIR_P) cgo-test-dir/misc/cgo |
| 265 |
echo 'module misc' > cgo-test-dir/misc/go.mod |
| 266 |
cp -r $(libgomiscdir)/cgo/test cgo-test-dir/misc/cgo/ |
| 267 |
@abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \ |
| 268 |
echo "cd cgo-test-dir/misc/cgo/test && $(ECHO_ENV) GOTRACEBACK=2 $(abs_builddir)/go$(EXEEXT) test -test.short -test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v" > cgo-testlog |
| 269 |
$(CHECK_ENV) \ |
| 270 |
GOTRACEBACK=2; \ |
| 271 |
export GOTRACEBACK; \ |
| 272 |
(cd cgo-test-dir/misc/cgo/test && $(abs_builddir)/go$(EXEEXT) test -test.short -test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v) >> cgo-testlog 2>&1 || echo "--- $${fl}: go test misc/cgo/test (0.00s)" >> cgo-testlog |
| 273 |
grep '^--- ' cgo-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' | sort -k 2 |
| 274 |
|
| 275 |
# check-carchive-test runs `go test` in misc/cgo/testcarchive. |
| 276 |
# in our environment. |
| 277 |
check-carchive-test: go$(EXEEXT) $(noinst_PROGRAMS) check-head check-gccgo check-gcc |
| 278 |
rm -rf carchive-test-dir carchive-testlog |
| 279 |
$(MKDIR_P) carchive-test-dir/misc/cgo |
| 280 |
echo 'module misc' > carchive-test-dir/misc/go.mod |
| 281 |
cp -r $(libgomiscdir)/cgo/testcarchive carchive-test-dir/misc/cgo/ |
| 282 |
@abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \ |
| 283 |
echo "cd carchive-test-dir/misc/cgo/testcarchive && $(ECHO_ENV) LIBRARY_PATH=`echo $${abs_libgodir}/.libs` $(abs_builddir)/go$(EXEEXT) test -test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v" > carchive-testlog |
| 284 |
$(CHECK_ENV) \ |
| 285 |
LIBRARY_PATH=`echo $${abs_libgodir}/.libs:$${LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \ |
| 286 |
export LIBRARY_PATH; \ |
| 287 |
(cd carchive-test-dir/misc/cgo/testcarchive && $(abs_builddir)/go$(EXEEXT) test -test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v) >> carchive-testlog 2>&1 || echo "--- $${fl}: go test misc/cgo/testcarchive (0.00s)" >> carchive-testlog |
| 288 |
grep '^--- ' carchive-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' | sort -k 2 |
| 289 |
|
| 290 |
# check-vet runs `go test cmd/vet` in our environment. |
| 291 |
check-vet: go$(EXEEXT) $(noinst_PROGRAMS) check-head check-gccgo check-gcc |
| 292 |
rm -rf check-vet-dir cmd_vet-testlog |
| 293 |
$(MKDIR_P) check-vet-dir/src/cmd/internal check-vet-dir/src/cmd/vendor/golang.org/x |
| 294 |
cp $(libgosrcdir)/go.mod check-vet-dir/src/ |
| 295 |
cp $(cmdsrcdir)/go.mod check-vet-dir/src/cmd/ |
| 296 |
$(MKDIR_P) check-vet-dir/src/vendor check-vet-dir/src/cmd/vendor |
| 297 |
cp $(libgosrcdir)/vendor/modules.txt check-vet-dir/src/vendor/ |
| 298 |
cp $(libgosrcdir)/cmd/vendor/modules.txt check-vet-dir/src/cmd/vendor/ |
| 299 |
cp -r $(cmdsrcdir)/vet check-vet-dir/src/cmd/ |
| 300 |
cp -r $(cmdsrcdir)/internal/objabi check-vet-dir/src/cmd/internal |
| 301 |
cp $(libgodir)/objabi.go check-vet-dir/src/cmd/internal/objabi/ |
| 302 |
cp -r $(libgosrcdir)/golang.org/x/tools check-vet-dir/src/cmd/vendor/golang.org/x/ |
| 303 |
@abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \ |
| 304 |
abs_checkdir=`cd check-vet-dir && $(PWD_COMMAND)`; \ |
| 305 |
echo "cd check-vet-dir/src/cmd/vet && $(ECHO_ENV) GOPATH=$${abs_checkdir} $(abs_builddir)/go$(EXEEXT) test -test.short -test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v" > cmd_vet-testlog |
| 306 |
$(CHECK_ENV) \ |
| 307 |
GOPATH=`cd check-vet-dir && $(PWD_COMMAND)`; \ |
| 308 |
export GOPATH; \ |
| 309 |
(cd check-vet-dir/src/cmd/vet && $(abs_builddir)/go$(EXEEXT) test -test.short -test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v) >> cmd_vet-testlog 2>&1 || echo "--- $${fl}: go test cmd/vet (0.00s)" >> cmd_vet-testlog |
| 310 |
grep '^--- ' cmd_vet-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' | sort -k 2 |
| 311 |
|
| 312 |
# check-embed runs `go test embed/internal/embedtest` in our environment. |
| 313 |
check-embed: go$(EXEEXT) $(noinst_PROGRAMS) check-head check-gccgo check-gcc |
| 314 |
rm -rf check-embed-dir embed-testlog |
| 315 |
$(MKDIR_P) check-embed-dir/src/embed/internal |
| 316 |
cp $(libgosrcdir)/go.mod check-embed-dir/src/ |
| 317 |
$(MKDIR_P) check-embed-dir/src/vendor |
| 318 |
cp $(libgosrcdir)/vendor/modules.txt check-embed-dir/src/vendor/ |
| 319 |
cp -r $(libgosrcdir)/embed/internal/embedtest check-embed-dir/src/embed/internal |
| 320 |
@abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \ |
| 321 |
abs_checkdir=`cd check-embed-dir && $(PWD_COMMAND)`; \ |
| 322 |
echo "cd check-embed-dir/src/embed/internal/embedtest && $(ECHO_ENV) GOPATH=$${abs_checkdir} $(abs_builddir)/go$(EXEEXT) test -test.short -test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v" > embed-testlog |
| 323 |
$(CHECK_ENV) \ |
| 324 |
GOPATH=`cd check-embed-dir && $(PWD_COMMAND)`; \ |
| 325 |
export GOPATH; \ |
| 326 |
(cd check-embed-dir/src/embed/internal/embedtest && $(abs_builddir)/go$(EXEEXT) test -test.short -test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v) >> embed-testlog 2>&1 || echo "--- $${fl}: go test embed/internal/embedtest (0.00s)" >> embed-testlog |
| 327 |
grep '^--- ' embed-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' | sort -k 2 |
| 328 |
|
| 329 |
# The check targets runs the tests and assembles the output files. |
| 330 |
check: check-head check-go-tool check-runtime check-cgo-test check-carchive-test check-vet check-embed |
| 331 |
@mv gotools.head gotools.sum |
| 332 |
@cp gotools.sum gotools.log |
| 333 |
@for file in cmd_go-testlog runtime-testlog cgo-testlog carchive-testlog cmd_vet-testlog embed-testlog; do \ |
| 334 |
testname=`echo $${file} | sed -e 's/-testlog//' -e 's|_|/|'`; \ |
| 335 |
echo "Running $${testname} ..." >> gotools.sum; \ |
| 336 |
echo "Running $${testname} ..." >> gotools.log; \ |
| 337 |
sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' < $${file} >> gotools.log; \ |
| 338 |
grep '^--- ' $${file} | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' -e 's/SKIP/UNTESTED/' | sort -k 2 >> gotools.sum; \ |
| 339 |
done |
| 340 |
@echo >> gotools.sum |
| 341 |
@echo " === gotools Summary ===" >> gotools.sum |
| 342 |
@pass=`grep -c '^PASS' gotools.sum`; \ |
| 343 |
if test "$${pass}" -ne "0"; then \ |
| 344 |
echo "# of expected passes $${pass}" >> gotools.sum; \ |
| 345 |
fi |
| 346 |
@fail=`grep -c '^FAIL' gotools.sum`; \ |
| 347 |
if test "$${fail}" -ne "0"; then \ |
| 348 |
echo "# of unexpected failures $${fail}" >> gotools.sum; \ |
| 349 |
fi |
| 350 |
@untested=`grep -c '^UNTESTED' gotools.sum`; \ |
| 351 |
if test "$${untested}" -ne "0"; then \ |
| 352 |
echo "# of untested testcases $${untested}" >> gotools.sum; \ |
| 353 |
fi |
| 354 |
@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 |
| 355 |
@echo >> gotools.log |
| 356 |
@echo "runtest completed at `date`" >> gotools.log |
| 357 |
@if grep '^FAIL' gotools.sum >/dev/null 2>&1; then exit 1; fi |
| 358 |
|
| 359 |
.PHONY: check check-head check-go-tool check-runtime check-cgo-test |
| 360 |
.PHONY: check-carchive-test check-vet check-embed |
| 361 |
|
| 362 |
else |
| 363 |
|
| 364 |
# For a non-native build we have to build the programs using a |
| 365 |
# previously built host (or build -> host) Go compiler. We should |
| 366 |
# only do this if such a compiler is available. We also need to get |
| 367 |
# the right values for GOARCH and GOOS in the default build context in |
| 368 |
# the go/build package. Figure this out later. |
| 369 |
install-exec-local: |
| 370 |
uninstall-local: |
| 371 |
|
| 372 |
endif |