2014-07-20 12:13:25 +02:00
|
|
|
#
|
2019-01-01 15:40:51 +01:00
|
|
|
# Copyright (C) 2014-2019 Sébastien Helleu <flashcode@flashtux.org>
|
2014-07-20 12:13:25 +02:00
|
|
|
#
|
|
|
|
# This file is part of WeeChat, the extensible chat client.
|
|
|
|
#
|
|
|
|
# WeeChat is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# WeeChat is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
2018-11-29 23:16:07 +01:00
|
|
|
# along with WeeChat. If not, see <https://www.gnu.org/licenses/>.
|
2014-07-20 12:13:25 +02:00
|
|
|
#
|
|
|
|
|
|
|
|
enable_language(CXX)
|
|
|
|
|
|
|
|
remove_definitions(-DHAVE_CONFIG_H)
|
2014-08-25 07:38:38 +02:00
|
|
|
include_directories(${CPPUTEST_INCLUDE_DIRS} ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR})
|
2014-07-20 12:13:25 +02:00
|
|
|
|
2019-01-11 22:26:16 +01:00
|
|
|
# unit tests (core)
|
|
|
|
set(LIB_WEECHAT_UNIT_TESTS_CORE_SRC
|
2015-12-24 22:21:33 +01:00
|
|
|
unit/test-plugins.cpp
|
2019-01-11 22:26:16 +01:00
|
|
|
unit/core/test-core-arraylist.cpp
|
|
|
|
unit/core/test-core-eval.cpp
|
|
|
|
unit/core/test-core-hashtable.cpp
|
|
|
|
unit/core/test-core-hdata.cpp
|
|
|
|
unit/core/test-core-hook.cpp
|
|
|
|
unit/core/test-core-infolist.cpp
|
|
|
|
unit/core/test-core-list.cpp
|
|
|
|
unit/core/test-core-secure.cpp
|
|
|
|
unit/core/test-core-string.cpp
|
|
|
|
unit/core/test-core-url.cpp
|
|
|
|
unit/core/test-core-utf8.cpp
|
|
|
|
unit/core/test-core-util.cpp
|
|
|
|
unit/gui/test-gui-line.cpp
|
2017-10-07 16:51:25 +02:00
|
|
|
scripts/test-scripts.cpp
|
2014-07-20 12:13:25 +02:00
|
|
|
)
|
2019-01-11 22:26:16 +01:00
|
|
|
add_library(weechat_unit_tests_core STATIC ${LIB_WEECHAT_UNIT_TESTS_CORE_SRC})
|
|
|
|
|
|
|
|
# unit tests (plugins)
|
|
|
|
set(LIB_WEECHAT_UNIT_TESTS_PLUGINS_SRC
|
2019-01-20 15:17:21 +01:00
|
|
|
unit/plugins/irc/test-irc-color.cpp
|
2019-01-11 22:26:16 +01:00
|
|
|
unit/plugins/irc/test-irc-config.cpp
|
2019-01-13 14:47:35 +01:00
|
|
|
unit/plugins/irc/test-irc-protocol.cpp
|
2019-01-11 22:26:16 +01:00
|
|
|
)
|
|
|
|
add_library(weechat_unit_tests_plugins MODULE ${LIB_WEECHAT_UNIT_TESTS_PLUGINS_SRC})
|
2014-07-20 12:13:25 +02:00
|
|
|
|
2017-01-13 20:57:59 +01:00
|
|
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
|
|
|
list(APPEND EXTRA_LIBS "intl")
|
|
|
|
if(HAVE_BACKTRACE)
|
|
|
|
list(APPEND EXTRA_LIBS "execinfo")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2014-07-20 12:13:25 +02:00
|
|
|
# binary to run tests
|
2014-08-14 19:13:32 +02:00
|
|
|
set(WEECHAT_TESTS_SRC tests.cpp tests.h)
|
2014-07-20 12:13:25 +02:00
|
|
|
add_executable(tests ${WEECHAT_TESTS_SRC})
|
2019-03-24 13:40:16 +01:00
|
|
|
target_link_libraries(tests
|
2019-03-24 09:02:04 +01:00
|
|
|
weechat_core
|
|
|
|
weechat_plugins
|
|
|
|
weechat_gui_common
|
|
|
|
weechat_gui_headless
|
|
|
|
weechat_ncurses_fake
|
|
|
|
weechat_unit_tests_core
|
2014-08-30 14:14:44 +02:00
|
|
|
# due to circular references, we must link two times with libweechat_core.a
|
2019-03-24 09:02:04 +01:00
|
|
|
weechat_core
|
2014-07-21 21:18:57 +02:00
|
|
|
${EXTRA_LIBS}
|
|
|
|
${CURL_LIBRARIES}
|
2019-01-20 16:53:00 +01:00
|
|
|
${CPPUTEST_LIBRARIES}
|
|
|
|
-rdynamic)
|
2014-07-20 12:13:25 +02:00
|
|
|
add_dependencies(tests
|
2019-03-24 13:40:16 +01:00
|
|
|
weechat_core
|
|
|
|
weechat_plugins
|
|
|
|
weechat_gui_common
|
|
|
|
weechat_gui_headless
|
2014-07-20 12:13:25 +02:00
|
|
|
weechat_ncurses_fake
|
2019-01-11 22:26:16 +01:00
|
|
|
weechat_unit_tests_core)
|
2014-07-20 12:13:25 +02:00
|
|
|
|
|
|
|
# test for cmake (ctest)
|
|
|
|
add_test(NAME unit
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
2014-07-22 21:04:59 +02:00
|
|
|
COMMAND tests -v)
|
2017-07-04 22:11:14 +02:00
|
|
|
set_property(TEST unit PROPERTY
|
2017-07-05 21:33:19 +02:00
|
|
|
ENVIRONMENT "WEECHAT_TESTS_ARGS=-p;"
|
2017-10-07 16:51:25 +02:00
|
|
|
"WEECHAT_EXTRA_LIBDIR=${PROJECT_BINARY_DIR}/src;"
|
2019-01-11 22:26:16 +01:00
|
|
|
"WEECHAT_TESTS_SCRIPTS_DIR=${CMAKE_CURRENT_SOURCE_DIR}/scripts/python"
|
|
|
|
"WEECHAT_TESTS_PLUGINS_LIB=${CMAKE_CURRENT_BINARY_DIR}/libweechat_unit_tests_plugins.so")
|