Author: abroekhuis
Date: Wed Jul 27 11:35:39 2011
New Revision: 1151432

URL: http://svn.apache.org/viewvc?rev=1151432&view=rev
Log:
Added support for running tests without using CMake's CTest. Added a run.sh 
script to a deployed target.

Added:
    incubator/celix/trunk/cmake/Test.cmake
      - copied, changed from r1151381, incubator/celix/trunk/CMakeLists.txt
    incubator/celix/trunk/cmake/run.sh.in
Modified:
    incubator/celix/trunk/CMakeLists.txt
    incubator/celix/trunk/cmake/Includes.cmake
    incubator/celix/trunk/cmake/Packaging.cmake
    incubator/celix/trunk/cmake/modules/FindCUnit.cmake
    incubator/celix/trunk/examples/CMakeLists.txt
    incubator/celix/trunk/utils/CMakeLists.txt
    incubator/celix/trunk/utils/private/test/array_list_test.c
    incubator/celix/trunk/utils/private/test/hash_map_test.c
    incubator/celix/trunk/utils/private/test/hash_map_test_hash.c
    incubator/celix/trunk/utils/private/test/linked_list_test.c

Modified: incubator/celix/trunk/CMakeLists.txt
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/CMakeLists.txt?rev=1151432&r1=1151431&r2=1151432&view=diff
==============================================================================
--- incubator/celix/trunk/CMakeLists.txt (original)
+++ incubator/celix/trunk/CMakeLists.txt Wed Jul 27 11:35:39 2011
@@ -49,4 +49,4 @@ add_subdirectory(log_writer)
 add_subdirectory(examples)
 
 include(target.cmake)
-enable_testing()
+#enable_testing()

Modified: incubator/celix/trunk/cmake/Includes.cmake
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/cmake/Includes.cmake?rev=1151432&r1=1151431&r2=1151432&view=diff
==============================================================================
--- incubator/celix/trunk/cmake/Includes.cmake (original)
+++ incubator/celix/trunk/cmake/Includes.cmake Wed Jul 27 11:35:39 2011
@@ -1,3 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
 
 include(FindAPR)
 IF(APR_FOUND)
@@ -10,4 +26,5 @@ include_directories(${APR_INCLUDE_DIR})
 include_directories("framework/private/include")
 include_directories("framework/public/include")
 
-include(cmake/Packaging.cmake)
\ No newline at end of file
+include(cmake/Packaging.cmake)
+include(cmake/Test.cmake)
\ No newline at end of file

Modified: incubator/celix/trunk/cmake/Packaging.cmake
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/cmake/Packaging.cmake?rev=1151432&r1=1151431&r2=1151432&view=diff
==============================================================================
--- incubator/celix/trunk/cmake/Packaging.cmake (original)
+++ incubator/celix/trunk/cmake/Packaging.cmake Wed Jul 27 11:35:39 2011
@@ -124,6 +124,12 @@ MACRO(deploy)
        endforeach(BUNDLE)
        
        CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/cmake/config.properties.in 
${CMAKE_CURRENT_BINARY_DIR}/deploy/${DEPLOY_NAME}/config.properties @ONLY)
+       
+       set(FW_PATH ${CMAKE_BINARY_DIR}/framework)
+       set(UTILS_PATH ${CMAKE_BINARY_DIR}/utils)
+       set(LAUNCHER ${CMAKE_BINARY_DIR}/launcher/launcher)
+       CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/cmake/run.sh.in 
${CMAKE_CURRENT_BINARY_DIR}/deploy/${DEPLOY_NAME}/run.sh @ONLY)
+       
        install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/deploy/${DEPLOY_NAME} 
DESTINATION . COMPONENT ${DEPLOY_COMPONENT})
        ADD_DEPENDENCIES(deploy ${__deployTarget})
        #ADD_CUSTOM_TARGET(clean_${__packageTarget}

Copied: incubator/celix/trunk/cmake/Test.cmake (from r1151381, 
incubator/celix/trunk/CMakeLists.txt)
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/cmake/Test.cmake?p2=incubator/celix/trunk/cmake/Test.cmake&p1=incubator/celix/trunk/CMakeLists.txt&r1=1151381&r2=1151432&rev=1151432&view=diff
==============================================================================
--- incubator/celix/trunk/CMakeLists.txt (original)
+++ incubator/celix/trunk/cmake/Test.cmake Wed Jul 27 11:35:39 2011
@@ -15,38 +15,22 @@
 # specific language governing permissions and limitations
 # under the License.
 
-cmake_minimum_required (VERSION 2.6)
-project (Celix C)
+include(FindCUnit)
 
