Skip to content

Commit

Permalink
test/make: drop golang version check
Browse files Browse the repository at this point in the history
A check for the version of Golang was introduced with [1] because our
test coverage requires Go version 1.20 or newer. Since we increased the
minimum version to 1.20 [2], this check is no longer necessary.

[1] 740974d
[2] 9453d23

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
  • Loading branch information
rst0git committed Jul 16, 2024
1 parent 9453d23 commit ef64673
Showing 1 changed file with 5 additions and 22 deletions.
27 changes: 5 additions & 22 deletions test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ TEST_PAYLOAD := piggie/piggie
TEST_BINARIES := test $(TEST_PAYLOAD) phaul/phaul
COVERAGE_BINARIES := test.coverage phaul/phaul.coverage crit/crit-test.coverage

GO_MAJOR_VER = $(shell $(GO) version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1)
GO_MINOR_VER = $(shell $(GO) version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f2)
MIN_GO_MAJOR_VER = 1
MIN_GO_MINOR_VER = 20
GO_VALIDATION_ERR = Go version is not supported. Please update to at least $(MIN_GO_MAJOR_VER).$(MIN_GO_MINOR_VER)

all: $(TEST_BINARIES) phaul-test
mkdir -p image
PID=$$(piggie/piggie) && \
Expand All @@ -26,17 +20,6 @@ all: $(TEST_BINARIES) phaul-test
./test restore image
rm -rf image

check-go-version:
@if [ $(GO_MAJOR_VER) -gt $(MIN_GO_MAJOR_VER) ]; then \
exit 0 ;\
elif [ $(GO_MAJOR_VER) -lt $(MIN_GO_MAJOR_VER) ]; then \
echo '$(GO_VALIDATION_ERR)';\
exit 1; \
elif [ $(GO_MINOR_VER) -lt $(MIN_GO_MINOR_VER) ] ; then \
echo '$(GO_VALIDATION_ERR)';\
exit 1; \
fi

piggie/piggie: piggie/piggie.c
$(CC) $^ -o $@

Expand All @@ -55,17 +38,17 @@ phaul-test: $(TEST_BINARIES)
crit-test:
$(MAKE) -C crit

test.coverage: check-go-version *.go
test.coverage: *.go
$(GO) build \
-cover \
-o $@ main.go

phaul/phaul.coverage: check-go-version phaul/*.go
phaul/phaul.coverage: phaul/*.go
$(GO) build \
-cover \
-o $@ phaul/main.go

crit/crit-test.coverage: check-go-version crit/*.go
crit/crit-test.coverage: crit/*.go
# Re-build the crit binary, so that test coverage
# works even if we run `make test` before that.
$(MAKE) -C ../crit clean
Expand All @@ -75,7 +58,7 @@ crit/crit-test.coverage: check-go-version crit/*.go
-cover \
-o $@ crit/main.go

coverage: check-go-version $(COVERAGE_BINARIES) $(TEST_PAYLOAD)
coverage: $(COVERAGE_BINARIES) $(TEST_PAYLOAD)
mkdir -p $(COVERAGE_PATH)
mkdir -p image
PID=$$(piggie/piggie) && \
Expand Down Expand Up @@ -115,4 +98,4 @@ clean:
@make -C loop/ clean
@make -C mmapper/ clean

.PHONY: all clean coverage codecov crit-test phaul-test check-go-version
.PHONY: all clean coverage codecov crit-test phaul-test

0 comments on commit ef64673

Please sign in to comment.