Enhance CI workflow with coverage options and add tests for KDTree functionality

This commit is contained in:
Snider 2025-11-03 19:50:05 +00:00
parent 054c9af39e
commit 34101cf686
3 changed files with 16 additions and 10 deletions

View file

@ -44,12 +44,15 @@ jobs:
run: |
set -e
for pkg in $(go list ./...); do
if go test -list '^Fuzz' "$pkg" | grep -q '^Fuzz'; then
echo "==> Fuzzing $pkg for 10s"
go test -run=NONE -fuzz=Fuzz -fuzztime=10s "$pkg"
else
FUZZES=$(go test -list '^Fuzz' "$pkg" | grep '^Fuzz' || true)
if [ -z "$FUZZES" ]; then
echo "==> Skipping $pkg (no fuzz targets)"
continue
fi
for fz in $FUZZES; do
echo "==> Fuzzing $pkg :: $fz for 10s"
go test -run=NONE -fuzz="^$fz$" -fuzztime=10s "$pkg"
done
done
- name: Upload coverage artifact

View file

@ -73,14 +73,17 @@ coverhtml: cover ## Generate HTML coverage report at $(COVERHTML)
.PHONY: fuzz
fuzz: ## Run Go fuzz tests for $(FUZZTIME)
@set -e; \
PKGS="$$( $(GO) list ./... )"; \
PKGS="$$($(GO) list ./...)"; \
for pkg in $$PKGS; do \
if $(GO) test -list '^Fuzz' $$pkg | grep -q '^Fuzz'; then \
echo "==> Fuzzing $$pkg for $(FUZZTIME)"; \
$(GO) test -run=NONE -fuzz=Fuzz -fuzztime=$(FUZZTIME) $$pkg; \
else \
FUZZES="$$($(GO) test -list '^Fuzz' $$pkg | grep '^Fuzz' || true)"; \
if [ -z "$$FUZZES" ]; then \
echo "==> Skipping $$pkg (no fuzz targets)"; \
continue; \
fi; \
for fz in $$FUZZES; do \
echo "==> Fuzzing $$pkg :: $$fz for $(FUZZTIME)"; \
$(GO) test -run=NONE -fuzz="^$$fz$" -fuzztime=$(FUZZTIME) $$pkg; \
done; \
done
.PHONY: bench

View file

@ -48,7 +48,7 @@ func TestDeleteByID_SwapDelete(t *testing.T) {
if ids["B"] {
t.Fatalf("B should not be present after delete")
}
if !(ids["A"] || ids["C"]) {
if !ids["A"] && !ids["C"] {
t.Fatalf("expected either A or C to be nearest for respective queries: %v", ids)
}
}