.github/Makefile: support EXTRA_TESTFLAGS for array freelist

Signed-off-by: Wei Fu <fuweid89@gmail.com>
pull/373/head
Wei Fu 2023-01-04 20:05:20 +08:00
parent 4e98e8fb3c
commit b7f2da4843
2 changed files with 13 additions and 22 deletions

View File

@ -6,9 +6,9 @@ jobs:
fail-fast: false
matrix:
target:
- linux-amd64-unit-test-2-cpu
- linux-amd64-unit-test-4-cpu
- linux-amd64-unit-test-4-cpu-race
- linux-amd64-unit-test-4-cpu-freelist-hashmap-race
- linux-amd64-unit-test-2-cpu-freelist-array-short-race
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
@ -20,17 +20,14 @@ jobs:
TARGET: ${{ matrix.target }}
run: |
case "${TARGET}" in
linux-amd64-unit-test-2-cpu)
CPU=2 make test-simulate
CPU=2 make test
;;
linux-amd64-unit-test-4-cpu)
CPU=4 make test-simulate
CPU=4 make test
;;
linux-amd64-unit-test-4-cpu-race)
CPU=4 ENABLE_RACE=true make test-simulate
CPU=4 ENABLE_RACE=true make test
linux-amd64-unit-test-4-cpu-freelist-hashmap-race)
CPU=4 ENABLE_RACE=true make test-freelist-hashmap
;;
linux-amd64-unit-test-2-cpu-freelist-array-short-race)
CPU=2 ENABLE_RACE=true EXTRA_TESTFLAGS="-short" make test-freelist-array
;;
*)
echo "Failed to find target"
@ -66,7 +63,6 @@ jobs:
run: |
case "${TARGET}" in
windows-amd64-unit-test-4-cpu)
CPU=4 make test-simulate
CPU=4 make test
;;
*)

View File

@ -11,8 +11,7 @@ TESTFLAGS_CPU=
ifdef CPU
TESTFLAGS_CPU=-cpu=$(CPU)
endif
TESTFLAGS = $(TESTFLAGS_RACE) $(TESTFLAGS_CPU)
TESTFLAGS = $(TESTFLAGS_RACE) $(TESTFLAGS_CPU) $(EXTRA_TESTFLAGS)
fmt:
!(gofmt -l -s -d $(shell find . -name \*.go) | grep '[a-z]')
@ -20,22 +19,18 @@ fmt:
lint:
golangci-lint run ./...
test:
test: test-freelist-hashmap test-freelist-array
test-freelist-hashmap:
@echo "hashmap freelist test"
TEST_FREELIST_TYPE=hashmap go test -v ${TESTFLAGS} -timeout 30m
TEST_FREELIST_TYPE=hashmap go test -v ${TESTFLAGS} ./cmd/bbolt
test-freelist-array:
@echo "array freelist test"
TEST_FREELIST_TYPE=array go test -v ${TESTFLAGS} -timeout 30m
TEST_FREELIST_TYPE=array go test -v ${TESTFLAGS} ./cmd/bbolt
test-simulate:
@echo "hashmap freelist test"
TEST_FREELIST_TYPE=hashmap go test -v ${TESTFLAGS} -test.run="TestSimulate_(100op|1000op)"
@echo "array freelist test"
TEST_FREELIST_TYPE=array go test -v ${TESTFLAGS} -test.run="TestSimulate_(100op|1000op)"
coverage:
@echo "hashmap freelist test"
TEST_FREELIST_TYPE=hashmap go test -v -timeout 30m \
@ -45,4 +40,4 @@ coverage:
TEST_FREELIST_TYPE=array go test -v -timeout 30m \
-coverprofile cover-freelist-array.out -covermode atomic
.PHONY: fmt test test-simulate lint
.PHONY: fmt test test-freelist-hashmap test-freelist-array lint