1 | # Copyright 2019 The CCGO Authors. All rights reserved.
|
---|
2 | # Use of this source code is governed by a BSD-style
|
---|
3 | # license that can be found in the LICENSE file.
|
---|
4 |
|
---|
5 | .PHONY: all bench clean cover cpu editor internalError later mem nuke todo edit devbench
|
---|
6 |
|
---|
7 | grep=--include=*.go
|
---|
8 | ngrep='TODOOK\|internalError\|testdata'
|
---|
9 | testlog=testdata/testlog-$(shell echo $$GOOS)-$(shell echo $$GOARCH)-on-$(shell go env GOOS)-$(shell go env GOARCH)
|
---|
10 |
|
---|
11 | all:
|
---|
12 | LC_ALL=C make all_log 2>&1 | tee log
|
---|
13 |
|
---|
14 | all_log:
|
---|
15 | date
|
---|
16 | go version
|
---|
17 | uname -a
|
---|
18 | ./unconvert.sh
|
---|
19 | gofmt -l -s -w *.go
|
---|
20 | GOOS=darwin GOARCH=amd64 go build -o /dev/null
|
---|
21 | GOOS=linux GOARCH=386 go build -o /dev/null
|
---|
22 | GOOS=linux GOARCH=amd64 go build -o /dev/null
|
---|
23 | GOOS=linux GOARCH=arm go build -o /dev/null
|
---|
24 | GOOS=windows GOARCH=386 go build -o /dev/null
|
---|
25 | GOOS=windows GOARCH=amd64 go build -o /dev/null
|
---|
26 | go vet 2>&1 | grep -v $(ngrep) || true
|
---|
27 | golint 2>&1 | grep -v $(ngrep) || true
|
---|
28 | make todo
|
---|
29 | misspell *.go
|
---|
30 | staticcheck | grep -v 'lexer\.go' || true
|
---|
31 | maligned || true
|
---|
32 | grep -n 'files.*, ok' log
|
---|
33 | @grep -n --color=never 'FAIL\|PASS' log
|
---|
34 | @grep -n --color=always 'FAIL' log
|
---|
35 | grep -n --color=always 'nil pointer' log
|
---|
36 | grep -c 'exit status 1' log || true
|
---|
37 | grep -c 'exit status 2' log || true
|
---|
38 | LC_ALL=C date 2>&1 | tee -a log
|
---|
39 |
|
---|
40 | test:
|
---|
41 | LC_ALL=C make test_log 2>&1 | tee $(testlog)
|
---|
42 | grep -ni --color=always fail $(testlog) || true
|
---|
43 |
|
---|
44 | test_log:
|
---|
45 | go version
|
---|
46 | uname -a
|
---|
47 | go test -v -timeout 24h
|
---|
48 | date | tee -a $(testlog)
|
---|
49 |
|
---|
50 | test_linux_amd64:
|
---|
51 | GOOS=linux GOARCH=amd64 make test
|
---|
52 |
|
---|
53 | test_linux_386:
|
---|
54 | GOOS=linux GOARCH=386 make test
|
---|
55 |
|
---|
56 | test_linux_arm:
|
---|
57 | GOOS=linux GOARCH=arm make test
|
---|
58 |
|
---|
59 | test_linux_arm64:
|
---|
60 | GOOS=linux GOARCH=arm64 make test
|
---|
61 |
|
---|
62 | test_windows_386:
|
---|
63 | go version | tee %TEMP%\testlog-windows-386
|
---|
64 | go test -v -timeout 24h | tee -a %TEMP%\testlog-windows-386
|
---|
65 | date /T | tee -a %TEMP%\testlog-windows-386
|
---|
66 | time /T | tee -a %TEMP%\testlog-windows-386
|
---|
67 |
|
---|
68 | test_windows_amd64:
|
---|
69 | go version | tee %TEMP%\testlog-windows-amd64
|
---|
70 | go test -v -timeout 24h | tee -a %TEMP%\testlog-windows-amd64
|
---|
71 | date /T | tee -a %TEMP%\testlog-windows-amd64
|
---|
72 | time /T | tee -a %TEMP%\testlog-windows-amd64
|
---|
73 |
|
---|
74 | build_all_targets:
|
---|
75 | GOOS=darwin GOARCH=amd64 go test -c -o /dev/null
|
---|
76 | GOOS=darwin GOARCH=arm64 go test -c -o /dev/null
|
---|
77 | GOOS=freebsd GOARCH=386 go test -c -o /dev/null
|
---|
78 | GOOS=freebsd GOARCH=amd64 go test -c -o /dev/null
|
---|
79 | GOOS=freebsd GOARCH=arm go test -c -o /dev/null
|
---|
80 | GOOS=linux GOARCH=386 go test -c -o /dev/null
|
---|
81 | GOOS=linux GOARCH=amd64 go test -c -o /dev/null
|
---|
82 | GOOS=linux GOARCH=arm go test -c -o /dev/null
|
---|
83 | GOOS=linux GOARCH=arm64 go test -c -o /dev/null
|
---|
84 | GOOS=linux GOARCH=riscv64 go test -c -o /dev/null
|
---|
85 | GOOS=linux GOARCH=s390x go test -c -o /dev/null
|
---|
86 | GOOS=netbsd GOARCH=amd64 go test -c -o /dev/null
|
---|
87 | #TODO GOOS=netbsd GOARCH=arm go test -c -o /dev/null
|
---|
88 | GOOS=openbsd GOARCH=amd64 go test -c -o /dev/null
|
---|
89 | GOOS=openbsd GOARCH=arm64 go test -c -o /dev/null
|
---|
90 | GOOS=windows GOARCH=386 go test -c -o /dev/null
|
---|
91 | GOOS=windows GOARCH=amd64 go test -c -o /dev/null
|
---|
92 | GOOS=windows GOARCH=arm64 go test -c -o /dev/null
|
---|
93 |
|
---|
94 | devbench:
|
---|
95 | date 2>&1 | tee log-devbench
|
---|
96 | go test -timeout 24h -dev -run @ -bench . 2>&1 | tee -a log-devbench
|
---|
97 | grep -n 'FAIL\|SKIP' log-devbench || true
|
---|
98 |
|
---|
99 | bench:
|
---|
100 | date 2>&1 | tee log-bench
|
---|
101 | go test -timeout 24h -v -run '^[^E]' -bench . 2>&1 | tee -a log-bench
|
---|
102 | grep -n 'FAIL\|SKIP' log-bench || true
|
---|
103 |
|
---|
104 | clean:
|
---|
105 | go clean
|
---|
106 | rm -f *~ *.test *.out
|
---|
107 |
|
---|
108 | cover:
|
---|
109 | t=$(shell mktemp) ; go test -coverprofile $$t && go tool cover -html $$t && unlink $$t
|
---|
110 |
|
---|
111 | cpu: clean
|
---|
112 | go test -run @ -bench . -cpuprofile cpu.out
|
---|
113 | go tool pprof -lines *.test cpu.out
|
---|
114 |
|
---|
115 | edit:
|
---|
116 | @touch log
|
---|
117 | @if [ -f "Session.vim" ]; then gvim -S & else gvim -p Makefile *.go & fi
|
---|
118 |
|
---|
119 |
|
---|
120 | editor:
|
---|
121 | gofmt -l -s -w *.go
|
---|
122 | go build -v -o $(GOPATH)/bin/ccgo3 modernc.org/ccgo/v3
|
---|
123 | go test -c -o /dev/null
|
---|
124 |
|
---|
125 | later:
|
---|
126 | @grep -n $(grep) LATER * || true
|
---|
127 | @grep -n $(grep) MAYBE * || true
|
---|
128 |
|
---|
129 | mem: clean
|
---|
130 | go test -run Mem -mem -memprofile mem.out -timeout 24h
|
---|
131 | go tool pprof -lines -web -alloc_space *.test mem.out
|
---|
132 |
|
---|
133 | nuke: clean
|
---|
134 | go clean -i
|
---|
135 |
|
---|
136 | todo:
|
---|
137 | @grep -nr $(grep) ^[[:space:]]*_[[:space:]]*=[[:space:]][[:alpha:]][[:alnum:]]* * | grep -v $(ngrep) || true
|
---|
138 | @grep -nr $(grep) 'TODO\|panic' * | grep -v $(ngrep) || true
|
---|
139 | @grep -nr $(grep) BUG * | grep -v $(ngrep) || true
|
---|
140 | @grep -nr $(grep) [^[:alpha:]]println * | grep -v $(ngrep) || true
|
---|
141 | @grep -nir $(grep) 'work.*progress' || true
|
---|