3 ## Makefile -- Build and run tests for the server.
5 ## http://www.freeradius.org/
11 TESTS = user_password chap mschapv1 digest-01/digest* test.example.com \
15 ACCTPORT = $(shell expr $(PORT) + 1)
17 # example.com stripped.example.com
19 EAPOL_TEST = eapol_test
21 EAP_TLS_TESTS = eap-ttls-pap.conf eap-mschapv2.conf \
22 eap-ttls-mschapv2.conf peap-mschapv2.conf
26 .PHONY: all eap dictionary clean
29 # Build the directory for testing the server
34 @rm -f ../../raddb/test.conf test.conf 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
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
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)
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.
59 @if [ -f radiusd.pid ]; then \
60 (kill -TERM `cat radiusd.pid` >/dev/null 2>&1) || exit 0; \
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/
68 # kill the server (if it's running)
70 # run the tests (ignoring any failures)
72 # remove the changes to raddb/
73 tests: ../../raddb/test.conf radiusd.kill
74 @chmod a+x runtests.sh
77 @./runtests.sh $(TESTS)
79 @rm -f ../../raddb/test.conf
81 tests.eap: ../../raddb/test.conf radiusd.kill
82 @chmod a+x runtests.sh
87 @rm -f ../../raddb/test.conf
90 for x in $(EAP_TLS_TESTS); do \
91 $(EAPOL_TEST) -c $$x -p $(PORT) -s $(SECRET); \
95 $(EAPOL_TEST) -c eap-md5.conf -s $(SECRET)
98 $(EAPOL_TEST) -c eap-ttls-tls.conf -s $(SECRET)
101 $(EAPOL_TEST) -c eap-ttls-pap.conf -s $(SECRET)
104 $(EAPOL_TEST) -c peap-mschapv2.conf -s $(SECRET)
107 $(EAPOL_TEST) -c leap.conf -s $(SECRET)
109 ATTRS := rfc.txt errors.txt extended.txt lucent.txt wimax.txt
111 attrs: ${ATTRS} ../main/radattr
112 ../main/radattr -d ../../share rfc.txt
114 ${LIBRADIUS}: $(wildcard ../include/*.h) $(wildcard ../lib/*.c)
115 ${MAKE} -C ../lib all
117 ../main/radattr: ${LIBRADIUS} ../main/radattr.c
118 ${MAKE} -C ../main radattr