generated from repros-dev/repro-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile-tests
77 lines (58 loc) · 2.08 KB
/
Makefile-tests
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
MAKE ?= make
# run all tests by default
default_target: all
# default settings for all tests
export REPRO_EXIT_AFTER_STARTUP=true
export REPRO_INTERACTIVE_SESSION=false
export REPRO_LOGGING_LEVEL=info
export REPRO_LOGGING_OPTIONS=NO_TIMESTAMPS NO_LOCATIONS NO_TERMINAL
# macro for automatically naming the log file for a test
REPRO_LOGGING_DIRNAME = .repro-logs
REPRO_LOGGING_FILENAME = test_$(basename $@).log
TEXTFILE = $(REPRO_LOGGING_DIRNAME)/test_$(basename $@).txt
# macros for setting destination of logs
LOG = REPRO_LOGGING_FILENAME=$(REPRO_LOGGING_FILENAME)
NOLOG = REPRO_LOGGING_LEVEL=none
# macros for setting the logging level during a test
ALERT = REPRO_LOGGING_LEVEL=alert
WARN = REPRO_LOGGING_LEVEL=warn
INFO = REPRO_LOGGING_LEVEL=info
DEBUG = REPRO_LOGGING_LEVEL=debug
TRACE = REPRO_LOGGING_LEVEL=trace
# macros for controlling when services start
AUTO = REPRO_SERVICES_STARTUP=auto
MANUAL = REPRO_SERVICES_STARTUP=manual
# names of all tests to be run automatically
TESTS = reset-repro \
start-repro-auto \
start-repro-manual \
start-services-auto \
start-services-manual \
clean-demo \
run-demo
# generic targets for running the tests
all: clean-all test-all
test-all: $(addsuffix .test, $(TESTS))
clean-all: $(addsuffix .clean, $(TESTS))
# rule for deleting the products of a particular test
%.clean:
rm -f $(REPRO_LOGGING_DIRNAME)/$(REPRO_LOGGING_FILENAME)
rm -f $(TEXTFILE)
# the test targets
reset-repro.test:
$(NOLOG) $(AUTO) $(MAKE) init-repro > /dev/null
$(LOG) $(AUTO) $(MAKE) reset-repro > $(TEXTFILE)
start-repro-auto.test:
$(LOG) $(AUTO) $(MAKE) start-repro > $(TEXTFILE)
start-repro-manual.test:
$(LOG) $(MANUAL) $(MAKE) start-repro > $(TEXTFILE)
start-services-auto.test:
$(LOG) $(AUTO) $(MAKE) start-services > $(TEXTFILE)
start-services-manual.test:
$(LOG) $(MANUAL) $(MAKE) start-services > $(TEXTFILE)
clean-demo.test:
$(NOLOG) $(AUTO) $(MAKE) run-demo > /dev/null
$(LOG) $(AUTO) $(MAKE) clean-demo > $(TEXTFILE)
run-demo.test:
$(NOLOG) $(AUTO) $(MAKE) clean-demo > /dev/null
$(LOG) $(AUTO) $(MAKE) run-demo > $(TEXTFILE)