Skip to content

Commit

Permalink
*: run test-robustness with build
Browse files Browse the repository at this point in the history
Add new recipe to build bbolt command so that we can ensure that
test-robustness recipe is using bbolt with gofail.

Since test-robustness requires root, move `sudo` into test-robustness
recipe. Otherwise, both bbolt binary and gofail code belongs to root
user.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
  • Loading branch information
fuweid committed Jan 4, 2024
1 parent 19be273 commit a0e54fc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/robustness_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,4 @@ jobs:
run: |
set -euo pipefail
make gofail-enable
# build bbolt with failpoint
go install ./cmd/bbolt
sudo -E PATH=$PATH make ROBUSTNESS_TESTFLAGS="--count ${{ inputs.count }} --timeout ${{ inputs.testTimeout }} -failfast" test-robustness
make ROBUSTNESS_TESTFLAGS="--count ${{ inputs.count }} --timeout ${{ inputs.testTimeout }} -failfast" test-robustness
22 changes: 19 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,22 @@ coverage:
TEST_FREELIST_TYPE=array go test -v -timeout ${TESTFLAGS_TIMEOUT} \
-coverprofile cover-freelist-array.out -covermode atomic

COMMANDS=bbolt

BINARIES=$(addprefix bin/,$(COMMANDS))

ALWAYS_REBUILD:

bin/%: cmd/% ALWAYS_REBUILD # Build a binary from cmd/
@echo building $<
@go build -o $@ ./$<

build: $(BINARIES) # Build binaries from cmd/

.PHONY: clean
clean: # Clean binaries
rm -f $(BINARIES)

.PHONY: gofail-enable
gofail-enable: install-gofail
gofail enable .
Expand All @@ -82,6 +98,6 @@ test-failpoint:
BBOLT_VERIFY=all TEST_FREELIST_TYPE=array go test -v ${TESTFLAGS} -timeout 30m ./tests/failpoint

.PHONY: test-robustness # Running robustness tests requires root permission
test-robustness:
go test -v ${TESTFLAGS} ./tests/dmflakey -test.root
go test -v ${TESTFLAGS} ${ROBUSTNESS_TESTFLAGS} ./tests/robustness -test.root
test-robustness: gofail-enable build
sudo env PATH=$$PATH go test -v ${TESTFLAGS} ./tests/dmflakey -test.root
sudo env PATH=$(PWD)/bin:$$PATH go test -v ${TESTFLAGS} ${ROBUSTNESS_TESTFLAGS} ./tests/robustness -test.root

0 comments on commit a0e54fc

Please sign in to comment.