]>
Commit | Line | Data |
---|---|---|
dcfe52b6 | 1 | # Makefile for gotools |
6f8b1fff | 2 | # Copyright (C) 2015-2016 Free Software Foundation, Inc. |
dcfe52b6 | 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 | ||
f00f02a3 | 18 | ACLOCAL_AMFLAGS = -I ../config |
dcfe52b6 | 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 | ||
e104cab8 | 31 | LIBGOTOOL = $(libgodir)/libgotool.a |
32 | ||
ff5b9b4f | 33 | if NATIVE |
34 | # Use the compiler we just built. | |
877f47a9 | 35 | GOCOMPILER = $(GOC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) |
ff5b9b4f | 36 | else |
37 | GOCOMPILER = $(GOC) | |
38 | endif | |
39 | ||
dcfe52b6 | 40 | GOCFLAGS = $(CFLAGS_FOR_TARGET) |
ff5b9b4f | 41 | GOCOMPILE = $(GOCOMPILER) $(GOCFLAGS) |
dcfe52b6 | 42 | |
7f2f4625 | 43 | AM_GOCFLAGS = -I $(libgodir) |
bb11842d | 44 | AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs |
9176c716 | 45 | GOLINK = $(GOCOMPILER) $(GOCFLAGS) $(AM_GOCFLAGS) $(LDFLAGS) $(AM_LDFLAGS) -o $@ |
dcfe52b6 | 46 | |
6009a592 | 47 | libgosrcdir = $(srcdir)/../libgo/go |
48 | cmdsrcdir = $(libgosrcdir)/cmd | |
fa9acbba | 49 | libgomiscdir = $(srcdir)/../libgo/misc |
dcfe52b6 | 50 | |
51 | go_cmd_go_files = \ | |
05e45616 | 52 | $(cmdsrcdir)/go/alldocs.go \ |
dcfe52b6 | 53 | $(cmdsrcdir)/go/go11.go \ |
e104cab8 | 54 | $(cmdsrcdir)/go/main.go |
dcfe52b6 | 55 | |
56 | go_cmd_gofmt_files = \ | |
57 | $(cmdsrcdir)/gofmt/doc.go \ | |
58 | $(cmdsrcdir)/gofmt/gofmt.go \ | |
0694cef2 | 59 | $(cmdsrcdir)/gofmt/internal.go \ |
dcfe52b6 | 60 | $(cmdsrcdir)/gofmt/rewrite.go \ |
61 | $(cmdsrcdir)/gofmt/simplify.go | |
62 | ||
63 | go_cmd_cgo_files = \ | |
64 | $(cmdsrcdir)/cgo/ast.go \ | |
65 | $(cmdsrcdir)/cgo/doc.go \ | |
66 | $(cmdsrcdir)/cgo/gcc.go \ | |
67 | $(cmdsrcdir)/cgo/godefs.go \ | |
68 | $(cmdsrcdir)/cgo/main.go \ | |
69 | $(cmdsrcdir)/cgo/out.go \ | |
70 | $(cmdsrcdir)/cgo/util.go | |
71 | ||
33d1d391 | 72 | go_cmd_vet_files = \ |
33d1d391 | 73 | $(cmdsrcdir)/vet/doc.go \ |
31975c5e | 74 | $(cmdsrcdir)/vet/main.go |
33d1d391 | 75 | |
76 | go_cmd_buildid_files = \ | |
77 | $(cmdsrcdir)/buildid/buildid.go \ | |
78 | $(cmdsrcdir)/buildid/doc.go | |
79 | ||
80 | go_cmd_test2json_files = \ | |
81 | $(cmdsrcdir)/test2json/main.go | |
82 | ||
dcfe52b6 | 83 | GCCGO_INSTALL_NAME := $(shell echo gccgo|sed '$(program_transform_name)') |
84 | GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)') | |
85 | GXX_INSTALL_NAME := $(shell echo g++|sed '$(program_transform_name)') | |
86 | ||
87 | zdefaultcc.go: s-zdefaultcc; @true | |
88 | s-zdefaultcc: Makefile | |
89 | echo 'package main' > zdefaultcc.go.tmp | |
33d1d391 | 90 | echo 'func defaultGCCGO(goos, goarch string) string { return "$(bindir)/$(GCCGO_INSTALL_NAME)" }' >> zdefaultcc.go.tmp |
91 | echo 'func defaultCC(goos, goarch string) string { return "$(GCC_INSTALL_NAME)" }' >> zdefaultcc.go.tmp | |
92 | echo 'func defaultCXX(goos, goarch string) string { return "$(GXX_INSTALL_NAME)" }' >> zdefaultcc.go.tmp | |
ccea2b36 | 93 | echo 'const defaultPkgConfig = "pkg-config"' >> zdefaultcc.go.tmp |
dcfe52b6 | 94 | $(SHELL) $(srcdir)/../move-if-change zdefaultcc.go.tmp zdefaultcc.go |
95 | $(STAMP) $@ | |
96 | ||
fa9acbba | 97 | MOSTLYCLEANFILES = \ |
98 | zdefaultcc.go s-zdefaultcc \ | |
d273b446 | 99 | check-gccgo check-gcc gotools.head *-testlog gotools.sum gotools.log \ |
100 | *.sent | |
fa9acbba | 101 | |
102 | mostlyclean-local: | |
60d22d0d | 103 | if test -d check-go-dir; then chmod -R u+w check-go-dir; fi |
104 | rm -rf check-go-dir check-runtime-dir cgo-test-dir carchive-test-dir \ | |
105 | check-vet-dir gocache-test | |
ff5b9b4f | 106 | |
dcfe52b6 | 107 | if NATIVE |
108 | ||
109 | # For a native build we build the programs using the newly built libgo | |
110 | # and install them as regular programs. | |
111 | ||
112 | bin_PROGRAMS = go$(EXEEXT) gofmt$(EXEEXT) | |
33d1d391 | 113 | noinst_PROGRAMS = cgo$(EXEEXT) vet$(EXEEXT) buildid$(EXEEXT) test2json$(EXEEXT) |
0d0ad5e6 | 114 | man_MANS = go.1 gofmt.1 |
dcfe52b6 | 115 | |
e104cab8 | 116 | go$(EXEEXT): $(go_cmd_go_files) $(LIBGOTOOL) $(LIBGODEP) |
117 | $(GOLINK) $(go_cmd_go_files) $(LIBGOTOOL) $(LIBS) $(NET_LIBS) | |
dcfe52b6 | 118 | gofmt$(EXEEXT): $(go_cmd_gofmt_files) $(LIBGODEP) |
b7450aac | 119 | $(GOLINK) $(go_cmd_gofmt_files) $(LIBS) $(NET_LIBS) |
33d1d391 | 120 | cgo$(EXEEXT): $(go_cmd_cgo_files) zdefaultcc.go $(LIBGOTOOL) $(LIBGODEP) |
121 | $(GOLINK) $(go_cmd_cgo_files) zdefaultcc.go $(LIBGOTOOL) $(LIBS) $(NET_LIBS) | |
122 | vet$(EXEEXT): $(go_cmd_vet_files) $(LIBGOTOOL) $(LIBGODEP) | |
123 | $(GOLINK) $(go_cmd_vet_files) $(LIBGOTOOL) $(LIBS) $(NET_LIBS) | |
124 | buildid$(EXEEXT): $(go_cmd_buildid_files) $(LIBGOTOOL) $(LIBGODEP) | |
125 | $(GOLINK) $(go_cmd_buildid_files) $(LIBGOTOOL) $(LIBS) $(NET_LIBS) | |
126 | test2json$(EXEEXT): $(go_cmd_test2json_files) $(LIBGOTOOL) $(LIBGODEP) | |
127 | $(GOLINK) $(go_cmd_test2json_files) $(LIBGOTOOL) $(LIBS) $(NET_LIBS) | |
128 | ||
129 | install-exec-local: $(noinst_PROGRAMS) | |
b2fa8650 | 130 | $(MKDIR_P) $(DESTDIR)$(libexecsubdir) |
33d1d391 | 131 | for f in $(noinst_PROGRAMS); do \ |
132 | rm -f $(DESTDIR)$(libexecsubdir)/$$f; \ | |
133 | $(INSTALL_PROGRAM) $$f $(DESTDIR)$(libexecsubdir)/$$f; \ | |
134 | done | |
b2fa8650 | 135 | |
136 | uninstall-local: | |
33d1d391 | 137 | for f in $(noinst_PROGRAMS); do \ |
138 | rm -f $(DESTDIR)$(libexecsubdir)/$$f; \ | |
139 | done | |
b2fa8650 | 140 | |
3c03bb8b | 141 | GOTESTFLAGS = |
142 | ||
1817a7d9 | 143 | # Number of seconds before tests time out. |
38a9458e | 144 | GOTOOLS_TEST_TIMEOUT = 1200 |
1817a7d9 | 145 | |
6009a592 | 146 | # Run tests using the go tool, and frob the output to look like that |
147 | # generated by DejaGNU. The main output of this is two files: | |
148 | # gotools.sum and gotools.log. | |
149 | ||
150 | # check-head starts generating the log files in DejaGNU format. This | |
151 | # is a separate target so that the date is approximately when we start | |
152 | # running the tests. | |
153 | check-head: | |
154 | @echo "Test Run By $${USER} on `date`" > gotools.head | |
155 | @echo "Native configuration is $(host_triplet)" >> gotools.head | |
156 | @echo >> gotools.head | |
157 | @echo " === gotools tests ===" >> gotools.head | |
158 | @echo >> gotools.head | |
159 | ||
160 | # check-gccgo is a little shell script that executes gccgo with the | |
f90e86cf | 161 | # options to pick up the newly built libgo and libstdc++. |
6009a592 | 162 | check-gccgo: Makefile |
d273b446 | 163 | rm -f $@ $@.tmp |
164 | echo "#!/bin/sh" > $@.tmp | |
6009a592 | 165 | abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \ |
f90e86cf | 166 | 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" >> $@.tmp |
d273b446 | 167 | chmod +x $@.tmp |
168 | mv -f $@.tmp $@ | |
169 | ||
170 | # check-gcc is a little shell script that executes the newly built gcc | |
f90e86cf | 171 | # with the options to pick up the newly built libgo and libstdc++. |
d273b446 | 172 | check-gcc: Makefile |
173 | rm -f $@ $@.tmp | |
174 | echo "#!/bin/sh" > $@.tmp | |
175 | abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \ | |
f90e86cf | 176 | 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" >> $@.tmp |
d273b446 | 177 | chmod +x $@.tmp |
178 | mv -f $@.tmp $@ | |
6009a592 | 179 | |
180 | # CHECK_ENV sets up the environment to run the newly built go tool. | |
fa9acbba | 181 | # If you change this, change ECHO_ENV, below. |
e104cab8 | 182 | # The fl shell variable is used to avoid having FAIL appear |
183 | # in the log unnecessarily. | |
6009a592 | 184 | CHECK_ENV = \ |
185 | PATH=`echo $(abs_builddir):$${PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \ | |
186 | export PATH; \ | |
187 | GCCGO="$(abs_builddir)/check-gccgo"; \ | |
188 | export GCCGO; \ | |
d273b446 | 189 | CC="$(abs_builddir)/check-gcc"; \ |
190 | export CC; \ | |
6009a592 | 191 | GCCGOTOOLDIR="$(abs_builddir)"; \ |
192 | export GCCGOTOOLDIR; \ | |
193 | GO_TESTING_GOTOOLS=yes; \ | |
194 | export GO_TESTING_GOTOOLS; \ | |
195 | abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \ | |
196 | LD_LIBRARY_PATH=`echo $${abs_libgodir}/.libs:$${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \ | |
74e30175 | 197 | export LD_LIBRARY_PATH; \ |
198 | GOROOT=$${abs_libgodir}; \ | |
e104cab8 | 199 | export GOROOT; \ |
266ba37f | 200 | GOCACHE=$(abs_builddir)/gocache-test; \ |
201 | export GOCACHE; \ | |
e104cab8 | 202 | fl1="FA"; fl2="IL"; fl="$${fl1}$${fl2}"; |
6009a592 | 203 | |
fa9acbba | 204 | # ECHO_ENV is a variant of CHECK_ENV to put into a testlog file. |
205 | # It assumes that abs_libgodir is set. | |
266ba37f | 206 | 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'` |
fa9acbba | 207 | |
33d1d391 | 208 | # check-go-tool runs `go test cmd/go` in our environment. |
209 | check-go-tool: go$(EXEEXT) $(noinst_PROGRAMS) check-head check-gccgo check-gcc | |
02180879 | 210 | if test -d check-go-dir; then chmod -R u+w check-go-dir; fi |
fa9acbba | 211 | rm -rf check-go-dir cmd_go-testlog |
6009a592 | 212 | $(MKDIR_P) check-go-dir/src/cmd/go |
213 | cp $(cmdsrcdir)/go/*.go check-go-dir/src/cmd/go/ | |
e104cab8 | 214 | cp -r $(cmdsrcdir)/go/internal check-go-dir/src/cmd/go/ |
e104cab8 | 215 | cp $(libgodir)/zdefaultcc.go check-go-dir/src/cmd/go/internal/cfg/ |
6009a592 | 216 | cp -r $(cmdsrcdir)/go/testdata check-go-dir/src/cmd/go/ |
e104cab8 | 217 | cp -r $(cmdsrcdir)/internal check-go-dir/src/cmd/ |
33d1d391 | 218 | cp $(libgodir)/objabi.go check-go-dir/src/cmd/internal/objabi/ |
fa9acbba | 219 | @abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \ |
220 | abs_checkdir=`cd check-go-dir && $(PWD_COMMAND)`; \ | |
1817a7d9 | 221 | 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 |
6009a592 | 222 | $(CHECK_ENV) \ |
223 | GOPATH=`cd check-go-dir && $(PWD_COMMAND)`; \ | |
224 | export GOPATH; \ | |
1817a7d9 | 225 | (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 |
3c03bb8b | 226 | grep '^--- ' cmd_go-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' | sort -k 2 |
6009a592 | 227 | |
fa9acbba | 228 | # check-runtime runs `go test runtime` in our environment. |
229 | # The runtime package is also tested as part of libgo, | |
230 | # but the runtime tests use the go tool heavily, so testing | |
231 | # here too will catch more problems. | |
33d1d391 | 232 | check-runtime: go$(EXEEXT) $(noinst_PROGRAMS) check-head check-gccgo check-gcc |
fa9acbba | 233 | rm -rf check-runtime-dir runtime-testlog |
234 | $(MKDIR_P) check-runtime-dir | |
235 | @abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \ | |
236 | LD_LIBRARY_PATH=`echo $${abs_libgodir}/.libs:$${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \ | |
31975c5e | 237 | export LD_LIBRARY_PATH; \ |
fa9acbba | 238 | GOARCH=`$(abs_builddir)/go$(EXEEXT) env GOARCH`; \ |
239 | GOOS=`$(abs_builddir)/go$(EXEEXT) env GOOS`; \ | |
240 | files=`$(SHELL) $(libgosrcdir)/../match.sh --goarch=$${GOARCH} --goos=$${GOOS} --srcdir=$(libgosrcdir)/runtime --extrafiles="$(libgodir)/runtime_sysinfo.go $(libgodir)/sigtab.go" --tag=libffi`; \ | |
d4035a37 | 241 | 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 |
fa9acbba | 242 | $(CHECK_ENV) \ |
243 | GC="$${GCCGO} -fgo-compiling-runtime"; \ | |
244 | export GC; \ | |
245 | GOARCH=`$(abs_builddir)/go$(EXEEXT) env GOARCH`; \ | |
246 | GOOS=`$(abs_builddir)/go$(EXEEXT) env GOOS`; \ | |
247 | files=`$(SHELL) $(libgosrcdir)/../match.sh --goarch=$${GOARCH} --goos=$${GOOS} --srcdir=$(libgosrcdir)/runtime --extrafiles="$(libgodir)/runtime_sysinfo.go $(libgodir)/sigtab.go" --tag=libffi`; \ | |
d4035a37 | 248 | $(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 |
3c03bb8b | 249 | grep '^--- ' runtime-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' | sort -k 2 |
fa9acbba | 250 | |
251 | # check-cgo-test runs `go test misc/cgo/test` in our environment. | |
33d1d391 | 252 | check-cgo-test: go$(EXEEXT) $(noinst_PROGRAMS) check-head check-gccgo check-gcc |
fa9acbba | 253 | rm -rf cgo-test-dir cgo-testlog |
254 | $(MKDIR_P) cgo-test-dir/misc/cgo | |
255 | cp -r $(libgomiscdir)/cgo/test cgo-test-dir/misc/cgo/ | |
256 | @abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \ | |
1817a7d9 | 257 | 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 |
fa9acbba | 258 | $(CHECK_ENV) \ |
259 | GOTRACEBACK=2; \ | |
260 | export GOTRACEBACK; \ | |
1817a7d9 | 261 | (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 |
3c03bb8b | 262 | grep '^--- ' cgo-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' | sort -k 2 |
fa9acbba | 263 | |
264 | # check-carchive-test runs `go test misc/cgo/testcarchive/carchive_test.go` | |
265 | # in our environment. | |
33d1d391 | 266 | check-carchive-test: go$(EXEEXT) $(noinst_PROGRAMS) check-head check-gccgo check-gcc |
fa9acbba | 267 | rm -rf carchive-test-dir carchive-testlog |
268 | $(MKDIR_P) carchive-test-dir/misc/cgo | |
269 | cp -r $(libgomiscdir)/cgo/testcarchive carchive-test-dir/misc/cgo/ | |
270 | @abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \ | |
1817a7d9 | 271 | 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_test.go" > carchive-testlog |
fa9acbba | 272 | $(CHECK_ENV) \ |
273 | LIBRARY_PATH=`echo $${abs_libgodir}/.libs:$${LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \ | |
274 | export LIBRARY_PATH; \ | |
1817a7d9 | 275 | (cd carchive-test-dir/misc/cgo/testcarchive && $(abs_builddir)/go$(EXEEXT) test -test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v carchive_test.go) >> carchive-testlog 2>&1 || echo "--- $${fl}: go test misc/cgo/testcarchive (0.00s)" >> carchive-testlog |
3c03bb8b | 276 | grep '^--- ' carchive-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' | sort -k 2 |
fa9acbba | 277 | |
33d1d391 | 278 | # check-vet runs `go test cmd/vet` in our environment. |
279 | check-vet: go$(EXEEXT) $(noinst_PROGRAMS) check-head check-gccgo check-gcc | |
280 | rm -rf check-vet-dir cmd_vet-testlog | |
31975c5e | 281 | $(MKDIR_P) check-vet-dir/src/cmd/internal check-vet-dir/src/cmd/vendor/golang.org/x |
33d1d391 | 282 | cp -r $(cmdsrcdir)/vet check-vet-dir/src/cmd/ |
b0751b12 | 283 | cp -r $(cmdsrcdir)/internal/objabi check-vet-dir/src/cmd/internal |
284 | cp $(libgodir)/objabi.go check-vet-dir/src/cmd/internal/objabi/ | |
31975c5e | 285 | cp -r $(libgosrcdir)/golang.org/x/tools check-vet-dir/src/cmd/vendor/golang.org/x/ |
33d1d391 | 286 | @abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \ |
287 | abs_checkdir=`cd check-vet-dir && $(PWD_COMMAND)`; \ | |
1817a7d9 | 288 | 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 |
33d1d391 | 289 | $(CHECK_ENV) \ |
290 | GOPATH=`cd check-vet-dir && $(PWD_COMMAND)`; \ | |
291 | export GOPATH; \ | |
1817a7d9 | 292 | (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 |
33d1d391 | 293 | grep '^--- ' cmd_vet-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' | sort -k 2 |
294 | ||
6009a592 | 295 | # The check targets runs the tests and assembles the output files. |
33d1d391 | 296 | check: check-head check-go-tool check-runtime check-cgo-test check-carchive-test check-vet |
fa9acbba | 297 | @mv gotools.head gotools.sum |
298 | @cp gotools.sum gotools.log | |
33d1d391 | 299 | @for file in cmd_go-testlog runtime-testlog cgo-testlog carchive-testlog cmd_vet-testlog; do \ |
6009a592 | 300 | testname=`echo $${file} | sed -e 's/-testlog//' -e 's|_|/|'`; \ |
301 | echo "Running $${testname}" >> gotools.sum; \ | |
302 | echo "Running $${testname}" >> gotools.log; \ | |
303 | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' < $${file} >> gotools.log; \ | |
3c03bb8b | 304 | grep '^--- ' $${file} | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' -e 's/SKIP/UNTESTED/' | sort -k 2 >> gotools.sum; \ |
6009a592 | 305 | done |
306 | @echo >> gotools.sum | |
307 | @echo " === gotools Summary ===" >> gotools.sum | |
fa9acbba | 308 | @pass=`grep -c '^PASS' gotools.sum`; \ |
6009a592 | 309 | if test "$${pass}" -ne "0"; then \ |
310 | echo "# of expected passes $${pass}" >> gotools.sum; \ | |
311 | fi | |
fa9acbba | 312 | @fail=`grep -c '^FAIL' gotools.sum`; \ |
6009a592 | 313 | if test "$${fail}" -ne "0"; then \ |
314 | echo "# of unexpected failures $${fail}" >> gotools.sum; \ | |
315 | fi | |
fa9acbba | 316 | @untested=`grep -c '^UNTESTED' gotools.sum`; \ |
6009a592 | 317 | if test "$${untested}" -ne "0"; then \ |
318 | echo "# of untested testcases $${untested}" >> gotools.sum; \ | |
319 | fi | |
fa9acbba | 320 | @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 |
321 | @echo >> gotools.log | |
322 | @echo "runtest completed at `date`" >> gotools.log | |
323 | @if grep '^FAIL' gotools.sum >/dev/null 2>&1; then exit 1; fi | |
6009a592 | 324 | |
33d1d391 | 325 | .PHONY: check check-head check-go-tool check-runtime check-cgo-test check-carchive-test check-vet |
6009a592 | 326 | |
dcfe52b6 | 327 | else |
328 | ||
329 | # For a non-native build we have to build the programs using a | |
330 | # previously built host (or build -> host) Go compiler. We should | |
331 | # only do this if such a compiler is available. We also need to get | |
332 | # the right values for GOARCH and GOOS in the default build context in | |
333 | # the go/build package. Figure this out later. | |
334 | ||
335 | endif |