summaryrefslogtreecommitdiff
path: root/EndoForge/test/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'EndoForge/test/Makefile')
-rw-r--r--EndoForge/test/Makefile38
1 files changed, 38 insertions, 0 deletions
diff --git a/EndoForge/test/Makefile b/EndoForge/test/Makefile
new file mode 100644
index 0000000..3bc1a66
--- /dev/null
+++ b/EndoForge/test/Makefile
@@ -0,0 +1,38 @@
1.DEFAULT_GOAL = test
2
3include ../Makefile
4
5testuser = testuser
6
7SU = $(SUDO) su
8
9.PHONY: test useradd cleanuser
10
11useradd:
12 $(SUDO) useradd $(testuser) --shell /bin/bash --create-home
13 $(SU) - $(testuser) -c 'ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -N ""'
14 $(SU) - $(testuser) -c 'git config --global user.name $(testuser)'
15 $(SU) - $(testuser) -c 'git config --global user.email $(testuser)'
16
17test: $(shell getent passwd $(testuser) >/dev/null || echo useradd)
18 $(ROOT_INSTALL) -t ~$(testuser) tests.sh
19 $(SU) - $(testuser) -c ./tests.sh
20
21ifeq ($(testuser),)
22$(error testuser not defined)
23endif
24cleanuser_command = $(SUDO) rm -I -r ~$(testuser)
25
26cleanuser:
27 : Preparing to run destructive command:
28 :
29 :
30 : $(cleanuser_command)
31 :
32 :
33 : Press ctrl-c to abort.
34 :
35 @for n in 5 4 3 2 1; do printf ' %d\r' "$$n"; sleep 1; done
36 $(cleanuser_command) || true
37 $(SUDO) userdel testuser || true
38