summaryrefslogtreecommitdiff
path: root/cmake/test
diff options
context:
space:
mode:
authorRalf Habacker <ralf.habacker@freenet.de>2010-04-09 23:07:11 +0200
committerRalf Habacker <ralf.habacker@freenet.de>2010-04-09 23:07:11 +0200
commit19251c52ded05ad802c99191fe345901bb448d0f (patch)
treec4a7007cfc7a365bd47235053b76693748532da4 /cmake/test
parenta9d68b7d9db09bb0b2532d103caf059e49978f0a (diff)
downloaddbus-19251c52ded05ad802c99191fe345901bb448d0f.tar.gz
Simplified cmake specific test file generating.
If there is a *.cmake test file available for a related *.in file, take the *.cmake test file instead of the *.in file as test file source. Also added some messages.
Diffstat (limited to 'cmake/test')
-rw-r--r--cmake/test/CMakeLists.txt91
1 files changed, 24 insertions, 67 deletions
diff --git a/cmake/test/CMakeLists.txt b/cmake/test/CMakeLists.txt
index 393c494a..014e9409 100644
--- a/cmake/test/CMakeLists.txt
+++ b/cmake/test/CMakeLists.txt
@@ -106,6 +106,7 @@ set (CONFIG_VERBOSE 0)
### copy tests to builddir so that generated tests and static tests
### are all in one place.
+MESSAGE(STATUS "Copying test files to test directory")
FOREACH(FILE_TYPE *.message *.message-raw *.auth-script *.sha1 *.txt *.conf *.service)
FOREACH(DIR ${TESTDIRS})
FILE(GLOB FILES "${CMAKE_SOURCE_DIR}/../${DIR}/${FILE_TYPE}" )
@@ -115,14 +116,21 @@ FOREACH(FILE_TYPE *.message *.message-raw *.auth-script *.sha1 *.txt *.conf *.se
SET (TARGET ${CMAKE_BINARY_DIR}/${DIR}/${FILENAME})
configure_file(${FILE} ${TARGET} COPYONLY)
IF (CONFIG_VERBOSE)
- MESSAGE("FROM: ${FILE}\nTO: ${TARGET}\n")
+ MESSAGE("${FILE}")
ENDIF (CONFIG_VERBOSE)
ENDFOREACH(FILE)
ENDFOREACH(DIR)
ENDFOREACH(FILE_TYPE)
+if (UNIX)
+ set (TEST_LISTEN "debug-pipe:name=test-server")
+endif (UNIX)
+if (WIN32)
+ set (TEST_LISTEN "tcp:host=localhost,port=1234")
+endif (WIN32)
### generate test files
+MESSAGE(STATUS "Generating test files from templates into test directory")
FOREACH(FILE_TYPE *.conf.in *.service.in)
FOREACH(DIR ${TESTDIRS})
@@ -132,83 +140,32 @@ FOREACH(FILE_TYPE *.conf.in *.service.in)
GET_FILENAME_COMPONENT(FILENAME ${FILE} NAME)
STRING(REGEX REPLACE "\\.in$" "" FILENAME ${FILENAME})
SET (TARGET ${CMAKE_BINARY_DIR}/${DIR}/${FILENAME})
+ STRING(REGEX REPLACE "\\.in$" ".cmake" _file ${FILE})
+ IF (EXISTS ${_file})
+ SET (FILE ${_file})
+ ENDIF (EXISTS ${_file})
configure_file(${FILE} ${TARGET} @ONLY IMMEDIATE)
IF (CONFIG_VERBOSE)
- MESSAGE("FROM: ${FILE}\nTO: ${TARGET}\n")
+ MESSAGE("${FILE}")
ENDIF (CONFIG_VERBOSE)
ENDFOREACH(FILE)
ENDFOREACH(DIR)
ENDFOREACH(FILE_TYPE)
-#
-# the following config files are required on windows because the related
-# *.in files are not customized sufficiently.
-# TODO merge test/data/valid-config-files/debug-allow-all*.conf.in and ....cmake
-#
-SET (CONFIG_FILES test/data/valid-config-files)
-if (UNIX)
- set (TEST_LISTEN "debug-pipe:name=test-server")
-endif (UNIX)
-if (WIN32)
- set (TEST_LISTEN "tcp:host=localhost,port=1234")
-endif (WIN32)
-configure_file(${CMAKE_SOURCE_DIR}/../${CONFIG_FILES}/debug-allow-all-sha1.conf.cmake ${CMAKE_BINARY_DIR}/${CONFIG_FILES}/debug-allow-all-sha1.conf )
-configure_file(${CMAKE_SOURCE_DIR}/../${CONFIG_FILES}/debug-allow-all.conf.cmake ${CMAKE_BINARY_DIR}/${CONFIG_FILES}/debug-allow-all.conf )
+MESSAGE(STATUS "Copying generated bus config files to test directory")
+set (OUTDIR ${CMAKE_BINARY_DIR}/test/data/valid-config-files)
-# todo: for installation the TEST_..._BINARY variables must reflect the
-# installation dir or has to be defined relative
-#
-SET (SERVICE_FILES test/data/valid-service-files)
-FILE(GLOB FILES "${CMAKE_SOURCE_DIR}/../${SERVICE_FILES}/*.service.in" )
-FOREACH(FILE ${FILES})
- GET_FILENAME_COMPONENT(FILENAME ${FILE} NAME_WE)
- SET (TARGET ${CMAKE_BINARY_DIR}/${SERVICE_FILES}/${FILENAME}.service)
+FILE(GLOB FILES "${CMAKE_BINARY_DIR}/bus/*.conf" )
+FILE(MAKE_DIRECTORY ${OUTDIR})
+FOREACH(FILE ${FILES})
+ GET_FILENAME_COMPONENT(FILENAME ${FILE} NAME)
+ SET (TARGET ${OUTDIR}/${FILENAME})
+ configure_file(${FILE} ${TARGET} COPYONLY)
IF (CONFIG_VERBOSE)
MESSAGE("FROM: ${FILE}\nTO: ${TARGET}\n")
ENDIF (CONFIG_VERBOSE)
- configure_file(${FILE} ${TARGET} )
- #install_files(/data/dbus-1/services FILES ${TARGET})
ENDFOREACH(FILE)
+# todo: for installation the TEST_..._BINARY variables must reflect the
+# installation dir or has to be defined relative
#
-#FIND_TESTS=find -name "*.message" -o -name "*.message-raw" -o -name "*.auth-script" -o -name "*.sha1" -o -name "*.txt" -o -name "*.conf" -o -name "*.service"
-#
-### copy tests to builddir so that generated tests and static tests
-### are all in one place.
-#all-local:
-# for D in $(TESTDIRS); do
-# test -d $(top_builddir)/test/$$D || mkdir $(top_builddir)/test/$$D || exit 1 ;
-# done ;
-# if ! (test $(srcdir) = . || test $(srcdir) -ef .) ; then
-# FILES=`(cd $(srcdir) && $(FIND_TESTS))` ;
-# for F in $$FILES; do
-# SRC=$(srcdir)/$$F ;
-# DEST=$(top_builddir)/test/$$F ;
-# echo '-- Copying test file '$$F ;
-# cp $$SRC $$DEST || exit 1 ;
-# chmod u+w $$DEST || exit 1 ;
-# done ;
-# else
-# echo '-- No need to copy test data as srcdir = builddir' ;
-# fi ;
-# echo '-- Copying' $(top_builddir)/bus/*.conf 'to test directory' ;
-# cp $(top_builddir)/bus/*.conf $(top_builddir)/test/data/valid-config-files || exit 1 ;
-# chmod u+w $(top_builddir)/test/data/valid-config-files/*.conf || exit 1
-#
-### this doesn't clean generated test data files when srcdir=builddir
-#clean-local:
-# if test $(srcdir) != . ; then
-# FILES=`(cd $(top_builddir)/test && $(FIND_TESTS))` ;
-# for F in $$FILES; do
-# DEST=$(top_builddir)/test/$$F ;
-# echo '-- Deleting test file '$$F ;
-# rm $$DEST || exit 1 ;
-# done ;
-# REVERSEDIRS= ;
-# for D in $(TESTDIRS); do
-# REVERSEDIRS="$$D $$REVERSEDIRS" ;
-# done ;
-# for D in $$REVERSEDIRS; do
-# rmdir $(top_builddir)/test/$$D || exit 1 ;
-# done ;
-# fi