make test subcommand

This commit is contained in:
Robert Bendun 2022-05-22 06:33:17 +02:00
parent b193ca1213
commit 0ce1b59757
2 changed files with 5 additions and 5 deletions

View File

@ -21,6 +21,9 @@ Debug_Obj=$(addprefix bin/debug/,$(Obj))
all: bin/musique all: bin/musique
test: unit-tests
etc/tools/test.py test examples
debug: bin/debug/musique debug: bin/debug/musique
bin/%.o: src/%.cc src/*.hh bin/%.o: src/%.cc src/*.hh
@ -35,11 +38,9 @@ bin/debug/musique: $(Debug_Obj) bin/debug/main.o src/*.hh
bin/debug/%.o: src/%.cc src/*.hh bin/debug/%.o: src/%.cc src/*.hh
g++ $(CXXFLAGS) $(DEBUG_FLAGS) $(CPPFLAGS) -o $@ $< -c g++ $(CXXFLAGS) $(DEBUG_FLAGS) $(CPPFLAGS) -o $@ $< -c
.PHONY: unit-tests
unit-tests: bin/unit-tests unit-tests: bin/unit-tests
./$< ./$<
.PHONY: unit-test-coverage
unit-test-coverage: unit-test-coverage:
@which gcov >/dev/null || ( echo "[ERROR] gcov is required for test coverage report"; false ) @which gcov >/dev/null || ( echo "[ERROR] gcov is required for test coverage report"; false )
@which gcovr >/dev/null || ( echo "[ERROR] gcovr is required for test coverage report"; false ) @which gcovr >/dev/null || ( echo "[ERROR] gcovr is required for test coverage report"; false )
@ -51,12 +52,10 @@ unit-test-coverage:
rm -rf bin/debug rm -rf bin/debug
xdg-open coverage/index.html xdg-open coverage/index.html
.PHONY: doc
doc: Doxyfile src/*.cc src/*.hh doc: Doxyfile src/*.cc src/*.hh
doxygen doxygen
cd doc; $(MAKE) html cd doc; $(MAKE) html
.PHONY: doc-open
doc-open: doc doc-open: doc
xdg-open ./doc/build/html/index.html xdg-open ./doc/build/html/index.html
@ -66,6 +65,6 @@ bin/unit-tests: src/tests/*.cc $(Debug_Obj)
clean: clean:
rm -rf bin coverage rm -rf bin coverage
.PHONY: clean .PHONY: clean doc doc-open all test unit-tests
$(shell mkdir -p bin/debug) $(shell mkdir -p bin/debug)

View File

@ -17,6 +17,7 @@ Interpreter języka Musique. Możliwy do wykorzystywania jako:
### Testowanie ### Testowanie
- `make test` - Uruchom wszystkie dostępne testy automatyczne
- `make unit-tests` - Uruchamia testy jednostkowe interpretera - `make unit-tests` - Uruchamia testy jednostkowe interpretera
- `make unit-test-coverage` - Uruchamia raport pokrycia kodu przez testy jednostkowe - `make unit-test-coverage` - Uruchamia raport pokrycia kodu przez testy jednostkowe
- `etc/tools/test.py test examples` - Uruchamia testy zachowań przykładów - `etc/tools/test.py test examples` - Uruchamia testy zachowań przykładów