Skip to content
Snippets Groups Projects
Commit 5371dac8 authored by Sébastien Blin's avatar Sébastien Blin
Browse files

misc: use BUILD_TESTING like the daemon and update instructions

Change-Id: I5e92e47ada4c4225c68065179245d96723397575
parent 0f628295
No related branches found
No related tags found
No related merge requests found
......@@ -33,7 +33,6 @@ include(${PROJECT_SOURCE_DIR}/extras/build/cmake/extra_tools.cmake)
option(WITH_DAEMON_SUBMODULE "Build with daemon submodule" ON)
option(JAMICORE_AS_SUBDIR "Build Jami-core as a subdir dependency" OFF)
option(ENABLE_TESTS "Build with tests" OFF)
option(WITH_WEBENGINE "Build with WebEngine" ON)
option(ENABLE_LIBWRAP "Enable libwrap (single process mode)" ON)
if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
......@@ -871,7 +870,7 @@ qt_import_qml_plugins(${PROJECT_NAME})
qt_finalize_executable(${PROJECT_NAME})
# tests
if(ENABLE_TESTS)
if(BUILD_TESTING)
message("Add Jami tests")
add_subdirectory(${TESTS_DIR})
endif()
......@@ -131,6 +131,11 @@ Notes:
- `--global-install` to install client-qt globally under /usr/local
- `--prefix` to change the destination of the install.
+ For developers:
+ `--asan` add address sanitizer on the binary
+ `--debug` enable debug symbols
+ `--testing` will build the tests for both the daemon and client
+ `--no-libwrap` will build the DBUS version.
## Build only the client
......
......@@ -389,6 +389,8 @@ def run_install(args):
install_args.append('-u')
if args.debug:
install_args.append('-d')
if args.testing:
install_args.append('-t')
if args.asan:
install_args.append('-A')
if args.no_libwrap:
......@@ -727,6 +729,9 @@ def parse_args():
default=True, action='store_false')
ap.add_argument('--qt', type=str,
help='Use the Qt path supplied')
ap.add_argument('--testing', dest='testing',
default=False, action='store_true',
help='Enable testing for both client and daemon')
ap.add_argument('--no-libwrap', dest='no_libwrap',
default=False, action='store_true',
help='Disable libwrap. Also set --disable-shared option to daemon configure')
......
......@@ -113,7 +113,7 @@ pipeline {
cd ${dockerTopDir}
./build.py --install --qt /usr/lib/libqt-jami/
cd build
cmake .. -DENABLE_TESTS=True
cmake .. -DBUILD_TESTING=True
make -j${cpuCount}
""")
// Run tests
......
......@@ -280,7 +280,7 @@ def build(config_str, qt_dir, tests):
"-DCMAKE_INSTALL_PREFIX=" + os.getcwd(),
"-DCMAKE_SYSTEM_VERSION=" + WIN_SDK_VERSION,
"-DCMAKE_BUILD_TYPE=" + "Release",
"-DENABLE_TESTS=" + str(tests).lower(),
"-DBUILD_TESTING=" + str(tests).lower(),
"-DBETA=" + str((0, 1)[config_str == "Beta"]),
]
......
......@@ -48,8 +48,9 @@ enable_webengine=true
asan=
extra_cmake_flags=''
arch=''
enable_testing=false
while getopts gsc:dQ:P:p:uWwa:AD: OPT; do
while getopts gsc:dQ:P:p:uWwa:AtD: OPT; do
case "$OPT" in
g)
global='true'
......@@ -84,6 +85,9 @@ while getopts gsc:dQ:P:p:uWwa:AD: OPT; do
A)
asan='true'
;;
t)
enable_testing='true'
;;
D)
extra_cmake_flags="${OPTARG}"
;;
......@@ -202,6 +206,12 @@ if [ "${asan}" = "true" ]; then
client_cmake_flags+=(-DENABLE_ASAN=true)
fi
if [ "${enable_testing}" = "true" ]; then
client_cmake_flags+=(-DBUILD_TESTING=On)
else
client_cmake_flags+=(-DBUILD_TESTING=Off)
fi
if [[ "$OSTYPE" == "darwin"* ]]; then
#detect arch for macos
CMAKE_OSX_ARCHITECTURES="arm64"
......
......@@ -38,7 +38,7 @@
#include <clocale>
#ifndef ENABLE_TESTS
#ifndef BUILD_TESTING
int
main(int argc, char* argv[])
{
......
......@@ -868,7 +868,7 @@ UtilsAdapter::urlFromLocalPath(const QString& filePath) const
return QUrl::fromLocalFile(filePath);
}
#ifdef ENABLE_TESTS
#ifdef BUILD_TESTING
// Must only be used for testing purposes
QString
UtilsAdapter::createDummyImage() const
......
......@@ -172,7 +172,7 @@ public:
Q_INVOKABLE QString getMimeNameForUrl(const QUrl& fileUrl) const;
Q_INVOKABLE QUrl urlFromLocalPath(const QString& filePath) const;
#ifdef ENABLE_TESTS
#ifdef BUILD_TESTING
Q_INVOKABLE QString createDummyImage() const;
#endif
Q_INVOKABLE bool isWayland() const;
......
......@@ -69,7 +69,6 @@ string(SUBSTRING ${CMAKE_GENERATOR} 0 14 CMAKE_GENERATOR_SHORT)
if(CMAKE_GENERATOR_SHORT MATCHES "Visual Studio ")
message(STATUS "Generating VS project")
set(CMAKE_CXX_COMPILER_ID "MSVC")
set(ENABLE_TEST false)
add_definitions(-DUNICODE -D_UNICODE)
remove_definitions(-D_MBCS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi /W0 /MP /EHsc")
......@@ -156,10 +155,6 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_INSTALL_RPATH "${CMAKE_CURRENT_SOURCE_DIR}")
endif()
if(NOT ENABLE_TEST)
set(ENABLE_TEST false)
endif()
if(NOT (${ENABLE_VIDEO} MATCHES false))
message(STATUS "VIDEO enabled")
set(ENABLE_VIDEO 1 CACHE BOOL "Enable video")
......@@ -453,7 +448,7 @@ set(LIBCLIENT_HEADERS_PRIVATE
private/namedirectory_p.h
private/smartInfoHub_p.h)
if(ENABLE_LIBWRAP AND (NOT ENABLE_TEST))
if(ENABLE_LIBWRAP)
list(APPEND LIBCLIENT_HEADERS_PRIVATE
qtwrapper/callmanager_wrap.h
qtwrapper/configurationmanager_wrap.h
......@@ -463,9 +458,7 @@ if(ENABLE_LIBWRAP AND (NOT ENABLE_TEST))
qtwrapper/pluginmanager_wrap.h)
endif()
if(NOT ENABLE_TEST)
qt_wrap_cpp(LIBCLIENT_HEADERS_MOC ${LIBCLIENT_HEADERS_PRIVATE})
endif()
qt_wrap_cpp(LIBCLIENT_HEADERS_MOC ${LIBCLIENT_HEADERS_PRIVATE})
foreach(MODULE ${QT_MODULES})
list(APPEND QT_LIBS "Qt::${MODULE}")
......
......@@ -49,7 +49,7 @@ target_include_directories(test_common_obj PRIVATE
${CMAKE_SOURCE_DIR}/src)
target_link_directories(test_common_obj PRIVATE ${CLIENT_LINK_DIRS})
target_link_libraries(test_common_obj ${QML_TEST_LIBS})
target_compile_definitions(test_common_obj PRIVATE ENABLE_TESTS="ON")
target_compile_definitions(test_common_obj PRIVATE BUILD_TESTING="ON")
set(COMMON_TESTS_SOURCES
${QML_RESOURCES}
......@@ -101,7 +101,7 @@ set(ALL_TESTS_INCLUDES
function(setup_test TEST_NAME TEST_SOURCES TEST_INPUT)
string(TOLOWER ${TEST_NAME} TEST_BINARY_NAME)
add_executable(${TEST_BINARY_NAME} ${TEST_SOURCES})
target_compile_definitions(${TEST_BINARY_NAME} PRIVATE ENABLE_TESTS="ON")
target_compile_definitions(${TEST_BINARY_NAME} PRIVATE BUILD_TESTING="ON")
target_link_libraries(${TEST_BINARY_NAME} ${ALL_TESTS_LIBS})
target_include_directories(${TEST_BINARY_NAME} PUBLIC ${ALL_TESTS_INCLUDES})
if(MSVC)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment