From cbf660a7b34e3e7e52b4c894e01542b5b6ca799c Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Mon, 15 Aug 2011 21:57:56 +0200 Subject: [PATCH 3/5] Include selinux test data only when enabled --- cmake/test/CMakeLists.txt | 24 ++++++++++++++------- test/Makefile.am | 10 ++++++++ test/data/valid-config-files/basic.conf | 32 ---------------------------- test/data/valid-config-files/basic.conf.in | 26 ++++++++++++++++++++++ 4 files changed, 52 insertions(+), 40 deletions(-) delete mode 100644 test/data/valid-config-files/basic.conf create mode 100644 test/data/valid-config-files/basic.conf.in diff --git a/cmake/test/CMakeLists.txt b/cmake/test/CMakeLists.txt index 9a259d2..c547778 100644 --- a/cmake/test/CMakeLists.txt +++ b/cmake/test/CMakeLists.txt @@ -77,6 +77,17 @@ target_link_libraries(test-segfault ${DBUS_INTERNAL_LIBRARIES}) add_executable(test-sleep-forever ${test-sleep-forever_SOURCES}) target_link_libraries(test-sleep-forever ${DBUS_INTERNAL_LIBRARIES}) +if (HAVE_SELINUX) +set (BASIC_CONF_SELINUX + " + + + " +) +endif() + ### keep these in creation order, i.e. uppermost dirs first set (TESTDIRS test/data @@ -126,21 +137,18 @@ ENDFOREACH(FILE_TYPE) ### generate test files MESSAGE(STATUS "Generating test files from templates into test directory") -FOREACH(FILE_TYPE *.conf.in *.service.in) + +FOREACH(FILE_TYPE *.in *.cmake) FOREACH(DIR ${TESTDIRS}) FILE(GLOB FILES "${CMAKE_SOURCE_DIR}/../${DIR}/${FILE_TYPE}" ) FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${DIR}) FOREACH(FILE ${FILES}) 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}) + STRING(REGEX REPLACE "\\.in|\\.cmake$" "" _OUTFILENAME ${FILENAME}) + SET (TARGET ${CMAKE_BINARY_DIR}/${DIR}/${_OUTFILENAME}) configure_file(${FILE} ${TARGET} @ONLY IMMEDIATE) IF (CONFIG_VERBOSE) - MESSAGE("${FILE}") + MESSAGE("generating in ${DIR} from ${FILENAME} to ${_OUTFILENAME}") ENDIF (CONFIG_VERBOSE) ENDFOREACH(FILE) ENDFOREACH(DIR) diff --git a/test/Makefile.am b/test/Makefile.am index e5fd756..67257f7 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -190,6 +190,16 @@ if DBUS_ENABLE_INSTALLED_TESTS $(testexec_PROGRAMS) endif DBUS_ENABLE_INSTALLED_TESTS +if (HAVE_SELINUX) +BASIC_CONF_SELINUX = \ + \ + \ + \ + +endif HAVE_SELINUX + ## keep these in creation order, i.e. uppermost dirs first TESTDIRS= \ data \ diff --git a/test/data/valid-config-files/basic.conf b/test/data/valid-config-files/basic.conf deleted file mode 100644 index 5297097..0000000 --- a/test/data/valid-config-files/basic.conf +++ /dev/null @@ -1,32 +0,0 @@ - - - mybususer - unix:path=/foo/bar - tcp:port=1234 - basic.d - /usr/share/foo - nonexistent.conf - - - - - 5000 - 5000 - 300 - 5000 - 6000 - 50 - 80 - 64 - 64 - 256 - - - - - - - diff --git a/test/data/valid-config-files/basic.conf.in b/test/data/valid-config-files/basic.conf.in new file mode 100644 index 0000000..3d850df --- /dev/null +++ b/test/data/valid-config-files/basic.conf.in @@ -0,0 +1,26 @@ + + + mybususer + unix:path=/foo/bar + tcp:port=1234 + basic.d + /usr/share/foo + nonexistent.conf + + + + + 5000 + 5000 + 300 + 5000 + 6000 + 50 + 80 + 64 + 64 + 256 + + @BASIC_CONF_SELINUX@ + -- 1.7.4.msysgit.0