Skip to content
This repository was archived by the owner on Jun 15, 2025. It is now read-only.

Commit 826ae91

Browse files
committed
Allow for easy execution of individual tests
Occasionally running the entire test suite is too much overhead or takes too long, for instance, while working on an individual test. In such cases, what is desired ideally is to be able to run a single test case by means of a single memorable command. This change adjusts our makefile to support such cases by treating every command not otherwise defined as the individual test case to execute.
1 parent e22cb5c commit 826ae91

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

btrfs-backup/Makefile

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Makefile
22

33
#/***************************************************************************
4-
# * Copyright (C) 2014-2015 Daniel Mueller (deso@posteo.net) *
4+
# * Copyright (C) 2014-2016 Daniel Mueller (deso@posteo.net) *
55
# * *
66
# * This program is free software: you can redistribute it and/or modify *
77
# * it under the terms of the GNU General Public License as published by *
@@ -18,15 +18,24 @@
1818
# ***************************************************************************/
1919

2020
ROOT := $(shell pwd)/..
21+
PYTHONPATH := "$(ROOT)/cleanup/src:$(ROOT)/execute/src:$(ROOT)/btrfs-backup/src:${PYTHONPATH}"
2122

2223

2324
.PHONY: test
2425
test:
25-
@PYTHONPATH="$(ROOT)/cleanup/src:$(ROOT)/execute/src:$(ROOT)/btrfs-backup/src:${PYTHONPATH}"\
26+
@PYTHONPATH="$(PYTHONPATH)"\
2627
PYTHONDONTWRITEBYTECODE=1\
2728
python -m unittest --verbose --buffer deso.btrfs.test.allTests
2829

2930

31+
.PHONY: %
32+
%:
33+
@echo "Running deso.btrfs.test.$@ ..."
34+
@PYTHONPATH="$(PYTHONPATH)"\
35+
PYTHONDONTWRITEBYTECODE=1\
36+
python -m unittest --verbose --buffer deso.btrfs.test.$@
37+
38+
3039
ifneq (,$(filter testSetup testAll,$(MAKECMDGOALS)))
3140
.PHONY: testSetup
3241
# TODO: At the moment we do not delete the directory because it is full
@@ -35,7 +44,7 @@ ifneq (,$(filter testSetup testAll,$(MAKECMDGOALS)))
3544
testSetup: DIR := $(shell mktemp --directory --quiet)
3645
testSetup:
3746
@git clone --quiet $(ROOT) $(DIR)
38-
@(export PYTHONPATH="$(DIR)/cleanup/src:$(DIR)/execute/src/:$(DIR)/btrfs-backup/src:${PYTHONPATH}";\
47+
@(export PYTHONPATH="$(PYTHONPATH)";\
3948
cd $(DIR)/btrfs-backup &&\
4049
python setup.py --version > /dev/null &&\
4150
python setup.py --description > /dev/null &&\

0 commit comments

Comments
 (0)