summaryrefslogtreecommitdiff
path: root/test/Makefile
blob: f86ebf5388af30041cd9528f1f354dfe982c10bf (plain)
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
-include test.mk

PREFIX=..
INSTDIR=$(PREFIX)/catlfish
SOFTHSM=/usr/local/bin/softhsm2-util

tests-start:
	./scripts/light-system-test-start.sh

tests-stop:
	./scripts/light-system-test-stop.sh

tests-wait:
	sleep 5

tests-makemk:
	$(PREFIX)/tools/compileconfig.py --config=$(PREFIX)/test/catlfish-test.cfg --testmakefile=$(PREFIX)/test/test.mk --machines 1
	$(PREFIX)/tools/compileconfig.py --config=$(PREFIX)/test/catlfish-test.cfg --testshellvars=$(PREFIX)/test/test.shvars --machines 1

tests:
	@make tests-makemk
	./scripts/light-system-test.sh

tests-createca:
	mkdir $(INSTDIR)/tests/httpsca
	( cd $(INSTDIR)/tests/httpsca ; \
	  mkdir -p demoCA/newcerts ; \
	  touch demoCA/index.txt ; \
	  echo 00 > demoCA/serial ; \
	  echo '[ req ]' > caconfig.txt ; \
	  echo 'distinguished_name = req_distinguished_name' >> caconfig.txt ; \
	  echo 'x509_extensions = v3_ca' >> caconfig.txt ; \
	  echo 'string_mask = utf8only' >> caconfig.txt ; \
	  echo '[ req_distinguished_name ]' >> caconfig.txt ; \
	  echo '[ v3_ca ]' >> caconfig.txt ; \
	  echo 'basicConstraints=CA:true' >> caconfig.txt ; \
	  openssl req -newkey rsa:2048 -keyout key.pem -out req.csr -nodes -subj '/countryName=SE/stateOrProvinceName=Stockholm/organizationName=Test/commonName=ca/O=ca' -config caconfig.txt ; \
	  openssl ca -in req.csr -selfsign -keyfile key.pem -out demoCA/cacert.pem -batch \
	)

tests-createcert:
	mkdir $(INSTDIR)/tests/httpscert
	openssl req -new -newkey rsa:2048 -keyout $(INSTDIR)/tests/httpscert/httpskey-1.pem -out $(INSTDIR)/tests/httpsca/httpscert-1.csr -nodes -subj '/countryName=SE/stateOrProvinceName=Stockholm/organizationName=Test/CN=localhost'
	( cd $(INSTDIR)/tests/httpsca ; \
	  openssl ca -in httpscert-1.csr -keyfile key.pem -out httpscert-1.pem -batch \
	)
	cp $(INSTDIR)/tests/httpsca/httpscert-1.pem $(INSTDIR)/tests/httpscert/