|
| 1 | +# Benchmark options |
| 2 | +NO_TESTS = ^$ |
| 3 | +# BENCHMARKS = ^BenchmarkIndex('\$'|Hard|Torture|Periodic(Unicode)?) |
| 4 | +BENCH_SUITE = BenchmarkSuite |
| 5 | +BENCH_QUERY = BenchmarkSuite/.*BenchmarkQuery$ |
| 6 | +BENCH_EXEC_STEP = BenchmarkSuite/.*BenchmarkExecStep$ |
| 7 | + |
| 8 | +# TODO: join these into a single list |
| 9 | +ALL_TEST_TAGS := sqlite_allow_uri_authority |
| 10 | +ALL_TEST_TAGS += sqlite_app_armor |
| 11 | +ALL_TEST_TAGS += sqlite_column_metadata |
| 12 | +ALL_TEST_TAGS += sqlite_foreign_keys |
| 13 | +ALL_TEST_TAGS += sqlite_fts5 |
| 14 | +ALL_TEST_TAGS += sqlite_icu |
| 15 | +ALL_TEST_TAGS += sqlite_introspect |
| 16 | +ALL_TEST_TAGS += sqlite_json |
| 17 | +ALL_TEST_TAGS += sqlite_math_functions |
| 18 | +ALL_TEST_TAGS += sqlite_preupdate_hook |
| 19 | +ALL_TEST_TAGS += sqlite_secure_delete |
| 20 | +ALL_TEST_TAGS += sqlite_see |
| 21 | +ALL_TEST_TAGS += sqlite_stat4 |
| 22 | +ALL_TEST_TAGS += sqlite_trace |
| 23 | +ALL_TEST_TAGS += sqlite_unlock_notify |
| 24 | +ALL_TEST_TAGS += sqlite_vacuum_incr |
| 25 | +ALL_TEST_TAGS += sqlite_vtable |
| 26 | + |
| 27 | +space := $(subst ,, ) |
| 28 | +comma := , |
| 29 | + |
| 30 | +ALL_TEST_TAGS_JOINED = $(subst $(space),$(comma),$(ALL_TEST_TAGS)) |
| 31 | + |
| 32 | +# GO_VERSION = $(shell go version | grep -oE 'go[1-9]\.[0-9]+(\.[0-9]+)?') |
| 33 | +# ifeq (,$(shell echo $(GO_VERSION_NUMBER) | grep -E 'go1\.2[2-9]')) |
| 34 | +# export GOEXPERIMENT=cgocheck2 |
| 35 | +# endif |
| 36 | + |
| 37 | +.PHONY: all |
| 38 | +all: build |
| 39 | + |
| 40 | +.PHONY: build |
| 41 | +build: |
| 42 | + @go build -tags "libsqlite3" |
| 43 | + |
| 44 | +.PHONY: test |
| 45 | +test: |
| 46 | + @GOEXPERIMENT=cgocheck2 go test -tags "libsqlite3" -v |
| 47 | + |
| 48 | +.PHONY: test_all |
| 49 | +test_all: |
| 50 | + @GOEXPERIMENT=cgocheck2 go test -tags "$(ALL_TEST_TAGS_JOINED)" -v |
| 51 | + |
| 52 | +# TODO: merge with the above target |
| 53 | +.PHONY: test_all_libsqlite3 |
| 54 | +test_all_libsqlite3: |
| 55 | + GOEXPERIMENT=cgocheck2 go test -tags "$(ALL_TEST_TAGS_JOINED),libsqlite3" -v |
| 56 | + |
| 57 | +.PHONY: qtest |
| 58 | +qtest: |
| 59 | + @GOEXPERIMENT=cgocheck2 go test -tags "libsqlite3" |
| 60 | + |
| 61 | +.PHONY: short |
| 62 | +short: |
| 63 | + @go test -tags "libsqlite3" -short |
| 64 | + |
| 65 | +.PHONY: testrace |
| 66 | +testrace: |
| 67 | + @GOEXPERIMENT=cgocheck2 go test -tags "libsqlite3" -race |
| 68 | + |
| 69 | +.PHONY: test_userauth_fails |
| 70 | +test_userauth_fails: |
| 71 | + @./scripts/test-userauth-fails.bash |
| 72 | + |
| 73 | +.PHONY: test_userauth_fails_libsqlite3 |
| 74 | +test_userauth_fails_libsqlite3: |
| 75 | + @./scripts/test-userauth-fails.bash -libsqlite3 |
| 76 | + |
| 77 | +.PHONY: testfull |
| 78 | +testfull: |
| 79 | + @./scripts/test-full.bash -v |
| 80 | + |
| 81 | +.PHONY: testfull_race |
| 82 | +testfull_race: |
| 83 | + @./scripts/test-full.bash -v -race |
| 84 | + |
| 85 | +.PHONY: bench |
| 86 | +bench: |
| 87 | + @go test -tags "libsqlite3 darwin" -run $(NO_TESTS) -bench $(BENCH_SUITE) -benchmem |
| 88 | + |
| 89 | +.PHONY: bench_stmt_rows |
| 90 | +bench_stmt_rows: |
| 91 | + @go test -tags "libsqlite3 darwin" -run $(NO_TESTS) -bench $(BENCH_QUERY) -benchmem |
| 92 | + |
| 93 | +.PHONY: bench_exec_step |
| 94 | +bench_exec_step: |
| 95 | + @go test -tags "libsqlite3 darwin" -run $(NO_TESTS) -bench $(BENCH_EXEC_STEP) -benchmem |
| 96 | + |
| 97 | +.PHONY: bench_mem |
| 98 | +bench_mem: |
| 99 | + @go test -tags "libsqlite3 darwin" -run $(NO_TESTS) \ |
| 100 | + -bench $(BENCH_SUITE) \ |
| 101 | + -benchmem -memprofilerate 1 -memprofile mem.out -benchtime 5s |
| 102 | + |
| 103 | +.PHONY: bench_cpu |
| 104 | +bench_cpu: |
| 105 | + @go test -tags "libsqlite3 darwin" -run $(NO_TESTS) \ |
| 106 | + -bench $(BENCH_SUITE) \ |
| 107 | + -cpuprofile cpu.out -benchtime 5s |
| 108 | + |
| 109 | +.PHONY: tags |
| 110 | +tags: |
| 111 | + @\grep -ohP '(?<=//go:build )\w+(\s+\w+)?' *.go | sort -u |
0 commit comments