Add rules for attribute encodings
[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-01/digest* test.example.com \
12         wimax
13
14 PORT     = 12340
15 ACCTPORT = $(shell expr $(PORT) + 1)
16
17 #       example.com stripped.example.com
18
19 EAPOL_TEST = eapol_test
20
21 EAP_TLS_TESTS = eap-ttls-pap.conf eap-mschapv2.conf \
22               eap-ttls-mschapv2.conf peap-mschapv2.conf
23
24 SECRET  = testing123
25
26 .PHONY: all eap dictionary clean
27
28 #
29 #       Build the directory for testing the server
30 #
31 all: tests
32
33 clean:
34         @rm -f ../../raddb/test.conf test.conf dictionary
35
36 dictionary:
37         @echo "# test dictionary not install.  Delete at any time." > dictionary
38         @echo '$$INCLUDE ' $(top_builddir)/share/dictionary >> dictionary
39         @echo '$$INCLUDE ' $(top_builddir)/src/tests/dictionary.test >> dictionary
40
41 test.conf: dictionary
42         @echo "# test configuration file.  Do not install.  Delete at any time." > test.conf
43         @echo "libdir =" $(top_builddir)/src/modules/lib >> test.conf
44         @echo "testdir =" $(top_builddir)/src/tests/ >> test.conf
45         @echo 'dictionary = $${testdir}' >> test.conf
46         @echo 'logdir = $${testdir}' >> test.conf
47         @echo 'radacctdir = $${testdir}' >> test.conf
48         @echo 'pidfile = $${testdir}/radiusd.pid' >> test.conf
49         @echo '$$INCLUDE radiusd.conf' >> test.conf
50         @echo '$$INCLUDE $${testdir}/config/' >> test.conf
51
52 radiusd.pid: ../../raddb/test.conf test.conf
53         @../main/radiusd -txxl `pwd`/radius.log -md ../../raddb/ -n test -i 127.0.0.1 -p $(PORT)
54
55 # We can't make this depend on radiusd.pid, because then make will create
56 # radiusd.pid when we make radiusd.kill, which we don't want.
57 .PHONY: radiusd.kill
58 radiusd.kill:
59         @if [ -f radiusd.pid ]; then \
60                 (kill -TERM `cat radiusd.pid` >/dev/null 2>&1) || exit 0; \
61         fi
62         @rm -f radiusd.pid
63
64 #  Link from the main database directory to here
65 ../../raddb/test.conf: test.conf
66         @[ -f ../../raddb/test.conf ] || ln -s ../src/tests/test.conf ../../raddb/
67
68 # kill the server (if it's running)
69 # start the server
70 # run the tests (ignoring any failures)
71 # kill the server
72 # remove the changes to raddb/
73 tests: ../../raddb/test.conf radiusd.kill
74         @chmod a+x runtests.sh
75         @rm -f radius.log
76         @$(MAKE) radiusd.pid
77         @./runtests.sh $(TESTS)
78         @$(MAKE) radiusd.kill
79         @rm -f ../../raddb/test.conf
80
81 tests.eap: ../../raddb/test.conf radiusd.kill
82         @chmod a+x runtests.sh
83         @rm -f radius.log
84         @$(MAKE) radiusd.pid
85         @$(MAKE) eap
86         @$(MAKE) radiusd.kill
87         @rm -f ../../raddb/test.conf
88
89 eap: $(EAP_TLS_TESTS)
90         for x in $(EAP_TLS_TESTS); do \
91                 $(EAPOL_TEST) -c $$x -p $(PORT) -s $(SECRET); \
92         done
93
94 md5:
95         $(EAPOL_TEST) -c eap-md5.conf -s $(SECRET) 
96
97 tls:
98         $(EAPOL_TEST) -c eap-ttls-tls.conf -s $(SECRET)
99
100 ttls:
101         $(EAPOL_TEST) -c eap-ttls-pap.conf -s $(SECRET)
102
103 peap:
104         $(EAPOL_TEST) -c peap-mschapv2.conf -s $(SECRET)
105
106 leap:
107         $(EAPOL_TEST) -c leap.conf -s $(SECRET)
108
109 ATTRS   := rfc.txt errors.txt extended.txt lucent.txt wimax.txt
110
111 attrs:  ${ATTRS}
112         ../main/radattr -d ../../share rfc.txt