Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Lab01Basics/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ../lab_makefile.mk
1 change: 1 addition & 0 deletions Lab02Mix/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ../lab_makefile.mk
1 change: 1 addition & 0 deletions Lab03Compute/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ../lab_makefile.mk
1 change: 1 addition & 0 deletions Lab04Zkp/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ../lab_makefile.mk
1 change: 1 addition & 0 deletions Lab05Credential/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ../lab_makefile.mk
46 changes: 46 additions & 0 deletions lab_makefile.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
TASK_NUM_MIN = 1
TASK_NUM_MAX = 20
task_numbers := $(shell seq $(TASK_NUM_MIN) $(TASK_NUM_MAX))
task_targets := $(addprefix test, $(task_numbers))

CODE_FILE = Lab[0-9][0-9]Code.py
TEST_FILE = Lab[0-9][0-9]Tests.py

PYTEST_FLAGS = -W ignore -v
PYTEST_COMMAND = py.test $(PYTEST_FLAGS)



.PHONY: testall test
testall test: $(TEST_FILE) $(CODE_FILE)
$(PYTEST_COMMAND) $(TEST_FILE)

.PHONY: testcustom
testcustom: $(CODE_FILE)
$(PYTEST_COMMAND) $(CODE_FILE)

.PHONY: testeverything
testeverything: $(TEST_FILE) $(CODE_FILE)
$(PYTEST_COMMAND) $(TEST_FILE)
$(PYTEST_COMMAND) $(CODE_FILE)

.PHONY: $(task_targets)
$(task_targets): test%: $(TEST_FILE)
$(PYTEST_COMMAND) $^ -m task$*

.PHONY: cov-report
cov-report: $(TEST_FILE) $(CODE_FILE)
$(PYTEST_COMMAND) --cov-report html --cov $(basename $(wildcard $(CODE_FILE))) $(TEST_FILE)

.PHONY: help
.SILENT: help
help:
echo "\nPET-Exercises Makefile Usage:"
echo "\tmake [cmd]"
echo "\tcmd:"
echo "\t\ttestall: Test all tasks against provided tests"
echo "\t\ttestcustom: Test against your own tests"
echo "\t\ttesteverything: Test against provided and own tests"
echo "\t\ttestN: Test against tests provided for task N"
echo "\t\tcov-report: Generate coverage report"