aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 27e141f64a8fdd20161bc78eaaba675304fd8e14 (plain) (blame)
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
.POSIX:
N = `nproc`



.SUFFIXES:
.SUFFIXES: .in .sentinel

.in:
	sed \
		-e "s|@HOSTNAME@|`hostname`|g" \
		< $< > $@
	if [ -x $< ]; then chmod +x $@; fi



all:
include deps.mk


test-config-files-local = \

test-config-files-internet = \

test-config-files = \
	$(test-config-files-local)     \
	$(test-config-files-internet)  \


derived-assets = \
	packages.scm.sentinel          \
	local.scm.sentinel             \
	internet.scm.sentinel          \
	maintainer.key.sentinel        \
	$(test-config-files)           \

side-assets = \
	dynamic.scm                    \
	packages.scm                   \
	local.scm                      \
	internet.scm                   \
	tests/cert/                    \



all: $(derived-assets)


$(test-config-files):  Makefile deps.mk
local.scm.sentinel:    tests/local/system.scm
internet.scm.sentinel: tests/internet/system.scm

packages.scm.sentinel: src/org/euandre/packages.scm Makefile deps.mk
	rm -f packages.scm
	guix build -c$N -v3 -Lsrc -r packages.scm -Kf src/org/euandre/packages.scm
	touch $@

local.scm.sentinel internet.scm.sentinel: packages.scm.sentinel
	rm -f $*
	guix build -c$N -v3 -Lsrc -r $* -Kf tests/`basename $* .scm`/system.scm
	touch $@

maintainer.key.sentinel: email.txt
	gpg --export --armour "`cat email.txt`" | ifnew $*
	touch $@



check-guile:
	guix repl -L src/ tests/unit.scm

check-unit: check-guile

local-files = \

internet-files = \
	$(local-files)                 \

check-guix-static-local:    local.scm.sentinel    $(test-config-files-local)
	for f in $(local-files); do \
		diff -U5 local.scm"$$f" tests/local"$$f"; \
	done

check-guix-static-internet: internet.scm.sentinel $(test-config-files-internet)
	for f in $(internet-files); do \
		diff -U5 internet.scm"$$f" tests/internet"$$f"; \
	done

check-guix-static: check-guix-static-local check-guix-static-internet

check-guix-dynamic:
	rm -f dynamic.scm
	guix build -c$N -v3 -Lsrc -r dynamic.scm -Km tests/tests.scm

check-guix: check-guix-static check-guix-dynamic


check-integration: check-guix


## Run all tests.  Each test suite is isolated, so that a parallel
## build can run tests at the same time.  The required artifacts
## are created if missing.
check: check-unit check-integration



## Remove *all* derived artifacts produced during the build.
## A dedicated test asserts that this is always true.
clean:
	rm -rf $(derived-assets) $(side-assets)




ALWAYS: