digest-auth-noalgo digest-md5-sess digest-auth-MD5_Sess \
digest-auth_int-MD5 digest-auth_int-MD5_Sess digest-auth_int-noalgo
+PORT = 12340
+
# example.com stripped.example.com
EAPOL_TEST = eapol_test
SECRET = testing123
-.PHONY: all eap test.conf dictionary clean
+.PHONY: all eap dictionary clean
#
# Build the directory for testing the server
clean:
@rm -f ../../raddb/test.conf test.conf dictionary
-test.conf:
+dictionary:
+ @echo "# test dictionary not install. Delete at any time." > dictionary
+ @echo '$$INCLUDE ' $(top_builddir)/share/dictionary >> dictionary
+ @echo '$$INCLUDE ' $(top_builddir)/src/tests/dictionary.test >> dictionary
+
+test.conf: dictionary
@echo "# test configuration file. Do not install. Delete at any time." > test.conf
@echo "libdir =" $(top_builddir)/src/modules/lib >> test.conf
- @echo "dictionary =" $(top_builddir)/src/tests/ >> test.conf
@echo "testdir =" $(top_builddir)/src/tests/ >> test.conf
+ @echo 'dictionary = $${testdir}' >> test.conf
+ @echo 'logdir = $${testdir}' >> test.conf
+ @echo 'pidfile = $${testdir}/radiusd.pid' >> test.conf
@echo '$$INCLUDE radiusd.conf' >> test.conf
@echo '$$INCLUDE $${testdir}/config/' >> test.conf
@[ -f ../../raddb/test.conf ] || ln -s ../src/tests/test.conf ../../raddb/
-dictionary:
- @echo '$$INCLUDE ' $(top_builddir)/share/dictionary > dictionary
- @echo '$$INCLUDE ' $(top_builddir)/src/tests/dictionary.test >> dictionary
+radiusd.pid: test.conf
+ @../main/radiusd -md ../../raddb/ -n test -i 127.0.0.1 -p $(PORT)
+
+# We can't make this depend on radiusd.pid, because then make will create
+# radiusd.pid when we make radiusd.kill, which we don't want.
+.PHONY: radiusd.kill
+radiusd.kill:
+ @if [ -f radiusd.pid ]; then \
+ kill -TERM `cat radiusd.pid`; \
+ fi
+ @rm -f radiusd.pid
tests: test.conf dictionary
+ @$(MAKE) radiusd.kill
+ @$(MAKE) radiusd.pid
@chmod a+x runtests.sh
./runtests.sh $(TESTS)
PORT=12340
HOME_PORT=12350
-# Sends a signal which checks if the process is active (doesn't kill anything)
-function pidactive () {
- kill -0 $1 2> /dev/null
- return
-}
-
-# Kill a particular process
-function pidkill () {
- kill $1 || return
- #adjust depending how long it takes to die gracefully
- sleep 1
- if pidactive $1; then
- #escalating
- kill -9 $1
- fi
-}
-
-# Starts the server
-function start_radiusd () {
- ../main/radiusd -Xmd ../../raddb/ -n test -i 127.0.0.1 -p $PORT > radiusd.log 2>&1 &
- PID=$!
-#wait for the process to startup or die...
- sleep 3
- if ! pidactive $PID; then
- wait $PID
- tail -5 radiusd.log
- echo "Command failed with $?"
- exit 1
- fi
-}
-
rm -f verbose.log
RCODE=0
done
done
-#
-# Now run the tests
-#
-echo "Starting radiusd..."
-start_radiusd
echo "Running tests..."
-
(cd .cache;ls -1 > ../.foo)
rm -f .bar
for x in `cat .foo`
done
-pidkill $PID
-
if [ "$RCODE" = "0" ]
then
rm -f radiusd.log radclient.log