incubator-celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From abroekh...@apache.org
Subject svn commit: r1528382 - in /incubator/celix/trunk: cmake/ cmake/modules/ framework/ framework/private/test/ hessian/source/private/test/ utils/
Date Wed, 02 Oct 2013 09:02:39 GMT
Author: abroekhuis
Date: Wed Oct  2 09:02:38 2013
New Revision: 1528382

URL: http://svn.apache.org/r1528382
Log:
CELIX-55: Updated test support

Added:
    incubator/celix/trunk/cmake/modules/FindCppUTest.cmake
Modified:
    incubator/celix/trunk/cmake/Test.cmake
    incubator/celix/trunk/cmake/modules/FindCUnit.cmake
    incubator/celix/trunk/framework/CMakeLists.txt
    incubator/celix/trunk/framework/private/test/framework_test.c
    incubator/celix/trunk/hessian/source/private/test/test_service_skeleton.c
    incubator/celix/trunk/utils/CMakeLists.txt

Modified: incubator/celix/trunk/cmake/Test.cmake
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/cmake/Test.cmake?rev=1528382&r1=1528381&r2=1528382&view=diff
==============================================================================
--- incubator/celix/trunk/cmake/Test.cmake (original)
+++ incubator/celix/trunk/cmake/Test.cmake Wed Oct  2 09:02:38 2013
@@ -35,6 +35,7 @@ MACRO(run_test)
 	ADD_DEPENDENCIES(test_cunit ${__testTarget})
 ENDMACRO(run_test)
 
+include(FindCppUTest)
 ADD_CUSTOM_TARGET(test_cppu)
 MACRO(run_cppu_test)
     PARSE_ARGUMENTS(TEST "" "" ${ARGN})
@@ -49,66 +50,4 @@ MACRO(run_cppu_test)
 		WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/test_results
 	)
 	ADD_DEPENDENCIES(test_cppu ${__testTarget})
