Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
anzdaddy committed Nov 26, 2024
1 parent 823fe58 commit d1e8d17
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ jobs:
fi
- name: Test Basic
run: go test -v -race ./...
run: make ci
env:
GOTESTFLAGS: -race

- name: Test 32 bit system
run: GOARCH=386 go test ./...
33 changes: 31 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
.PHONY: all
all: test-all build-linux lint

.PHONY: ci
ci: test-all no-allocs

.PHONY: test-all
test-all: test test-32
Expand All @@ -12,7 +14,11 @@ test:

.PHONY: test-32
test-32:
$(DOCKERRUN) -e GOARCH=arm golang:1.23.0 go test $(GOTESTFLAGS)
if [ "$(shell go env GOOS)" = "linux" ]; then \
GOARCH=386 go test $(GOTESTFLAGS); \
else \
$(DOCKERRUN) -e GOARCH=arm golang:1.23.0 go test $(GOTESTFLAGS); \
fi

.PHONY: build-linux
build-linux:
Expand Down Expand Up @@ -67,4 +73,27 @@ bench.stat: bench.txt
benchstat bench.old $< > $@ || (rm -f $@; false)

bench.txt: test
go test -run=^$$ -bench=. -benchmem $(GOBENCHFLAGS) > $@ || (rm -f $@; false)
go test -run=^$$ -bench=. -benchmem $(GOBENCHFLAGS) | tee $@ || (rm -f $@; false)

NOALLOC = \
BenchmarkIODecimal64String2 \
BenchmarkIODecimal64Append \
BenchmarkDecimal64Abs \
BenchmarkDecimal64Add \
BenchmarkDecimal64Cmp \
BenchmarkDecimal64Mul \
BenchmarkFloat64Mul \
BenchmarkDecimal64Quo \
BenchmarkDecimal64Sqrt \
BenchmarkDecimal64Sub

no-allocs:
allocs=$$( \
go test -run=^$$ -bench="^($$(echo $(NOALLOC) | sed 's/ /|/g'))$$" -benchmem $(GOBENCHFLAGS) | \
awk '/^Benchmark/ {if ($$7 != "0") print}' \
); \
if [ -n "$$allocs" ]; then \
echo "** alloc regression **"; \
echo "$$allocs"; \
false; \
fi

0 comments on commit d1e8d17

Please sign in to comment.