-
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} 
"${CMAKE_SOURCE_DIR}/cmake/modules/")
-
-SET(CMAKE_BUILD_TYPE "Debug")
-SET(CMAKE_C_FLAGS "-D_GNU_SOURCE -std=gnu99 ${CMAKE_C_FLAGS}")
-SET(CMAKE_INSTALL_COMPONENT "framework")
-
-ADD_CUSTOM_TARGET(install-fw
-  ${CMAKE_COMMAND}
-  -D "CMAKE_INSTALL_COMPONENT=framework"
-  -D "CMAKE_INSTALL_PREFIX=test"
-  -P "cmake_install.cmake"
-  )
-
-include(cmake/Includes.cmake)  
-
-add_subdirectory(utils)
-add_subdirectory(framework)
-add_subdirectory(launcher)
-
-add_subdirectory(dependency_manager)
-
-add_subdirectory(shell)
-add_subdirectory(shell_tui)
-
-add_subdirectory(log_service)
-add_subdirectory(log_writer)
-
-add_subdirectory(examples)
-
-include(target.cmake)
-enable_testing()
+ADD_CUSTOM_TARGET(test)
+MACRO(run_test)
+    PARSE_ARGUMENTS(TEST "" "" ${ARGN})
+    LIST(GET TEST_DEFAULT_ARGS 0 EXEC)
+       
+       SET(__testTarget test_${EXEC})
+       
+       make_directory(${PROJECT_BINARY_DIR}/test_results)
+               
+       add_custom_target(${__testTarget}
+               ${EXEC} ${EXEC} 
+               COMMAND xsltproc --path ${CUNIT_SHARE_DIR} 
${CUNIT_SHARE_DIR}/CUnit-Run.xsl 
${PROJECT_BINARY_DIR}/test_results/${EXEC}-Results.xml > ${EXEC}-Results.html
+               COMMAND xsltproc --path ${CUNIT_SHARE_DIR} 
${CUNIT_SHARE_DIR}/CUnit-List.xsl 
${PROJECT_BINARY_DIR}/test_results/${EXEC}-Listing.xml > ${EXEC}-Listing.html 
+               WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/test_results
+       )
+       ADD_DEPENDENCIES(test ${__testTarget})
+ENDMACRO(run_test)
\ No newline at end of file

Modified: incubator/celix/trunk/cmake/modules/FindCUnit.cmake
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/cmake/modules/FindCUnit.cmake?rev=1151432&r1=1151431&r2=1151432&view=diff
==============================================================================
--- incubator/celix/trunk/cmake/modules/FindCUnit.cmake (original)
+++ incubator/celix/trunk/cmake/modules/FindCUnit.cmake Wed Jul 27 11:35:39 2011
@@ -1,14 +1,19 @@
-#
-# Find the CppUnit includes and library
-#
-# This module defines
-# CPPUNIT_INCLUDE_DIR, where to find tiff.h, etc.
-# CPPUNIT_LIBRARIES, the libraries to link against to use CppUnit.
-# CPPUNIT_FOUND, If false, do not try to use CppUnit.
-
-# also defined, but not for general use are
-# CPPUNIT_LIBRARY, where to find the CppUnit library.
-# CPPUNIT_DEBUG_LIBRARY, where to find the CppUnit library in debug mode.
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
 
 if (NOT WIN32)
        include(FindCurses)
@@ -20,6 +25,12 @@ FIND_PATH(CUNIT_INCLUDE_DIR Basic.h
   /opt/local/include/CUnit  
 )
 