-ENDMACRO(run_cppu_test)
-
-Include(FindRuby)
-ADD_CUSTOM_TARGET(testUnity)
-MACRO(run_unity_test)
-	PARSE_ARGUMENTS(TEST "SOURCE;MOCKS" "" ${ARGN})
-	LIST(GET TEST_DEFAULT_ARGS 0 EXEC)
-	
-	SET(__testTarget test_${EXEC})
-	SET(MOCKS "")
-	FOREACH(MOCK ${TEST_MOCKS})
-		get_filename_component(mockName ${MOCK} NAME_WE)
-		add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Mock${mockName}.c ${CMAKE_CURRENT_BINARY_DIR}/Mock${mockName}.h
-      		COMMAND ${RUBY_EXECUTABLE} ${PROJECT_SOURCE_DIR}/cmake/cmock/lib/cmock.rb -o${PROJECT_SOURCE_DIR}/cmake/cmock/test.yml
${CMAKE_CURRENT_SOURCE_DIR}/${MOCK}
-  			DEPENDS ${MOCK}
-  			COMMENT "Generating mock for ${MOCK}"
-      	)
-      	SET(MOCKS "${MOCKS}${CMAKE_CURRENT_BINARY_DIR}/Mock${mockName}.c")
-	ENDFOREACH(MOCK)
-
-	add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${EXEC}_runner.c
-		COMMAND ${RUBY_EXECUTABLE} ${PROJECT_SOURCE_DIR}/cmake/unity/generate_test_runner.rb 
-				${CMAKE_CURRENT_SOURCE_DIR}/${TEST_SOURCE} ${CMAKE_CURRENT_BINARY_DIR}/${EXEC}_runner.c
-		DEPENDS ${TEST_SOURCE}
-		COMMENT "Generating runner: ${CMAKE_CURRENT_BINARY_DIR}/${EXEC}_runner.c"
-	)
-	include_directories(${PROJECT_SOURCE_DIR}/cmake/cmock/src)
-	include_directories(${PROJECT_SOURCE_DIR}/cmake/unity/src)
-	include_directories(${CMAKE_CURRENT_BINARY_DIR})
-	add_executable(${EXEC} ${TEST_SOURCE} ${CMAKE_CURRENT_BINARY_DIR}/${EXEC}_runner.c 
-	    ${PROJECT_SOURCE_DIR}/cmake/unity/src/unity.c
-	    ${PROJECT_SOURCE_DIR}/cmake/cmock/src/cmock.c 
-		${MOCKS})
-	
-	message(${CMAKE_CURRENT_BINARY_DIR}/${EXEC})
-	#add_test(${EXEC} ${CMAKE_CURRENT_BINARY_DIR}/${EXEC})
-	add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/test_results/${EXEC}
-		COMMAND ${EXEC}
-		COMMAND touch ${PROJECT_BINARY_DIR}/test_results/${EXEC}
-		WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/test_results
-		COMMENT "Run tests"
-	)
-	
-	ADD_CUSTOM_TARGET(${__testTarget}
-    	DEPENDS ${PROJECT_BINARY_DIR}/test_results/${EXEC}
-    	COMMENT "Some comment")
-	ADD_DEPENDENCIES(testUnity ${__testTarget})
-ENDMACRO(run_unity_test)
-
-MACRO(gm)
-	PARSE_ARGUMENTS(MOCK "" "" ${ARGN})
-	LIST(GET MOCK_DEFAULT_ARGS 0 MOCKS)
-	
-	FOREACH(MOCK ${MOCKS})
-		get_filename_component(mockName ${MOCK} NAME_WE)
-		add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Mock${mockName}.c ${CMAKE_CURRENT_BINARY_DIR}/Mock${mockName}.h
-      		#COMMAND ${RUBY_EXECUTABLE} ${PROJECT_SOURCE_DIR}/cmake/cmock/lib/cmock.rb -o${PROJECT_SOURCE_DIR}/cmake/cmock/test.yml
${CMAKE_CURRENT_SOURCE_DIR}/${MOCK}
-  			#DEPENDS ${MOCK}
-  			COMMENT "Generating mock for ${MOCK}"
-      	)
-	ENDFOREACH(MOCK)
-	
-ENDMACRO(gm)
\ No newline at end of file
+ENDMACRO(run_cppu_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=1528382&r1=1528381&r2=1528382&view=diff
==============================================================================
--- incubator/celix/trunk/cmake/modules/FindCUnit.cmake (original)
+++ incubator/celix/trunk/cmake/modules/FindCUnit.cmake Wed Oct  2 09:02:38 2013
@@ -26,7 +26,7 @@ FIND_PATH(CUNIT_INCLUDE_DIR CUnit/Basic.
 )
 
 FIND_PATH(CUNIT_SHARE_DIR CUnit-List.dtd
-	/usr/local/share/CUnit
+	/usr/local/share/Cunit
   	/usr/share/CUnit
   	/opt/local/share/CUnit
 )

Added: incubator/celix/trunk/cmake/modules/FindCppUTest.cmake
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/cmake/modules/FindCppUTest.cmake?rev=1528382&view=auto
==============================================================================
--- incubator/celix/trunk/cmake/modules/FindCppUTest.cmake (added)
+++ incubator/celix/trunk/cmake/modules/FindCppUTest.cmake Wed Oct  2 09:02:38 2013
@@ -0,0 +1,38 @@
+# 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.
+
+FIND_PATH(CPPUTEST_INCLUDE_DIR NAMES CppUTest/TestHarness.h)
+FIND_PATH(CPPUTEST_EXT_INCLUDE_DIR NAMES CppUTestExt/MockSupport.h)
+
+FIND_LIBRARY(CPPUTEST_LIBRARY NAMES CppUtest)
+FIND_LIBRARY(CPPUTEST_EXT_LIBRARY NAMES CppUTestExt)
+
+# handle the QUIETLY and REQUIRED arguments and set CURL_FOUND to TRUE if 
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(CPPUTEST DEFAULT_MSG CPPUTEST_LIBRARY CPPUTEST_INCLUDE_DIR)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(CPPUTEST_EXT DEFAULT_MSG CPPUTEST_EXT_LIBRARY CPPUTEST_EXT_INCLUDE_DIR)
+
+IF(CPPUTEST_FOUND)
+  SET(CPPUTEST_LIBRARY ${CPPUTEST_LIBRARY})
+  SET(CPPUTEST_INCLUDE_DIR ${CPPUTEST_INCLUDE_DIR})
+ENDIF(CPPUTEST_FOUND)
+
+IF(CPPUTEST_EXT_FOUND)
+  SET(CPPUTEST_EXT_LIBRARY ${CPPUTEST_EXT_LIBRARY})
+  SET(CPPUTEST_EXT_INCLUDE_DIR ${CPPUTEST_EXT_INCLUDE_DIR})
+ENDIF(CPPUTEST_EXT_FOUND)
\ No newline at end of file

Modified: incubator/celix/trunk/framework/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/CMakeLists.txt?rev=1528382&r1=1528381&r2=1528382&view=diff
==============================================================================
--- incubator/celix/trunk/framework/CMakeLists.txt (original)
+++ incubator/celix/trunk/framework/CMakeLists.txt Wed Oct  2 09:02:38 2013
@@ -72,7 +72,7 @@ if (FRAMEWORK) 
     
     include_directories(${CUNIT_INCLUDE_DIRS})
     add_executable(framework_test private/test/framework_test)
-    target_link_libraries(framework_test utils framework ${CUNIT_LIBRARIES})
+    target_link_libraries(framework_test celix_utils celix_framework ${CUNIT_LIBRARIES})
     
     run_test(framework_test)
 endif (FRAMEWORK)

Modified: incubator/celix/trunk/framework/private/test/framework_test.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/test/framework_test.c?rev=1528382&r1=1528381&r2=1528382&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/test/framework_test.c (original)
+++ incubator/celix/trunk/framework/private/test/framework_test.c Wed Oct  2 09:02:38 2013
@@ -28,7 +28,7 @@
 
 #include <stddef.h>
 
-#include "CUnit/Basic.h"
+#include "Basic.h"
 #include "framework.h"
 
 void test_framework_create(void) {
@@ -43,7 +43,7 @@ void test_framework_create(void) {
 
     apr_pool_create(&memoryPool, NULL);
 
-	framework_create(&framework, memoryPool);
+	framework_create(&framework, memoryPool, NULL);
 
 
 	CU_ASSERT(framework != NULL);
@@ -59,8 +59,8 @@ void frameworkTest_startFw() {
 		if (s != APR_SUCCESS) {
 			CU_FAIL("Could not create memory pool");
 		} else {
-			FRAMEWORK framework = NULL;
-			if (framework_create(&framework, memoryPool) == CELIX_SUCCESS) {
+			framework_t framework = NULL;
+			if (framework_create(&framework, memoryPool, NULL) == CELIX_SUCCESS) {
 				if (fw_init(framework) == CELIX_SUCCESS) {
 					if (framework_start(framework) == CELIX_SUCCESS) {
 						CU_PASS("Framework started");
@@ -91,8 +91,8 @@ void frameworkTest_installBundle() {
 		if (s != APR_SUCCESS) {
 			CU_FAIL("Could not create memory pool");
 		} else {
-			FRAMEWORK framework = NULL;
-			if (framework_create(&framework, memoryPool) == CELIX_SUCCESS) {
+			framework_t framework = NULL;
+			if (framework_create(&framework, memoryPool, NULL) == CELIX_SUCCESS) {
 				if (fw_init(framework) == CELIX_SUCCESS) {
 					if (framework_start(framework) == CELIX_SUCCESS) {
 

Modified: incubator/celix/trunk/hessian/source/private/test/test_service_skeleton.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/hessian/source/private/test/test_service_skeleton.c?rev=1528382&r1=1528381&r2=1528382&view=diff
==============================================================================
--- incubator/celix/trunk/hessian/source/private/test/test_service_skeleton.c (original)
+++ incubator/celix/trunk/hessian/source/private/test/test_service_skeleton.c Wed Oct  2 09:02:38
2013
@@ -24,6 +24,7 @@
  *  \copyright	Apache License, Version 2.0
  */
 #include <stddef.h>
+#include <stdio.h>
 
 #include "hessian_2.0_in.h"
 

Modified: incubator/celix/trunk/utils/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/utils/CMakeLists.txt?rev=1528382&r1=1528381&r2=1528382&view=diff
==============================================================================
--- incubator/celix/trunk/utils/CMakeLists.txt (original)
+++ incubator/celix/trunk/utils/CMakeLists.txt Wed Oct  2 09:02:38 2013
@@ -71,7 +71,7 @@ if (UTILS) 
     run_test(hash_map_test_hash)
     run_test(linked_list_test)
     
-    run_unity_test(unity_bla SOURCE private/test/testUnity.c MOCKS public/include/tomock.h)
+    #run_unity_test(unity_bla SOURCE private/test/testUnity.c MOCKS public/include/tomock.h)
     #add_test(unity_bla ${CMAKE_CURRENT_BINARY_DIR}/unity_bla)
     
     #SET(CMAKE_C_FLAGS "-D_GNU_SOURCE -std=gnu99 -fnested-functions ${CMAKE_C_FLAGS}")



Mime
View raw message