Skip to content

Commit

Permalink
Merge pull request #124 from mkalcok/test-improvements
Browse files Browse the repository at this point in the history
Improvements to Make targets and test execution
  • Loading branch information
fnordahl authored Mar 12, 2024
2 parents b6d8481 + 976a20e commit 707732e
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ ifndef MICROOVN_SNAP_CHANNEL
export MICROOVN_SNAP_CHANNEL="22.03/stable"
endif

.DEFAULT_GOAL := $(MICROOVN_SNAP)

ALL_TESTS := $(wildcard tests/*.bats)
MICROOVN_SOURCES := $(shell find microovn/ -type f)
COMMAND_WRAPPERS := $(shell find snapcraft/ -type f)
SNAP_SOURCES := $(shell find snap/ -type f)

check: check-lint check-system

check-tabs:
Expand All @@ -17,14 +24,18 @@ check-lint: check-tabs
-not -name \*.swp \
| xargs shellcheck --severity=warning && echo Success!

check-system: $(MICROOVN_SNAP)
echo "Running functional tests"; \
$(CURDIR)/.bats/bats-core/bin/bats tests/
$(ALL_TESTS): $(MICROOVN_SNAP)
echo "Running functional test $@"; \
$(CURDIR)/.bats/bats-core/bin/bats $@

$(MICROOVN_SNAP):
check-system: $(ALL_TESTS)

$(MICROOVN_SNAP): $(MICROOVN_SOURCES) $(SNAP_SOURCES) $(COMMAND_WRAPPERS)
echo "Building the snap"; \
snapcraft pack -v -o $(MICROOVN_SNAP)

clean:
rm -f $(MICROOVN_SNAP_PATH); \
snapcraft clean

.PHONY: $(ALL_TESTS) clean check-system check-lint check-tabs

0 comments on commit 707732e

Please sign in to comment.