Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=0fc851e801d92bc8013ccbafa30449d537d4a3f0

commit 0fc851e801d92bc8013ccbafa30449d537d4a3f0
Author: Michel Hermier <[email protected]>
Date:   Thu Nov 21 00:16:14 2013 +0100

cmake: Make ctest aware.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9c3f833..50f6d60 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,6 +7,8 @@ include (CheckIncludeFile)
include (CheckIncludeFiles)
include (CheckFunctionExists)

+enable_testing()
+
string(TOLOWER ${CMAKE_PROJECT_NAME} CMAKE_PROJECT_NAME_LOWER)
set (PACMAN_G2_VERSION 3.8.9)
set (PACMAN_G2_LIB_VERSION ${PACMAN_G2_VERSION})
@@ -111,8 +113,5 @@ ADD_SUBDIRECTORY(scripts)
if(NOT DISABLE_STATIC_BUILD)
ADD_SUBDIRECTORY(src/pacman-g2-static)
endif(NOT DISABLE_STATIC_BUILD)
-if(ENABLE_TESTS)
-  ADD_SUBDIRECTORY(pactest)
-endif(ENABLE_TESTS)
-
+ADD_SUBDIRECTORY(pactest)

diff --git a/pactest/CMakeLists.txt b/pactest/CMakeLists.txt
index b108d31..e6302e9 100644
--- a/pactest/CMakeLists.txt
+++ b/pactest/CMakeLists.txt
@@ -1,25 +1,11 @@
-get_property(pacman-g2-location TARGET ${CMAKE_PROJECT_NAME_LOWER} PROPERTY 
LOCATION)

-if(PYTHONINTERP_FOUND AND (EXISTS  ${pacman-g2-location}))
-  message("running tests on: ${pacman-g2-location}")
-  set(TEST_PARAMS "-v;--test=./tests/*.py;-p ${pacman-g2-location}")
-  if(TESTS_GDB)
-    set(TEST_PARAMS "${TEST_PARAMS} --gdb")
-  endif(TESTS_GDB)
-  if(TESTS_VALGRIND)
-    set(TEST_PARAMS "${TEST_PARAMS} --valgrind")
-  endif(TESTS_VALGRIND)
-  if(TESTS_ADDITIONAL_ARGS)
-    set(TEST_PARAMS "${TEST_PARAMS} ${TESTS_ADDITIONAL_ARGS}")
-  endif(TESTS_ADDITIONAL_ARGS)
-  execute_process(COMMAND python ./pactest.py ${TEST_PARAMS}
-                 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-                 OUTPUT_VARIABLE outTest
-                 RESULT_VARIABLE resTest
-                 ERROR_VARIABLE  errTest)
-  message("test output: ${outTest}")
-  #message("res output: ${resTest}")
-  #message("err output: ${errTest}")
+if(PYTHONINTERP_FOUND)
+  FILE(GLOB PACMAN_G2_TEST_FILES tests/*.py)
+  foreach(PACMAN_G2_TEST_FILE ${PACMAN_G2_TEST_FILES})
+    GET_FILENAME_COMPONENT(PACMAN_G2_TEST_NAME ${PACMAN_G2_TEST_FILE} NAME_WE)
+    add_test(${PACMAN_G2_TEST_NAME} python 
${CMAKE_CURRENT_SOURCE_DIR}/pactest.py --test=${PACMAN_G2_TEST_FILE} -p 
${CMAKE_BINARY_DIR}/src/pacman-g2/pacman-g2 --debug=-1)
+  endforeach(PACMAN_G2_TEST_FILE)
else()
-  message(FATAL_ERROR "Running the tests requires python and a successful 
build")
-endif(PYTHONINTERP_FOUND AND (EXISTS  ${pacman-g2-location}))
\ No newline at end of file
+  message(WARNING "Running the tests requires python and a successful build")
+endif(PYTHONINTERP_FOUND)
+
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to