clean it up even more
[freeradius.git] / src / tests / Makefile
1 # -*- text -*-
2 ##
3 ## Makefile -- Build and run tests for the server.
4 ##
5 ##      http://www.freeradius.org/
6 ##      $Id$
7 ##
8 #
9 include ../../Make.inc
10
11 TESTS   = user_password chap mschapv1 digest-auth-MD5 digest-auth-int \
12         digest-auth-noalgo digest-md5-sess digest-auth-MD5_Sess \
13         digest-auth_int-MD5 digest-auth_int-MD5_Sess digest-auth_int-noalgo
14
15 PORT    = 12340
16
17 #       example.com stripped.example.com
18
19 EAPOL_TEST = eapol_test
20
21 EAP_TLS_TESTS = eap-ttls-pap.conf eap-ttls-mschapv2.conf peap-mschapv2.conf
22
23 SECRET  = testing123
24
25 .PHONY: all eap dictionary clean
26
27 #
28 #       Build the directory for testing the server
29 #
30 all: tests
31
32 clean:
33         @rm -f ../../raddb/test.conf test.conf dictionary
34
35 dictionary:
36         @echo "# test dictionary not install.  Delete at any time." > dictionary
37         @echo '$$INCLUDE ' $(top_builddir)/share/dictionary >> dictionary
38         @echo '$$INCLUDE ' $(top_builddir)/src/tests/dictionary.test >> dictionary
39
40 test.conf: dictionary
41         @echo "# test configuration file.  Do not install.  Delete at any time." > test.conf
42         @echo "libdir =" $(top_builddir)/src/modules/lib >> test.conf
43         @echo "testdir =" $(top_builddir)/src/tests/ >> test.conf
44         @echo 'dictionary = $${testdir}' >> test.conf
45         @echo 'logdir = $${testdir}' >> test.conf
46         @echo 'pidfile = $${testdir}/radiusd.pid' >> test.conf
47         @echo '$$INCLUDE radiusd.conf' >> test.conf
48         @echo '$$INCLUDE $${testdir}/config/' >> test.conf
49
50 radiusd.pid: test.conf
51         @../main/radiusd -md ../../raddb/ -n test -i 127.0.0.1 -p $(PORT)
52
53 # We can't make this depend on radiusd.pid, because then make will create
54 # radiusd.pid when we make radiusd.kill, which we don't want.
55 .PHONY: radiusd.kill
56 radiusd.kill:
57         @if [ -f radiusd.pid ]; then \
58                 (kill -TERM `cat radiusd.pid` >/dev/null 2>&1) || exit 0; \
59         fi
60         @rm -f radiusd.pid
61
62 #  Link from the main database directory to here
63 ../../raddb/test.conf: test.conf
64         @[ -f ../../raddb/test.conf ] || ln -s ../src/tests/test.conf ../../raddb/
65
66 # kill the server (if it's running)
67 # start the server
68 # run the tests
69 # kill the server
70 # remove the changes to raddb/
71 tests: ../../raddb/test.conf radiusd.kill radiusd.pid
72         @chmod a+x runtests.sh
73         @rm -f radius.log
74         @./runtests.sh $(TESTS)
75         @$(MAKE) radiusd.kill
76         @rm -f ../../raddb/test.conf
77
78 eap: $(EAP_TLS_TESTS)
79         $(EAPOL_TEST) -c eap-ttls-pap.conf -s $(SECRET) 
80         $(EAPOL_TEST) -c peap-mschapv2.conf -s $(SECRET)
81         $(EAPOL_TEST) -c eap-ttls-mschapv2.conf -s $(SECRET)
82
83 md5:
84         $(EAPOL_TEST) -c eap-md5.conf -s $(SECRET) 
85
86 tls:
87         $(EAPOL_TEST) -c eap-ttls-tls.conf -s $(SECRET)
88
89 ttls:
90         $(EAPOL_TEST) -c eap-ttls-pap.conf -s $(SECRET)
91
92 peap:
93         $(EAPOL_TEST) -c peap-mschapv2.conf -s $(SECRET)
94
95 leap:
96         $(EAPOL_TEST) -c leap.conf -s $(SECRET)