Makefile (8106B)
1 # Copyright 2017 The Sqlite 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 clean cover cpu editor internalError later mem nuke todo edit tcl extraquick full tidy uncomment unconvert 6 7 grep=--include=*.go --include=*.l --include=*.y --include=*.yy 8 ngrep='TODOOK\|internal\/vfs\|internal\/bin\|internal\/mptest\|.*stringer.*\.go' 9 host=$(shell go env GOOS)-$(shell go env GOARCH) 10 testlog=testdata/testlog-$(shell echo $$GOOS)-$(shell echo $$GOARCH)$(shell echo $$SQLITE_TEST_SUFFIX) 11 12 all: editor 13 date 14 go version 2>&1 | tee log 15 ./unconvert.sh 16 gofmt -l -s -w *.go 17 go test -i 18 go test -v 2>&1 -timeout 24h | tee -a log 19 go run speedtest1/main_$(shell go env GOOS)_$(shell go env GOARCH).go 20 golint 2>&1 | grep -v $(ngrep) || true 21 misspell *.go 22 staticcheck || true 23 maligned || true 24 git diff --unified=0 testdata *.golden 25 grep -n --color=always 'FAIL\|PASS' log 26 go version 27 date 2>&1 | tee -a log 28 29 # $ go install modernc.org/uncomment@latest 30 uncomment: 31 uncomment -v -gofmt libtest/sqlite*.go internal/mptest/main*.go internal/testfixture/testfixture*.go speedtest1/main*.go vfs/vfs*.go 32 uncomment -v -gofmt -keep-godoc lib/sqlite*.go 33 34 # $ go install github.com/mdempsky/unconvert@latest 35 unconvert: 36 ./unconvert.sh && echo ok || echo fail 37 38 tidy: uncomment unconvert 39 gofmt -l -s -w . 40 41 build_all_targets: 42 GOOS=darwin GOARCH=amd64 go test -c -o /dev/null 43 GOOS=darwin GOARCH=arm64 go test -c -o /dev/null 44 GOOS=freebsd GOARCH=amd64 go test -c -o /dev/null 45 GOOS=freebsd GOARCH=386 go test -c -o /dev/null 46 GOOS=freebsd GOARCH=arm go test -c -o /dev/null 47 GOOS=freebsd GOARCH=arm64 go test -c -o /dev/null 48 GOOS=linux GOARCH=386 go test -c -o /dev/null 49 GOOS=linux GOARCH=amd64 go test -c -o /dev/null 50 GOOS=linux GOARCH=arm go test -c -o /dev/null 51 GOOS=linux GOARCH=arm64 go test -c -o /dev/null 52 GOOS=linux GOARCH=ppc64le go test -c -o /dev/null 53 GOOS=linux GOARCH=riscv64 go test -c -o /dev/null 54 GOOS=linux GOARCH=s390x go test -c -o /dev/null 55 GOOS=netbsd GOARCH=amd64 go test -c -o /dev/null 56 GOOS=openbsd GOARCH=amd64 go test -c -o /dev/null 57 GOOS=openbsd GOARCH=arm64 go test -c -o /dev/null 58 # GOOS=windows GOARCH=386 go test -c -o /dev/null 59 GOOS=windows GOARCH=amd64 go test -c -o /dev/null 60 GOOS=windows GOARCH=arm64 go test -c -o /dev/null 61 echo done 62 63 # 3900x 64 windows_amd64: 65 @echo "Should be executed only on linux/amd64." 66 CCGO_CPP=x86_64-w64-mingw32-cpp TARGET_GOOS=windows TARGET_GOARCH=amd64 go generate 2>&1 | tee log-generate 67 GOOS=windows GOARCH=amd64 go test -c -o /dev/null 68 69 windows_arm64: 70 go run addport.go windows_amd64 windows_arm64 71 GOOS=windows GOARCH=arm64 go test -c -o /dev/null 72 73 # 3900x 74 windows_386: 75 @echo "Should be executed only on linux/amd64." 76 CCGO_CPP=i686-w64-mingw32-cpp TARGET_GOOS=windows TARGET_GOARCH=386 go generate 2>&1 | tee log-generate 77 GOOS=windows GOARCH=386 go test -c -o /dev/null 78 79 # 3900x/qemu 80 darwin_amd64: 81 @echo "Should be executed only on darwin/amd64." 82 go generate 2>&1 | tee log-generate 83 go test -c -o /dev/null 84 85 # 3900x/qemu 86 netbsd_amd64: 87 @echo "Should be executed only on netbsd/amd64." 88 go generate 2>&1 | tee log-generate 89 go test -c -o /dev/null 90 91 # darwin-m1 92 darwin_arm64: 93 @echo "Should be executed only on darwin/arm64." 94 go generate 2>&1 | tee log-generate 95 go test -c -o /dev/null 96 97 # 3900x/qemu 98 freebsd_amd64: 99 @echo "Should be executed only on freebsd/amd64." 100 go generate 2>&1 | tee log-generate 101 go test -c -o /dev/null 102 103 freebsd_arm64: 104 go run addport.go freebsd_amd64 freebsd_arm64 105 GOOS=freebsd GOARCH=arm64 go test -c -o /dev/null 106 107 # 3900x/qemu 108 freebsd_386: 109 @echo "Should be executed only on freebsd/386." 110 go generate 2>&1 | tee log-generate 111 go test -c -o /dev/null 112 113 # 3900x/qemu 114 freebsd_arm: 115 @echo "Should be executed only on freebsd/arm." 116 go generate 2>&1 | tee log-generate 117 go test -c -o /dev/null 118 119 # 3900x 120 linux_amd64: 121 @echo "Should be executed only on linux/amd64." 122 go generate 2>&1 | tee log-generate 123 go test -c -o /dev/null 124 125 # 3900x 126 linux_386: 127 @echo "Should be executed only on linux/amd64." 128 CCGO_CPP=i686-linux-gnu-cpp TARGET_GOARCH=386 TARGET_GOOS=linux go generate 2>&1 | tee log-generate 129 GOOS=linux GOARCH=386 go test -c -o /dev/null 130 131 # 3900x 132 linux_arm: 133 @echo "Should be executed only on linux/amd64." 134 CCGO_CPP=arm-linux-gnueabi-cpp TARGET_GOARCH=arm TARGET_GOOS=linux go generate 2>&1 | tee log-generate 135 GOOS=linux GOARCH=arm go test -c -o /dev/null 136 137 # 3900x 138 linux_arm64: 139 @echo "Should be executed only on linux/amd64." 140 CCGO_CPP=aarch64-linux-gnu-cpp TARGET_GOARCH=arm64 TARGET_GOOS=linux go generate 2>&1 | tee log-generate 141 GOOS=linux GOARCH=arm64 go test -c -o /dev/null 142 143 # 3900x 144 linux_ppc64le: 145 @echo "Should be executed only on linux/amd64." 146 CCGO_CPP=powerpc64le-linux-gnu-cpp TARGET_GOARCH=ppc64le TARGET_GOOS=linux go generate 2>&1 | tee log-generate 147 GOOS=linux GOARCH=ppc64le go test -c -o /dev/null 148 149 # linux/riscv64 150 linux_riscv64: 151 @echo "Should be executed only on linux/amd64." 152 CCGO_CPP=riscv64-linux-gnu-cpp TARGET_GOARCH=riscv64 TARGET_GOOS=linux go generate 2>&1 | tee log-generate 153 GOOS=linux GOARCH=riscv64 go test -c -o /dev/null 154 155 # 3900x 156 linux_s390x: 157 @echo "Should be executed only on linux/amd64." 158 CCGO_CPP=s390x-linux-gnu-cpp TARGET_GOARCH=s390x TARGET_GOOS=linux go generate 2>&1 | tee log-generate 159 GOOS=linux GOARCH=s390x go test -c -o /dev/null 160 161 # 3900x/qemu 162 openbsd_amd64: 163 @echo "Should be executed only on openbsd/amd64." 164 go generate 2>&1 | tee log-generate 165 go test -c -o /dev/null 166 167 # 3900x/qemu 168 openbsd_arm64: 169 @echo "Should be executed only on openbsd/arm64." 170 GOGC=10 GOMEMLIMIT=6GiB go generate 2>&1 | tee log-generate 171 go test -c -o /dev/null 172 173 generate_all_targets_on_linux_amd64: linux_amd64 linux_386 linux_arm linux_arm64 linux_s390x linux_ppc64le linux_riscv64 windows_amd64 windows_arm64 #TODO windows_386 174 gofmt -l -s -w . 175 echo done 176 177 tcl_test_wine: 178 GOOS=windows GOARCH=amd64 go build -o testfixture.exe modernc.org/sqlite/internal/testfixture 179 180 run_tcl_test_wine: 181 TCL_LIBRARY=Z:/home/jnml/src/modernc.org/tcl/assets wine testfixture.exe ./testdata/tcl/zipfile.test 182 183 extraquick: 184 go test -timeout 24h -v -failfast -suite extraquick -maxerror 1 2>&1 | tee log-extraquick 185 date 186 187 full: 188 go test -timeout 24h -v -run Tcl -suite full 2>&1 | tee log-full 189 date 190 191 clean: 192 go clean 193 rm -f *~ *.test *.out test.db* tt4-test*.db* test_sv.* testdb-* 194 195 cover: 196 t=$(shell tempfile) ; go test -coverprofile $$t && go tool cover -html $$t && unlink $$t 197 198 cpu: clean 199 go test -run @ -bench . -cpuprofile cpu.out 200 go tool pprof -lines *.test cpu.out 201 202 edit: 203 @touch log 204 @if [ -f "Session.vim" ]; then gvim -S & else gvim -p Makefile *.go & fi 205 206 editor: 207 gofmt -l -s -w *.go 208 go install -v ./... 209 go test -c -o /dev/null -tags=cgo,cgotest 210 211 internalError: 212 egrep -ho '"internal error.*"' *.go | sort | cat -n 213 214 later: 215 @grep -n $(grep) LATER * || true 216 @grep -n $(grep) MAYBE * || true 217 218 mem: clean 219 go test -run @ -bench . -memprofile mem.out -memprofilerate 1 -timeout 24h 220 go tool pprof -lines -web -alloc_space *.test mem.out 221 222 memgrind: 223 go test -v -timeout 24h -tags libc.memgrind,cgobench -bench . -suite extraquick -xtags=libc.memgrind 224 225 regression_base_release: 226 GO111MODULE=on go test -v -timeout 24h -tags=cgobench -run @ -bench '(Reading1|InsertComparative)/sqlite[^3]' -recs_per_sec_as_mbps 2>&1 | tee log-regression-base 227 228 regression_base_master: 229 GO111MODULE=off go test -v -timeout 24h -tags=cgobench -run @ -bench '(Reading1|InsertComparative)/sqlite[^3]' -recs_per_sec_as_mbps 2>&1 | tee log-regression-base 230 231 regression_check: 232 GO111MODULE=off go test -v -timeout 24h -tags=cgobench -run @ -bench '(Reading1|InsertComparative)/sqlite[^3]' -recs_per_sec_as_mbps 2>&1 | tee log-regression 233 benchcmp -changed -mag log-regression-base log-regression 234 235 nuke: clean 236 go clean -i 237 238 todo: 239 @grep -nr $(grep) ^[[:space:]]*_[[:space:]]*=[[:space:]][[:alpha:]][[:alnum:]]* * | grep -v $(ngrep) || true 240 @grep -nr $(grep) TODO * | grep -v $(ngrep) || true 241 @grep -nr $(grep) BUG * | grep -v $(ngrep) || true 242 @grep -nr $(grep) [^[:alpha:]]println * | grep -v $(ngrep) || true