diff options
author | Alexander Golubev <fatzer2@gmail.com> | 2016-06-28 06:14:50 +0300 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2017-07-22 15:56:48 +0200 |
commit | f96187e5d85d5df993bb5233652e170fdf8c2fd4 (patch) | |
tree | 5717270429320a0ccada8b00c81833c117e2dfd9 | |
parent | f088e398856b58e486ddda87dfd343c8d93b4433 (diff) | |
download | tdelibs-f96187e5d85d5df993bb5233652e170fdf8c2fd4.tar.gz tdelibs-f96187e5d85d5df993bb5233652e170fdf8c2fd4.zip |
Add dcop tests to cmake
Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
(cherry picked from commit 26d76a4c048d99e282356616ca8e1e5ad45a7f53)
-rw-r--r-- | dcop/CMakeLists.txt | 1 | ||||
-rw-r--r-- | dcop/tests/CMakeLists.txt | 62 | ||||
-rw-r--r-- | dcop/tests/driver.cpp | 4 | ||||
-rwxr-xr-x | dcop/tests/generate.pl | 2 | ||||
-rw-r--r-- | dcop/tests/run-tests.sh | 2 | ||||
-rw-r--r-- | dcop/tests/testcases | 10 |
6 files changed, 72 insertions, 9 deletions
diff --git a/dcop/CMakeLists.txt b/dcop/CMakeLists.txt index 8854ba88a..8a69361f7 100644 --- a/dcop/CMakeLists.txt +++ b/dcop/CMakeLists.txt @@ -14,6 +14,7 @@ add_subdirectory( dcopidl ) add_subdirectory( dcopidlng ) add_subdirectory( dcopidl2cpp ) add_subdirectory( client ) +add_subdirectory( tests ) include_directories( ${TQT_INCLUDE_DIRS} diff --git a/dcop/tests/CMakeLists.txt b/dcop/tests/CMakeLists.txt new file mode 100644 index 000000000..c3fe7daee --- /dev/null +++ b/dcop/tests/CMakeLists.txt @@ -0,0 +1,62 @@ +################################################# +# +# (C) 2016 Alexander Golubev +# fatzer2 (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${TQT_INCLUDE_DIRS} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/dcop + ${CMAKE_SOURCE_DIR}/kdecore + ${CMAKE_BINARY_DIR}/kdecore +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### checks #################################### + +tde_add_check_executable( dcop_test AUTOMOC + SOURCES test.cpp ${CMAKE_CURRENT_BINARY_DIR}/test.skel ${CMAKE_CURRENT_BINARY_DIR}/test.h + LINK kdecore-shared +) + +tde_add_check_executable( driver AUTOMOC + SOURCES driver.cpp ${CMAKE_CURRENT_BINARY_DIR}/test.stub ${CMAKE_CURRENT_BINARY_DIR}/test.h + LINK kdecore-shared +) + +add_test( NAME dcop-tests COMMAND sh -x "${CMAKE_CURRENT_SOURCE_DIR}/run-tests.sh" + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" ) + + +##### test.h and files ########################## + +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test.h ${CMAKE_CURRENT_BINARY_DIR}/shell.generated + COMMAND perl "${CMAKE_CURRENT_SOURCE_DIR}/generate.pl" + <"${CMAKE_CURRENT_SOURCE_DIR}/testcases" + DEPENDS testcases generate.pl + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +) + +# a hack because *.skel and *.stub files have to be located the same place with the *.h +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test.skel + COMMAND ${CMAKE_COMMAND} -E copy_file + ${CMAKE_CURRENT_SOURCE_DIR}/test.skel ${CMAKE_CURRENT_BINARY_DIR}/ +) + +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test.stub + COMMAND ${CMAKE_COMMAND} -E copy_file + ${CMAKE_CURRENT_SOURCE_DIR}/test.stub ${CMAKE_CURRENT_BINARY_DIR}/ +) diff --git a/dcop/tests/driver.cpp b/dcop/tests/driver.cpp index 147d2a748..5ff057649 100644 --- a/dcop/tests/driver.cpp +++ b/dcop/tests/driver.cpp @@ -20,8 +20,8 @@ Driver::Driver(const char* app) } -TQTextStream output( fopen( "driver.returns", "w" ) , IO_WriteOnly ); -#include <iostream> +TQTextStream output( fopen( "driver.returns", "w" ) , IO_WriteOnly ); + void Driver::test() { // This is written like this to allow the potentially ASYNC calls to be syncronized diff --git a/dcop/tests/generate.pl b/dcop/tests/generate.pl index cd4697d3f..9ef1f13fc 100755 --- a/dcop/tests/generate.pl +++ b/dcop/tests/generate.pl @@ -34,7 +34,7 @@ print HEADER <<END; class Test2; // this has to work too -#include <qstring.h> +#include <tqstring.h> diff --git a/dcop/tests/run-tests.sh b/dcop/tests/run-tests.sh index 216c29aef..b088905b0 100644 --- a/dcop/tests/run-tests.sh +++ b/dcop/tests/run-tests.sh @@ -19,7 +19,7 @@ echo '* Running driver mode' ./driver `dcop 'TestApp-*'` >driver.stdout echo '* Running shell mode' -source shell.generated >shell.returns +source ./shell.generated >shell.returns echo -n '* Comparing ... ' diff --git a/dcop/tests/testcases b/dcop/tests/testcases index 0f16bdbe3..e2357eb1c 100644 --- a/dcop/tests/testcases +++ b/dcop/tests/testcases @@ -21,11 +21,11 @@ # Then you should put c++ style arguments: # QString::fromLatin1("string with spaces"),4,"string_with_spaces" # -# Note that the first argument has type QString and the last type const char* +# Note that the first argument has type TQString and the last type const char* # (adapt accordingly) # // 1. easy case -QString +TQString url () { @@ -57,9 +57,9 @@ getObject // 2.2 overloading on type of args -QString +TQString identity -( QString x) +( TQString x) { return x; } @@ -87,7 +87,7 @@ getObject24 -#virtual QString identity( QCString ); +#virtual TQString identity( QCString ); # #// 4. simple template argument: #virtual |