]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fix tests to work with new and old build systems
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 16 Nov 2012 14:00:03 +0000 (14:00 +0000)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 16 Nov 2012 14:00:03 +0000 (14:00 +0000)
src/tests/.gitignore
src/tests/Makefile
src/tests/runtests.sh

index 9d76b0c195ad8fa3515e1eec5796ca2e3cd3b12b..cd68fa6d517aa6e7f139e2b494840aac507562ed 100644 (file)
@@ -1,4 +1,6 @@
 .cache
+.foo
+.bar
 dictionary
 test.conf
 radius.log
index 54744d6006d235e3b0dc582544b8c1d8f96070b4..732b1761e4e8554a40bff43cf0d938ae19392515 100644 (file)
@@ -8,6 +8,17 @@
 #
 include ../../Make.inc
 
+ifeq "$(BOILER)" "yes"
+       BUILD_PATH := ../../build
+       BIN_PATH := $(BUILD_PATH)/bin
+       DYLD_LIBRARY_PATH := $(DYLD_LIBRARY_PATH):$(BUILD_PATH)/lib/.libs/
+else
+       BIN_PATH := ../main
+       DYLD_LIBRARY_PATH := $(DYLD_LIBRARY_PATH):../lib/.libs/:../modules/lib/.libs/
+endif
+
+RADDB_PATH := ../../raddb
+
 TESTS  = user_password chap mschapv1 digest-01/digest* test.example.com \
        wimax
 
@@ -31,7 +42,7 @@ SECRET        = testing123
 all: tests
 
 clean:
-       @rm -f ../../raddb/test.conf test.conf dictionary
+       @rm -f $(RADDB_PATH)/test.conf test.conf dictionary
 
 dictionary:
        @echo "# test dictionary not install.  Delete at any time." > dictionary
@@ -49,8 +60,8 @@ test.conf: dictionary
        @echo '$$INCLUDE radiusd.conf' >> test.conf
        @echo '$$INCLUDE $${testdir}/config/' >> test.conf
 
-radiusd.pid: ../../raddb/test.conf test.conf
-       @../main/radiusd -txxl `pwd`/radius.log -md ../../raddb/ -n test -i 127.0.0.1 -p $(PORT)
+radiusd.pid: $(RADDB_PATH)/test.conf test.conf raddb
+       @$(BIN_PATH)/radiusd -txxl `pwd`/radius.log -md $(RADDB_PATH)/ -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.
@@ -61,30 +72,37 @@ radiusd.kill:
        fi
        @rm -f radiusd.pid
 
+# As test.conf includes radiusd.conf and as radiusd.conf includes everything in
+# mods-enabled and sites-enable we need to ensure those directories have been
+# created and are up to date.
+.PHONY: raddb
+raddb:
+       @$(MAKE) -C $(RADDB_PATH) mods-enabled sites-enabled
+
 #  Link from the main database directory to here
-../../raddb/test.conf: test.conf
-       @[ -f ../../raddb/test.conf ] || ln -s ../src/tests/test.conf ../../raddb/
+$(RADDB_PATH)/test.conf: test.conf
+       @[ -f $(RADDB_PATH)/test.conf ] || ln -s ../src/tests/test.conf $(RADDB_PATH)/
 
 # kill the server (if it's running)
 # start the server
 # run the tests (ignoring any failures)
 # kill the server
 # remove the changes to raddb/
-tests: ../../raddb/test.conf radiusd.kill
+tests: $(RADDB_PATH)/test.conf radiusd.kill
        @chmod a+x runtests.sh
        @rm -f radius.log
        @$(MAKE) radiusd.pid
-       @./runtests.sh $(TESTS)
+       @BIN_PATH="$(BIN_PATH)" ./runtests.sh $(TESTS)
        @$(MAKE) radiusd.kill
-       @rm -f ../../raddb/test.conf
+       @rm -f $(RADDB_PATH)/test.conf
 
-tests.eap: ../../raddb/test.conf radiusd.kill
+tests.eap: $(RADDB_PATH)/test.conf radiusd.kill
        @chmod a+x runtests.sh
        @rm -f radius.log
        @$(MAKE) radiusd.pid
        @$(MAKE) eap
        @$(MAKE) radiusd.kill
-       @rm -f ../../raddb/test.conf
+       @rm -f $(RADDB_PATH)/test.conf
 
 eap: $(EAP_TLS_TESTS)
        for x in $(EAP_TLS_TESTS); do \
@@ -108,11 +126,11 @@ leap:
 
 ATTRS  := rfc.txt errors.txt extended.txt lucent.txt wimax.txt
 
-attrs: ${ATTRS} ../main/radattr
+attrs: $(ATTRS) ../main/radattr
        ../main/radattr -d ../../share rfc.txt
 
 ${LIBRADIUS}: $(wildcard ../include/*.h) $(wildcard ../lib/*.c)
-       ${MAKE} -C ../lib all
+       $(MAKE) -C ../lib all
 
 ../main/radattr: ${LIBRADIUS} ../main/radattr.c
-       ${MAKE} -C ../main radattr
+       $(MAKE) -C ../main radattr
index 17cbd2a9162a774a6fa3090ac46610490653061c..fcafc813124d297641e9a35fcebfff75927e2533 100755 (executable)
@@ -1,5 +1,8 @@
 #!/bin/bash
 
+# BIN_PATH should be specified by the caller
+#BIN_PATH=../main/
+
 PORT=12340
 HOME_PORT=12350
 SECRET=testing123
@@ -44,7 +47,7 @@ do
    echo "-f .cache/$x" >> .bar
 done
 
-../main/radclient `cat .bar` -xFd . 127.0.0.1:$PORT auth $SECRET > radclient.log 2>&1
+$BIN_PATH/radclient `cat .bar` -xFd . 127.0.0.1:$PORT auth $SECRET > radclient.log 2>&1
 
 for x in `cat .foo`
 do