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-ttls-mschapv2.conf peap-mschapv2.conf
25 .PHONY: all eap dictionary clean
28 # Build the directory for testing the server
33 @rm -f ../../raddb/test.conf test.conf 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
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 'radacctdir = $${testdir}' >> test.conf
47 @echo 'pidfile = $${testdir}/radiusd.pid' >> test.conf
48 @echo '$$INCLUDE radiusd.conf' >> test.conf
49 @echo '$$INCLUDE $${testdir}/config/' >> test.conf
51 radiusd.pid: ../../raddb/test.conf test.conf
52 @../main/radiusd -txxl `pwd`/radius.log -md ../../raddb/ -n test -i 127.0.0.1 -p $(PORT)
54 # We can't make this depend on radiusd.pid, because then make will create
55 # radiusd.pid when we make radiusd.kill, which we don't want.
58 @if [ -f radiusd.pid ]; then \
59 (kill -TERM `cat radiusd.pid` >/dev/null 2>&1) || exit 0; \
63 # Link from the main database directory to here
64 ../../raddb/test.conf: test.conf
65 @[ -f ../../raddb/test.conf ] || ln -s ../src/tests/test.conf ../../raddb/
67 # kill the server (if it's running)
69 # run the tests (ignoring any failures)
71 # remove the changes to raddb/
72 tests: ../../raddb/test.conf radiusd.kill
73 @chmod a+x runtests.sh
76 @./runtests.sh $(TESTS)
78 @rm -f ../../raddb/test.conf
81 $(EAPOL_TEST) -c eap-ttls-pap.conf -s $(SECRET)
82 $(EAPOL_TEST) -c peap-mschapv2.conf -s $(SECRET)
83 $(EAPOL_TEST) -c eap-ttls-mschapv2.conf -s $(SECRET)
86 $(EAPOL_TEST) -c eap-md5.conf -s $(SECRET)
89 $(EAPOL_TEST) -c eap-ttls-tls.conf -s $(SECRET)
92 $(EAPOL_TEST) -c eap-ttls-pap.conf -s $(SECRET)
95 $(EAPOL_TEST) -c peap-mschapv2.conf -s $(SECRET)
98 $(EAPOL_TEST) -c leap.conf -s $(SECRET)