+FIND_PATH(CUNIT_SHARE_DIR CUnit-List.dtd
+       /usr/local/share/CUnit
+       /usr/share/CUnit
+       /opt/local/share/CUnit
+)
+
 # On unix system, debug and release have the same name
 FIND_LIBRARY(CUNIT_LIBRARY cunit
              ${CUNIT_INCLUDE_DIR}/../../lib

Added: incubator/celix/trunk/cmake/run.sh.in
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/cmake/run.sh.in?rev=1151432&view=auto
==============================================================================
--- incubator/celix/trunk/cmake/run.sh.in (added)
+++ incubator/celix/trunk/cmake/run.sh.in Wed Jul 27 11:35:39 2011
@@ -0,0 +1,2 @@
+DYLD_LIBRARY_PATH=@FW_PATH@:@UTILS_PATH@
+@LAUNCHER@
\ No newline at end of file

Modified: incubator/celix/trunk/examples/CMakeLists.txt
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/examples/CMakeLists.txt?rev=1151432&r1=1151431&r2=1151432&view=diff
==============================================================================
--- incubator/celix/trunk/examples/CMakeLists.txt (original)
+++ incubator/celix/trunk/examples/CMakeLists.txt Wed Jul 27 11:35:39 2011
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
 add_subdirectory(hello_world)
 add_subdirectory(mongoose)
 

Modified: incubator/celix/trunk/utils/CMakeLists.txt
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/utils/CMakeLists.txt?rev=1151432&r1=1151431&r2=1151432&view=diff
==============================================================================
--- incubator/celix/trunk/utils/CMakeLists.txt (original)
+++ incubator/celix/trunk/utils/CMakeLists.txt Wed Jul 27 11:35:39 2011
@@ -29,8 +29,6 @@ target_link_libraries(utils ${APR_LIBRAR
 
 install(TARGETS utils DESTINATION lib COMPONENT framework)
 
-include(FindCUnit)
-
 include_directories(${CUNIT_INCLUDE_DIRS})
 include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
 include_directories("${PROJECT_SOURCE_DIR}/utils/private/include")
@@ -47,8 +45,7 @@ target_link_libraries(array_list_test ut
 add_executable(linked_list_test private/test/linked_list_test.c)
 target_link_libraries(linked_list_test utils ${CUNIT_LIBRARIES})
 
-enable_testing()
-add_test (hash_map_test ${EXECUTABLE_OUTPUT_PATH}/hash_map_test)
-add_test (hash_map_test_hash ${EXECUTABLE_OUTPUT_PATH}/hash_map_test_hash)
-add_test (array_list_test ${EXECUTABLE_OUTPUT_PATH}/array_list_test)
-add_test (linked_list_test ${EXECUTABLE_OUTPUT_PATH}/linked_list_test)
+run_test(array_list_test)
+run_test(hash_map_test)
+run_test(hash_map_test_hash)
+run_test(linked_list_test)

Modified: incubator/celix/trunk/utils/private/test/array_list_test.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/utils/private/test/array_list_test.c?rev=1151432&r1=1151431&r2=1151432&view=diff
==============================================================================
--- incubator/celix/trunk/utils/private/test/array_list_test.c (original)
+++ incubator/celix/trunk/utils/private/test/array_list_test.c Wed Jul 27 
11:35:39 2011
@@ -346,12 +346,9 @@ int main (int argc, char** argv) {
          return CU_get_error();
        }
 
-       /* Run all tests using the CUnit Basic interface */
-       CU_set_output_filename("ArrayList");
+       CU_set_output_filename(argv[1]);
        CU_list_tests_to_file();
        CU_automated_run_tests();
-//     CU_basic_set_mode(CU_BRM_VERBOSE);
-//     CU_basic_run_tests();
        CU_cleanup_registry();
        return CU_get_error();
 }

Modified: incubator/celix/trunk/utils/private/test/hash_map_test.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/utils/private/test/hash_map_test.c?rev=1151432&r1=1151431&r2=1151432&view=diff
==============================================================================
--- incubator/celix/trunk/utils/private/test/hash_map_test.c (original)
+++ incubator/celix/trunk/utils/private/test/hash_map_test.c Wed Jul 27 
11:35:39 2011
@@ -23,7 +23,7 @@
  *      Author: alexanderb
  */
 #include <stdio.h>
-#include <Basic.h>
+#include <Automated.h>
 
 #include "celixbool.h"
 
@@ -467,9 +467,9 @@ int main (int argc, char** argv) {
          return CU_get_error();
        }
 
-       /* Run all tests using the CUnit Basic interface */
-       CU_basic_set_mode(CU_BRM_VERBOSE);
-       CU_basic_run_tests();
+       CU_set_output_filename(argv[1]);
+       CU_list_tests_to_file();
+       CU_automated_run_tests();
        CU_cleanup_registry();
        return CU_get_error();
 }

Modified: incubator/celix/trunk/utils/private/test/hash_map_test_hash.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/utils/private/test/hash_map_test_hash.c?rev=1151432&r1=1151431&r2=1151432&view=diff
==============================================================================
--- incubator/celix/trunk/utils/private/test/hash_map_test_hash.c (original)
+++ incubator/celix/trunk/utils/private/test/hash_map_test_hash.c Wed Jul 27 
11:35:39 2011
@@ -25,7 +25,7 @@
 #include <stdio.h>
 #include <string.h>
 
-#include <Basic.h>
+#include <Automated.h>
 
 #include "hash_map.h"
 #include "hash_map_private.h"
@@ -349,9 +349,9 @@ int main (int argc, char** argv) {
          return CU_get_error();
        }
 
-       /* Run all tests using the CUnit Basic interface */
-       CU_basic_set_mode(CU_BRM_VERBOSE);
-       CU_basic_run_tests();
+       CU_set_output_filename(argv[1]);
+       CU_list_tests_to_file();
+       CU_automated_run_tests();
        CU_cleanup_registry();
        return CU_get_error();
 }

Modified: incubator/celix/trunk/utils/private/test/linked_list_test.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/utils/private/test/linked_list_test.c?rev=1151432&r1=1151431&r2=1151432&view=diff
==============================================================================
--- incubator/celix/trunk/utils/private/test/linked_list_test.c (original)
+++ incubator/celix/trunk/utils/private/test/linked_list_test.c Wed Jul 27 
11:35:39 2011
@@ -25,7 +25,7 @@
 #include <stdio.h>
 #include <apr_pools.h>
 
-#include "Basic.h"
+#include <Automated.h>
 #include "linkedlist.h"
 
 apr_pool_t *memory_pool;
@@ -93,9 +93,9 @@ int main (int argc, char** argv) {
          return CU_get_error();
        }
 
-       /* Run all tests using the CUnit Basic interface */
-       CU_basic_set_mode(CU_BRM_VERBOSE);
-       CU_basic_run_tests();
+       CU_set_output_filename(argv[1]);
+       CU_list_tests_to_file();
+       CU_automated_run_tests();
        CU_cleanup_registry();
        return CU_get_error();
 }


Reply via email to