From f545d181ade8736dfda93e8abb34ab93ac34e931 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sat, 5 Jan 2019 18:55:29 +0900 Subject: .travis.yml: use Homebrew addon and newer image The current default lands on a blunder with SSLSetALPNProtocols function (similar to https://stackoverflow.com/questions/46685756/how-do-i-make- use-of-sslsetalpnprotocols). --- .travis.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 0b2967cf..b515b8fb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,9 @@ addons: - g++-5 - qt57base - valgrind + homebrew: + packages: + - qt5 matrix: include: @@ -18,7 +21,8 @@ matrix: - os: linux compiler: clang - os: osx - env: [ 'ENV_EVAL="brew update && brew install qt5 && PATH=/usr/local/opt/qt/bin:$PATH"' ] + osx_image: xcode10 + env: [ 'ENV_EVAL="PATH=/usr/local/opt/qt/bin:$PATH"' ] before_install: - eval "${ENV_EVAL}" -- cgit v1.2.3 From 24c80a57fe1a79289f3028a81d6f8e0ac5f505fe Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sat, 5 Jan 2019 20:06:09 +0900 Subject: API version++; use QMediaResource from QtMultimedia (new dep) to detect m.video resolution The API version number should have been bumped long ago. --- .travis.yml | 1 + CMakeLists.txt | 8 +++++--- lib/events/roommessageevent.cpp | 17 ++++++++++------- libqmatrixclient.pri | 2 +- 4 files changed, 17 insertions(+), 11 deletions(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 0b2967cf..c0e8c097 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,7 @@ addons: packages: - g++-5 - qt57base + - qt57multimedia - valgrind matrix: diff --git a/CMakeLists.txt b/CMakeLists.txt index 8a3193a4..c48a7ba9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,7 +40,9 @@ foreach (FLAG all "" pedantic extra error=return-type no-unused-parameter no-gnu endif () endforeach () -find_package(Qt5 5.4.1 REQUIRED Network Gui) +# Qt 5.6+ is the formal requirement but for the sake of supporting UBPorts +# upstream Qt 5.4 is required. +find_package(Qt5 5.4.1 REQUIRED Network Gui Multimedia) get_filename_component(Qt5_Prefix "${Qt5_DIR}/../../../.." ABSOLUTE) if (GTAD_PATH) @@ -140,7 +142,7 @@ add_library(QMatrixClient ${libqmatrixclient_SRCS} ${libqmatrixclient_job_SRCS} ${libqmatrixclient_csdef_SRCS} ${libqmatrixclient_cswellknown_SRCS} ${libqmatrixclient_asdef_SRCS} ${libqmatrixclient_isdef_SRCS}) -set(API_VERSION "0.4") +set(API_VERSION "0.5") set_property(TARGET QMatrixClient PROPERTY VERSION "${API_VERSION}.0") set_property(TARGET QMatrixClient PROPERTY SOVERSION ${API_VERSION} ) set_property(TARGET QMatrixClient PROPERTY @@ -152,7 +154,7 @@ target_include_directories(QMatrixClient PUBLIC $ $ ) -target_link_libraries(QMatrixClient Qt5::Core Qt5::Network Qt5::Gui) +target_link_libraries(QMatrixClient Qt5::Core Qt5::Network Qt5::Gui Qt5::Multimedia) add_executable(qmc-example ${example_SRCS}) target_link_libraries(qmc-example Qt5::Core QMatrixClient) diff --git a/lib/events/roommessageevent.cpp b/lib/events/roommessageevent.cpp index d63ae2fe..c3007fa0 100644 --- a/lib/events/roommessageevent.cpp +++ b/lib/events/roommessageevent.cpp @@ -23,6 +23,7 @@ #include #include #include +#include using namespace QMatrixClient; using namespace EventContent; @@ -102,24 +103,26 @@ TypedBase* contentFromFile(const QFileInfo& file, bool asGenericFile) auto filePath = file.absoluteFilePath(); auto localUrl = QUrl::fromLocalFile(filePath); auto mimeType = QMimeDatabase().mimeTypeForFile(file); - auto payloadSize = file.size(); if (!asGenericFile) { auto mimeTypeName = mimeType.name(); if (mimeTypeName.startsWith("image/")) - return new ImageContent(localUrl, payloadSize, mimeType, - QImageReader(filePath).size()); + return new ImageContent(localUrl, file.size(), mimeType, + QImageReader(filePath).size(), + file.fileName()); // duration can only be obtained asynchronously and can only be reliably // done by starting to play the file. Left for a future implementation. if (mimeTypeName.startsWith("video/")) - return new VideoContent(localUrl, payloadSize, mimeType); + return new VideoContent(localUrl, file.size(), mimeType, + QMediaResource(localUrl).resolution(), + file.fileName()); if (mimeTypeName.startsWith("audio/")) - return new AudioContent(localUrl, payloadSize, mimeType); - + return new AudioContent(localUrl, file.size(), mimeType, + file.fileName()); } - return new FileContent(localUrl, payloadSize, mimeType); + return new FileContent(localUrl, file.size(), mimeType, file.fileName()); } RoomMessageEvent::RoomMessageEvent(const QString& plainBody, diff --git a/libqmatrixclient.pri b/libqmatrixclient.pri index 8ca43e56..eefaec67 100644 --- a/libqmatrixclient.pri +++ b/libqmatrixclient.pri @@ -1,4 +1,4 @@ -QT += network +QT += network multimedia CONFIG += c++14 warn_on rtti_off create_prl object_parallel_to_source win32-msvc* { -- cgit v1.2.3 From f438d37b169965ee0a9937b5178560a653f1197b Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Tue, 15 Jan 2019 16:43:24 +0900 Subject: .travis.yml: Use ninja on Linux --- .travis.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index fc143a62..6926f4ed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ addons: - ubuntu-toolchain-r-test - sourceline: 'ppa:beineri/opt-qt571-trusty' packages: + - ninja-build - g++-5 - qt57base - qt57multimedia @@ -27,19 +28,19 @@ matrix: before_install: - eval "${ENV_EVAL}" -- if [ "$TRAVIS_OS_NAME" = "linux" ]; then VALGRIND="valgrind $VALGRIND_OPTIONS"; . /opt/qt57/bin/qt57-env.sh; fi +- if [ "$TRAVIS_OS_NAME" = "linux" ]; then USE_NINJA="-GNinja"; VALGRIND="valgrind $VALGRIND_OPTIONS"; . /opt/qt57/bin/qt57-env.sh; fi install: - git clone https://github.com/QMatrixClient/matrix-doc.git - git clone --recursive https://github.com/KitsuneRal/gtad.git - pushd gtad -- cmake -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} . +- cmake $USE_NINJA -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} . - cmake --build . - popd before_script: - mkdir build && pushd build -- cmake -DMATRIX_DOC_PATH="matrix-doc" -DGTAD_PATH="gtad/gtad" -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} -DCMAKE_INSTALL_PREFIX=../install .. +- cmake $USE_NINJA -DMATRIX_DOC_PATH="matrix-doc" -DGTAD_PATH="gtad/gtad" -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} -DCMAKE_INSTALL_PREFIX=../install .. - cmake --build . --target update-api - popd -- cgit v1.2.3 From 3e69bcc053a66c385c2c0ad9e6ae2e36eefaf4e3 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Wed, 20 Feb 2019 19:56:55 +0900 Subject: .travis.yml: minor improvements --- .travis.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 6926f4ed..515c6c50 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,9 +11,6 @@ addons: - qt57base - qt57multimedia - valgrind - homebrew: - packages: - - qt5 matrix: include: @@ -24,7 +21,11 @@ matrix: compiler: clang - os: osx osx_image: xcode10 - env: [ 'ENV_EVAL="PATH=/usr/local/opt/qt/bin:$PATH"' ] + env: [ 'PATH=/usr/local/opt/qt/bin:$PATH' ] + addons: + homebrew: + packages: + - qt5 before_install: - eval "${ENV_EVAL}" -- cgit v1.2.3 From e48c5db65cb078c8ee84fd617441a78247671dad Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Thu, 21 Feb 2019 07:27:59 +0900 Subject: Travis CI: switch macOS builds to xcode10.1 image xcode10.0 seems to have Homebrew broken, and xcode9.4 has a problem with SSLSetALPNProtocols (see also commit f545d181ade8736dfda93e8abb34ab93ac34e931). --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 515c6c50..3aaa4039 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,7 @@ matrix: - os: linux compiler: clang - os: osx - osx_image: xcode10 + osx_image: xcode10.1 env: [ 'PATH=/usr/local/opt/qt/bin:$PATH' ] addons: homebrew: -- cgit v1.2.3 From 90623dd4a191d4cce2ddd514f313f689d0a135b0 Mon Sep 17 00:00:00 2001 From: Felix Rohrbach Date: Sun, 2 Oct 2016 08:01:22 +0900 Subject: Include olm via cmake (should work on Linux and MinGW) --- .travis.yml | 7 +++++++ CMakeLists.txt | 13 ++++++++++++- cmake/FindOlm.cmake | 30 ++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 cmake/FindOlm.cmake (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 3aaa4039..72be46cb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,6 +32,13 @@ before_install: - if [ "$TRAVIS_OS_NAME" = "linux" ]; then USE_NINJA="-GNinja"; VALGRIND="valgrind $VALGRIND_OPTIONS"; . /opt/qt57/bin/qt57-env.sh; fi install: +# olm +- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update; else sudo apt-get update -qq; fi +- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew install qt5; export PATH="$PATH:/usr/local/opt/qt/bin"; else sudo apt-get install -y qt5-default; fi +- git clone https://matrix.org/git/olm.git && cd olm && make && sudo make install && cd .. +- mkdir build && cd build +- cmake .. +# matrix-doc and gtad - git clone https://github.com/QMatrixClient/matrix-doc.git - git clone --recursive https://github.com/KitsuneRal/gtad.git - pushd gtad diff --git a/CMakeLists.txt b/CMakeLists.txt index ca597469..6718000c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,12 @@ if (NOT WIN32) include(GNUInstallDirs) endif(NOT WIN32) +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) +include(cmake/FindOlm.cmake) + +# Find includes in corresponding build directories +set(CMAKE_INCLUDE_CURRENT_DIR ON) + # Instruct CMake to run moc automatically when needed. set(CMAKE_AUTOMOC ON) @@ -47,6 +53,8 @@ endforeach () # upstream Qt 5.4 is required. find_package(Qt5 5.4.1 REQUIRED Network Gui Multimedia) get_filename_component(Qt5_Prefix "${Qt5_DIR}/../../../.." ABSOLUTE) +find_package(Olm REQUIRED) +get_filename_component(Olm_Prefix "${Olm_INCLUDE_DIRS}/.." ABSOLUTE) if (GTAD_PATH) get_filename_component(ABS_GTAD_PATH "${GTAD_PATH}" ABSOLUTE) @@ -64,11 +72,13 @@ if (CMAKE_BUILD_TYPE) message( STATUS "Build type: ${CMAKE_BUILD_TYPE}") endif(CMAKE_BUILD_TYPE) message( STATUS "Using compiler: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}" ) +message( STATUS "Install Prefix: ${CMAKE_INSTALL_PREFIX}" ) message( STATUS "Using Qt ${Qt5_VERSION} at ${Qt5_Prefix}" ) if (MATRIX_DOC_PATH AND GTAD_PATH) message( STATUS "Generating API stubs enabled" ) message( STATUS " Using GTAD at ${ABS_GTAD_PATH}" ) message( STATUS " Using API files at ${ABS_API_DEF_PATH}" ) + message( STATUS "Using libolm at ${Olm_Prefix}" ) endif () message( STATUS "=============================================================================" ) message( STATUS ) @@ -157,8 +167,9 @@ set_property(TARGET QMatrixClient APPEND PROPERTY target_include_directories(QMatrixClient PUBLIC $ $ + "${Olm_INCLUDE_DIRS}" ) -target_link_libraries(QMatrixClient Qt5::Core Qt5::Network Qt5::Gui Qt5::Multimedia) +target_link_libraries(QMatrixClient Qt5::Core Qt5::Network Qt5::Gui Qt5::Multimedia ${Olm_LIBRARIES}) add_executable(qmc-example ${example_SRCS}) target_link_libraries(qmc-example Qt5::Core QMatrixClient) diff --git a/cmake/FindOlm.cmake b/cmake/FindOlm.cmake new file mode 100644 index 00000000..3fea7b46 --- /dev/null +++ b/cmake/FindOlm.cmake @@ -0,0 +1,30 @@ +# - Try to find LibOlm + +# Uses the following variables to help find libolm: +# Olm_INCLUDE_DIR - include files +# Olm_LIBRARY_DIR - libraries +# Once done this will define +# Olm_FOUND - System has olm +# Olm_INCLUDE_DIRS - The olm include directories +# Olm_LIBRARIES - The libraries needed to use olm + +find_path(Olm_INCLUDE_DIRS NAMES + olm/olm.h + olm/inbound_group_session.h + olm/outbound_group_session.h + PATHS "${Olm_INCLUDE_DIR}" + DOC "Path to a directory with libolm header files" +) + +find_library(Olm_LIBRARIES NAMES olm + PATHS "${Olm_LIBRARY_DIR}" + DOC "Path to a directory with libolm libraries" +) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set OLM_FOUND to TRUE +# if all listed variables are TRUE +find_package_handle_standard_args(olm DEFAULT_MSG + Olm_LIBRARIES Olm_INCLUDE_DIRS) + +mark_as_advanced(Olm_INCLUDE_DIRS Olm_LIBRARIES) -- cgit v1.2.3 From d15ba3d77598c60b1eb713cb2a5348390071db44 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Tue, 25 Jun 2019 08:32:15 +0900 Subject: .travis.yml: add "update: true" to homebrew config --- .travis.yml | 1 + 1 file changed, 1 insertion(+) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 3aaa4039..e0b10ce8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,6 +24,7 @@ matrix: env: [ 'PATH=/usr/local/opt/qt/bin:$PATH' ] addons: homebrew: + update: true packages: - qt5 -- cgit v1.2.3 From b5f9e1bd20f985c18ec630fa496510018547b728 Mon Sep 17 00:00:00 2001 From: Alexey Andreyev Date: Wed, 26 Jun 2019 16:36:45 +0300 Subject: Change libQtOlm location. Fix .travis.yml and .appveyor.yml --- .appveyor.yml | 3 +++ .gitmodules | 6 +++--- .travis.yml | 10 +++------- 3rdparty/libQtOlm | 1 + CMakeLists.txt | 17 ++++++----------- cmake/FindOlm.cmake | 30 ------------------------------ lib/libQtOlm | 1 - 7 files changed, 16 insertions(+), 52 deletions(-) create mode 160000 3rdparty/libQtOlm delete mode 100644 cmake/FindOlm.cmake delete mode 160000 lib/libQtOlm (limited to '.travis.yml') diff --git a/.appveyor.yml b/.appveyor.yml index 410ad12e..fb5903c1 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -26,6 +26,9 @@ init: before_build: - git submodule update --init --recursive +- cd 3rdparty/libQtOlm +- git clone https://gitlab.matrix.org/matrix-org/olm.git +- cd ../.. - if %MAKETOOL% == cmake cmake -G "NMake Makefiles JOM" -H. -Bbuild -DCMAKE_CXX_FLAGS="/EHsc /W3" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX="%DEPLOY_DIR%" build_script: diff --git a/.gitmodules b/.gitmodules index 23158cd2..eb4c1815 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "lib/libQtOlm"] - path = lib/libQtOlm - url = git@gitlab.com:aa13q/libqtolm.git +[submodule "3rdparty/libQtOlm"] + path = 3rdparty/libQtOlm + url = https://gitlab.com/b0/libqtolm.git diff --git a/.travis.yml b/.travis.yml index 72be46cb..859cabfc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,13 +32,9 @@ before_install: - if [ "$TRAVIS_OS_NAME" = "linux" ]; then USE_NINJA="-GNinja"; VALGRIND="valgrind $VALGRIND_OPTIONS"; . /opt/qt57/bin/qt57-env.sh; fi install: -# olm -- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update; else sudo apt-get update -qq; fi -- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew install qt5; export PATH="$PATH:/usr/local/opt/qt/bin"; else sudo apt-get install -y qt5-default; fi -- git clone https://matrix.org/git/olm.git && cd olm && make && sudo make install && cd .. -- mkdir build && cd build -- cmake .. -# matrix-doc and gtad +- pushd 3rdparty/libQtOlm +- git clone https://gitlab.matrix.org/matrix-org/olm.git +- popd - git clone https://github.com/QMatrixClient/matrix-doc.git - git clone --recursive https://github.com/KitsuneRal/gtad.git - pushd gtad diff --git a/3rdparty/libQtOlm b/3rdparty/libQtOlm new file mode 160000 index 00000000..f610197b --- /dev/null +++ b/3rdparty/libQtOlm @@ -0,0 +1 @@ +Subproject commit f610197ba38ef87bbab8bcff1053bda684a5994a diff --git a/CMakeLists.txt b/CMakeLists.txt index d3906ffb..19fbdcbe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,11 +10,6 @@ if (NOT WIN32) include(GNUInstallDirs) endif(NOT WIN32) -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) - -# Find includes in corresponding build directories -set(CMAKE_INCLUDE_CURRENT_DIR ON) - # Instruct CMake to run moc automatically when needed. set(CMAKE_AUTOMOC ON) @@ -54,9 +49,9 @@ find_package(Qt5 5.4.1 REQUIRED Network Gui Multimedia) get_filename_component(Qt5_Prefix "${Qt5_DIR}/../../../.." ABSOLUTE) if ((NOT DEFINED USE_INTREE_LIBQOLM OR USE_INTREE_LIBQOLM) - AND EXISTS ${PROJECT_SOURCE_DIR}/lib/libQtOlm/lib/utils.h) - add_subdirectory(lib/libQtOlm EXCLUDE_FROM_ALL) - include_directories(lib/libQtOlm) + AND EXISTS ${PROJECT_SOURCE_DIR}/3rdparty/libQtOlm/lib/utils.h) + add_subdirectory(3rdparty/libQtOlm EXCLUDE_FROM_ALL) + include_directories(3rdparty/libQtOlm) if (NOT DEFINED USE_INTREE_LIBQOLM) set (USE_INTREE_LIBQOLM 1) endif () @@ -100,10 +95,10 @@ if (USE_INTREE_LIBQOLM) if (GIT_FOUND) execute_process(COMMAND "${GIT_EXECUTABLE}" rev-parse -q HEAD - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib/libQtOlm/lib - OUTPUT_VARIABLE LIB_GIT_SHA1 + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/3rdparty/libQtOlm + OUTPUT_VARIABLE QTOLM_GIT_SHA1 OUTPUT_STRIP_TRAILING_WHITESPACE) - message( STATUS " Library git SHA1: ${LIB_GIT_SHA1}") + message( STATUS " Library git SHA1: ${QTOLM_GIT_SHA1}") endif (GIT_FOUND) else () message( STATUS "Using libQtOlm ${QtOlm_VERSION} at ${QtOlm_DIR}") diff --git a/cmake/FindOlm.cmake b/cmake/FindOlm.cmake deleted file mode 100644 index 3fea7b46..00000000 --- a/cmake/FindOlm.cmake +++ /dev/null @@ -1,30 +0,0 @@ -# - Try to find LibOlm - -# Uses the following variables to help find libolm: -# Olm_INCLUDE_DIR - include files -# Olm_LIBRARY_DIR - libraries -# Once done this will define -# Olm_FOUND - System has olm -# Olm_INCLUDE_DIRS - The olm include directories -# Olm_LIBRARIES - The libraries needed to use olm - -find_path(Olm_INCLUDE_DIRS NAMES - olm/olm.h - olm/inbound_group_session.h - olm/outbound_group_session.h - PATHS "${Olm_INCLUDE_DIR}" - DOC "Path to a directory with libolm header files" -) - -find_library(Olm_LIBRARIES NAMES olm - PATHS "${Olm_LIBRARY_DIR}" - DOC "Path to a directory with libolm libraries" -) - -include(FindPackageHandleStandardArgs) -# handle the QUIETLY and REQUIRED arguments and set OLM_FOUND to TRUE -# if all listed variables are TRUE -find_package_handle_standard_args(olm DEFAULT_MSG - Olm_LIBRARIES Olm_INCLUDE_DIRS) - -mark_as_advanced(Olm_INCLUDE_DIRS Olm_LIBRARIES) diff --git a/lib/libQtOlm b/lib/libQtOlm deleted file mode 160000 index 5bfc4241..00000000 --- a/lib/libQtOlm +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5bfc42417d8ee741d2f5a723a2939c895734b92b -- cgit v1.2.3 From d5b4e6440dae82eebc86657dd2f828edaf81b180 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 7 Jul 2019 09:22:14 +0900 Subject: Fix qmake builds in CI --- .appveyor.yml | 14 ++++---------- .travis.yml | 4 ++-- libqmatrixclient.pri | 2 ++ 3 files changed, 8 insertions(+), 12 deletions(-) (limited to '.travis.yml') diff --git a/.appveyor.yml b/.appveyor.yml index 8831b2e3..4e2d4b5d 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -7,16 +7,9 @@ environment: QTDIR: C:\Qt\5.9\msvc2017_64 VCVARS: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvars64.bat" PLATFORM: - MAKETOOL: cmake - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - QTDIR: C:\Qt\5.9\msvc2017_64 - VCVARS: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvars64.bat" - PLATFORM: - MAKETOOL: qmake - QTDIR: C:\Qt\5.9\msvc2015 VCVARS: "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\vcvarsall.bat" PLATFORM: x86 - MAKETOOL: cmake init: - call "%QTDIR%\bin\qtenv2.bat" @@ -29,11 +22,12 @@ before_build: - cd 3rdparty/libQtOlm - git clone https://gitlab.matrix.org/matrix-org/olm.git - cd ../.. -- if %MAKETOOL% == cmake cmake -G "NMake Makefiles JOM" -H. -Bbuild -DCMAKE_CXX_FLAGS="/EHsc /W3" -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX="%DEPLOY_DIR%" +- cmake -G "NMake Makefiles JOM" -H. -Bbuild -DCMAKE_CXX_FLAGS="/EHsc /W3" -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX="%DEPLOY_DIR%" build_script: -- if %MAKETOOL% == cmake cmake --build build -- if %MAKETOOL% == qmake qmake && jom +- cmake --build build +# qmake uses olm just built by CMake - it can't build olm on its own. +- qmake "INCLUDEPATH += 3rdparty/libQtOlm/olm/include" "LIBS += -Lbuild" && jom #after_build: #- cmake --build build --target install diff --git a/.travis.yml b/.travis.yml index 4654f60c..79d5d0e7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -57,8 +57,8 @@ script: - cmake -DCMAKE_PREFIX_PATH=../install ../examples - cmake --build . --target all - popd -# Build and install with qmake -- qmake qmc-example.pro "CONFIG += debug" "CONFIG -= app_bundle" "QMAKE_CC = $CC" "QMAKE_CXX = $CXX" +# Build with qmake +- qmake qmc-example.pro "CONFIG += debug" "CONFIG -= app_bundle" "QMAKE_CC = $CC" "QMAKE_CXX = $CXX" "INCLUDEPATH += 3rdparty/libQtOlm/olm/include" "LIBS += -Lbuild/lib" - make all # Run the qmake-compiled qmc-example under valgrind - if [ "$QMC_TEST_USER" != "" ]; then $VALGRIND ./qmc-example "$QMC_TEST_USER" "$QMC_TEST_PWD" qmc-example-travis '#qmc-test:matrix.org' "Travis CI job $TRAVIS_JOB_NUMBER"; fi diff --git a/libqmatrixclient.pri b/libqmatrixclient.pri index dfd45c04..c561a415 100644 --- a/libqmatrixclient.pri +++ b/libqmatrixclient.pri @@ -7,6 +7,8 @@ win32-msvc* { QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-parameter } +include(3rdparty/libQtOlm/libQtOlm.pri) + SRCPATH = $$PWD/lib INCLUDEPATH += $$SRCPATH -- cgit v1.2.3 From 112632e27fa26fcfbb49886d21704f398cd6a928 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 7 Jul 2019 16:58:02 +0900 Subject: .travis.yml: pass LD_LIBRARY_PATH so that the example could find olm --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 79d5d0e7..de3f62fd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -61,7 +61,7 @@ script: - qmake qmc-example.pro "CONFIG += debug" "CONFIG -= app_bundle" "QMAKE_CC = $CC" "QMAKE_CXX = $CXX" "INCLUDEPATH += 3rdparty/libQtOlm/olm/include" "LIBS += -Lbuild/lib" - make all # Run the qmake-compiled qmc-example under valgrind -- if [ "$QMC_TEST_USER" != "" ]; then $VALGRIND ./qmc-example "$QMC_TEST_USER" "$QMC_TEST_PWD" qmc-example-travis '#qmc-test:matrix.org' "Travis CI job $TRAVIS_JOB_NUMBER"; fi +- if [ "$QMC_TEST_USER" != "" ]; then $VALGRIND LD_LIBRARY_PATH="build/lib" ./qmc-example "$QMC_TEST_USER" "$QMC_TEST_PWD" qmc-example-travis '#qmc-test:matrix.org' "Travis CI job $TRAVIS_JOB_NUMBER"; fi notifications: webhooks: -- cgit v1.2.3 From 898906a2ac056ab8837a7307c745c3437feff74e Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 7 Jul 2019 16:59:09 +0900 Subject: Optimize Travis CI execution The same code is already in Quaternion's .travis.yml, just copy it here as well. --- .travis.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index de3f62fd..880b6260 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,15 @@ language: cpp +git: + depth: false + +before_cache: +- brew cleanup + +cache: + directories: + - $HOME/Library/Caches/Homebrew + addons: apt: sources: -- cgit v1.2.3 From eada787376b9f13e7fdd4e7d127074d5c3b3353e Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 7 Jul 2019 17:31:59 +0900 Subject: .travis.yml: Fix a typo in qmc-example invocation --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 880b6260..6880844b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -71,7 +71,7 @@ script: - qmake qmc-example.pro "CONFIG += debug" "CONFIG -= app_bundle" "QMAKE_CC = $CC" "QMAKE_CXX = $CXX" "INCLUDEPATH += 3rdparty/libQtOlm/olm/include" "LIBS += -Lbuild/lib" - make all # Run the qmake-compiled qmc-example under valgrind -- if [ "$QMC_TEST_USER" != "" ]; then $VALGRIND LD_LIBRARY_PATH="build/lib" ./qmc-example "$QMC_TEST_USER" "$QMC_TEST_PWD" qmc-example-travis '#qmc-test:matrix.org' "Travis CI job $TRAVIS_JOB_NUMBER"; fi +- if [ "$QMC_TEST_USER" != "" ]; then LD_LIBRARY_PATH="build/lib" $VALGRIND ./qmc-example "$QMC_TEST_USER" "$QMC_TEST_PWD" qmc-example-travis '#qmc-test:matrix.org' "Travis CI job $TRAVIS_JOB_NUMBER"; fi notifications: webhooks: -- cgit v1.2.3 From f31104a7a65e21504a921da9710fe193b0e41904 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Wed, 10 Jul 2019 15:58:42 +0900 Subject: .travis.yml: switch to xenial and Qt 5.9 --- .travis.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 6880844b..d859c69c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ language: cpp +dist: xenial git: depth: false @@ -14,19 +15,18 @@ addons: apt: sources: - ubuntu-toolchain-r-test - - sourceline: 'ppa:beineri/opt-qt571-trusty' + - sourceline: 'ppa:beineri/opt-qt597-xenial' packages: - ninja-build - - g++-5 - - qt57base - - qt57multimedia + - libgl1-mesa-dev # Forgotten Qt dep + - qt59base + - qt59multimedia - valgrind matrix: include: - os: linux compiler: gcc - env: [ 'ENV_EVAL="CC=gcc-5 && CXX=g++-5"' ] - os: linux compiler: clang - os: osx @@ -40,7 +40,7 @@ matrix: before_install: - eval "${ENV_EVAL}" -- if [ "$TRAVIS_OS_NAME" = "linux" ]; then USE_NINJA="-GNinja"; VALGRIND="valgrind $VALGRIND_OPTIONS"; . /opt/qt57/bin/qt57-env.sh; fi +- if [ "$TRAVIS_OS_NAME" = "linux" ]; then USE_NINJA="-GNinja"; VALGRIND="valgrind $VALGRIND_OPTIONS"; . /opt/qt59/bin/qt59-env.sh; fi install: - pushd 3rdparty/libQtOlm -- cgit v1.2.3 From 0df1cdcf40fd639f039f0c0e7165c8c40f6efd79 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Thu, 11 Jul 2019 08:02:22 +0900 Subject: .travis.yml: temporarily disabling Valgrind because it's broken --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index d859c69c..d02c5058 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,7 +40,9 @@ matrix: before_install: - eval "${ENV_EVAL}" -- if [ "$TRAVIS_OS_NAME" = "linux" ]; then USE_NINJA="-GNinja"; VALGRIND="valgrind $VALGRIND_OPTIONS"; . /opt/qt59/bin/qt59-env.sh; fi +- if [ "$TRAVIS_OS_NAME" = "linux" ]; then USE_NINJA="-GNinja"; . /opt/qt59/bin/qt59-env.sh; fi +# Switching off temporarily due to broken Valgrind being installed in xenial container. +#- if [ "$TRAVIS_OS_NAME" = "linux" ]; then VALGRIND="valgrind $VALGRIND_OPTIONS"; fi install: - pushd 3rdparty/libQtOlm -- cgit v1.2.3 From 7a5b359b8823646ce97cbaf05c251cb04c291466 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 7 Jul 2019 18:16:30 +0900 Subject: Rename zero-impact strings --- .travis.yml | 2 +- CMakeLists.txt | 2 +- examples/qmc-example.cpp | 2 +- lib/connection.cpp | 5 ++--- lib/jobs/basejob.cpp | 4 ++-- lib/settings.h | 2 +- 6 files changed, 8 insertions(+), 9 deletions(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index d02c5058..6c8d8ceb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -48,7 +48,7 @@ install: - pushd 3rdparty/libQtOlm - git clone https://gitlab.matrix.org/matrix-org/olm.git - popd -- git clone https://github.com/QMatrixClient/matrix-doc.git +- git clone https://github.com/quotient-im/matrix-doc.git - git clone --recursive https://github.com/KitsuneRal/gtad.git - pushd gtad - cmake $USE_NINJA -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} . diff --git a/CMakeLists.txt b/CMakeLists.txt index 996e76d4..44f4df9c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -81,7 +81,7 @@ endif() message( STATUS ) message( STATUS "=============================================================================" ) -message( STATUS " libqmatrixclient Build Information" ) +message( STATUS " libQuotient Build Information" ) message( STATUS "=============================================================================" ) message( STATUS "Version: ${PROJECT_VERSION}, API version: ${API_VERSION}") if (CMAKE_BUILD_TYPE) diff --git a/examples/qmc-example.cpp b/examples/qmc-example.cpp index f649ac3f..4a06d9b8 100644 --- a/examples/qmc-example.cpp +++ b/examples/qmc-example.cpp @@ -435,7 +435,7 @@ void QMCTest::setTopic() void QMCTest::addAndRemoveTag() { running.push_back("Tagging test"); - static const auto TestTag = QStringLiteral("org.qmatrixclient.test"); + static const auto TestTag = QStringLiteral("org.quotient.test"); // Pre-requisite if (targetRoom->tags().contains(TestTag)) targetRoom->removeTag(TestTag); diff --git a/lib/connection.cpp b/lib/connection.cpp index 6cd6ad0b..58d2e01a 100644 --- a/lib/connection.cpp +++ b/lib/connection.cpp @@ -95,8 +95,7 @@ public: DirectChatsMap directChats; DirectChatUsersMap directChatUsers; // The below two variables track local changes between sync completions. - // See also: - // https://github.com/QMatrixClient/libqmatrixclient/wiki/Handling-direct-chat-events + // See https://github.com/quotient-im/libQuotient/wiki/Handling-direct-chat-events DirectChatsMap dcLocalAdditions; DirectChatsMap dcLocalRemovals; std::unordered_map accountData; @@ -435,7 +434,7 @@ void Connection::onSyncSuccess(SyncData&& data, bool fromCache) visit( *eventPtr, [this](const DirectChatEvent& dce) { - // https://github.com/QMatrixClient/libqmatrixclient/wiki/Handling-direct-chat-events + // https://github.com/quotient-im/libQuotient/wiki/Handling-direct-chat-events const auto& usersToDCs = dce.usersToDirectChats(); DirectChatsMap remoteRemovals = erase_if(d->directChats, [&usersToDCs, this](auto it) { diff --git a/lib/jobs/basejob.cpp b/lib/jobs/basejob.cpp index a6471ece..5615736e 100644 --- a/lib/jobs/basejob.cpp +++ b/lib/jobs/basejob.cpp @@ -321,7 +321,7 @@ bool checkContentType(const QByteArray& type, const QByteArrayList& patterns) BaseJob::Status BaseJob::doCheckReply(QNetworkReply* reply) const { // QNetworkReply error codes seem to be flawed when it comes to HTTP; - // see, e.g., https://github.com/QMatrixClient/libqmatrixclient/issues/200 + // see, e.g., https://github.com/quotient-im/libQuotient/issues/200 // so check genuine HTTP codes. The below processing is based on // https://en.wikipedia.org/wiki/List_of_HTTP_status_codes const auto httpCodeHeader = @@ -576,7 +576,7 @@ QUrl BaseJob::errorUrl() const { return d->errorUrl; } void BaseJob::setStatus(Status s) { // The crash that led to this code has been reported in - // https://github.com/QMatrixClient/Quaternion/issues/566 - basically, + // https://github.com/quotient-im/Quaternion/issues/566 - basically, // when cleaning up childrent of a deleted Connection, there's a chance // of pending jobs being abandoned, calling setStatus(Abandoned). // There's nothing wrong with this; however, the safety check for diff --git a/lib/settings.h b/lib/settings.h index 6747631e..427f5494 100644 --- a/lib/settings.h +++ b/lib/settings.h @@ -140,7 +140,7 @@ public: /** \deprecated \sa setToken */ QString accessToken() const; /** \deprecated Storing accessToken in QSettings is unsafe, - * see QMatrixClient/Quaternion#181 */ + * see quotient-im/Quaternion#181 */ void setAccessToken(const QString& accessToken); Q_INVOKABLE void clearAccessToken(); -- cgit v1.2.3 From dd6731a2afc5b37badd52aadaa0b3e663719d3ea Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Mon, 12 Aug 2019 16:53:46 +0900 Subject: .travis.yml: Switch to bionic --- .travis.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 6c8d8ceb..0d2f5449 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: cpp -dist: xenial +dist: bionic git: depth: false @@ -14,8 +14,7 @@ cache: addons: apt: sources: - - ubuntu-toolchain-r-test - - sourceline: 'ppa:beineri/opt-qt597-xenial' + - sourceline: 'ppa:beineri/opt-qt597-bionic' packages: - ninja-build - libgl1-mesa-dev # Forgotten Qt dep @@ -42,7 +41,7 @@ before_install: - eval "${ENV_EVAL}" - if [ "$TRAVIS_OS_NAME" = "linux" ]; then USE_NINJA="-GNinja"; . /opt/qt59/bin/qt59-env.sh; fi # Switching off temporarily due to broken Valgrind being installed in xenial container. -#- if [ "$TRAVIS_OS_NAME" = "linux" ]; then VALGRIND="valgrind $VALGRIND_OPTIONS"; fi +- if [ "$TRAVIS_OS_NAME" = "linux" ]; then VALGRIND="valgrind $VALGRIND_OPTIONS"; fi install: - pushd 3rdparty/libQtOlm -- cgit v1.2.3 From e30b69013e269464495fcda0f0d4065ff10e1c00 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Mon, 12 Aug 2019 16:58:31 +0900 Subject: Ok, bionic has its own Qt5 --- .travis.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 0d2f5449..5149f6f0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,11 +13,8 @@ cache: addons: apt: - sources: - - sourceline: 'ppa:beineri/opt-qt597-bionic' packages: - ninja-build - - libgl1-mesa-dev # Forgotten Qt dep - qt59base - qt59multimedia - valgrind @@ -39,8 +36,7 @@ matrix: before_install: - eval "${ENV_EVAL}" -- if [ "$TRAVIS_OS_NAME" = "linux" ]; then USE_NINJA="-GNinja"; . /opt/qt59/bin/qt59-env.sh; fi -# Switching off temporarily due to broken Valgrind being installed in xenial container. +- if [ "$TRAVIS_OS_NAME" = "linux" ]; then USE_NINJA="-GNinja"; fi - if [ "$TRAVIS_OS_NAME" = "linux" ]; then VALGRIND="valgrind $VALGRIND_OPTIONS"; fi install: -- cgit v1.2.3 From 1642cffa53f8224f4bcf5165dacbfd2a063c320e Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Mon, 12 Aug 2019 17:53:31 +0900 Subject: Update Qt5 package naming to match that in bionic --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 5149f6f0..267aeb0e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,8 +15,7 @@ addons: apt: packages: - ninja-build - - qt59base - - qt59multimedia + - qt5-default - valgrind matrix: -- cgit v1.2.3 From 4bc7bd71d5c00218e919c14c607dda3edc470ee4 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Mon, 12 Aug 2019 18:13:12 +0900 Subject: .travis.yml: add qtmultimedia5-dev to Linux build boxes --- .travis.yml | 1 + 1 file changed, 1 insertion(+) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 267aeb0e..82b08945 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,7 @@ addons: packages: - ninja-build - qt5-default + - qtmultimedia5-dev - valgrind matrix: -- cgit v1.2.3 From e6ede4f43c8a9325900838009fb8a60f164faa33 Mon Sep 17 00:00:00 2001 From: Black Hat Date: Fri, 27 Sep 2019 00:49:49 -0700 Subject: Fix Travis CI. --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index fe6ca441..b36fbe7d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,7 +42,7 @@ before_install: install: - git clone https://gitlab.matrix.org/matrix-org/olm.git - pushd olm -- cmake . -Bbuild -DBUILD_SHARED_LIBS=NO -DCMAKE_INSTALL_PREFIX=../install +- cmake . -Bbuild -DBUILD_SHARED_LIBS=NO -DCMAKE_INSTALL_PREFIX=install - cmake --build build - cmake --build build --target install - popd @@ -55,7 +55,7 @@ install: before_script: - mkdir build && pushd build -- cmake $USE_NINJA -DMATRIX_DOC_PATH="matrix-doc" -DGTAD_PATH="gtad/gtad" -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} -DCMAKE_INSTALL_PREFIX=../install .. +- cmake $USE_NINJA -DMATRIX_DOC_PATH="matrix-doc" -DGTAD_PATH="gtad/gtad" -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} -DCMAKE_INSTALL_PREFIX=../install -DOlm_DIR=../olm/install/lib/cmake/Olm .. - cmake --build . --target update-api - popd -- cgit v1.2.3 From 97e2ac6201c14aaaf2a2ea9af60c904b197e067d Mon Sep 17 00:00:00 2001 From: Black Hat Date: Fri, 27 Sep 2019 11:21:07 -0700 Subject: Fix travis ci --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index b36fbe7d..7a9a6599 100644 --- a/.travis.yml +++ b/.travis.yml @@ -64,7 +64,7 @@ script: - cmake --build build --target install # Build qmc-example with the installed library - mkdir build-example && pushd build-example -- cmake -DCMAKE_PREFIX_PATH=../install ../examples +- cmake -DCMAKE_PREFIX_PATH=../install -DOlm_DIR=../olm/install/lib/cmake/Olm ../examples - cmake --build . --target all - popd # Build with qmake -- cgit v1.2.3 From a49461cf05ae31e6cf560ab960212e2310ab0f52 Mon Sep 17 00:00:00 2001 From: Black Hat Date: Fri, 27 Sep 2019 12:05:16 -0700 Subject: Fix Travis CI QMake --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 7a9a6599..e4ceae90 100644 --- a/.travis.yml +++ b/.travis.yml @@ -68,7 +68,7 @@ script: - cmake --build . --target all - popd # Build with qmake -- qmake qmc-example.pro "CONFIG += debug" "CONFIG -= app_bundle" "QMAKE_CC = $CC" "QMAKE_CXX = $CXX" "INCLUDEPATH += 3rdparty/libQtOlm/olm/include" "LIBS += -Lbuild/lib" +- qmake qmc-example.pro "CONFIG += debug" "CONFIG -= app_bundle" "QMAKE_CC = $CC" "QMAKE_CXX = $CXX" "INCLUDEPATH += olm/include" "LIBS += -Lbuild/lib" - make all # Run the qmake-compiled qmc-example under valgrind - if [ "$QMC_TEST_USER" != "" ]; then LD_LIBRARY_PATH="build/lib" $VALGRIND ./qmc-example "$QMC_TEST_USER" "$QMC_TEST_PWD" qmc-example-travis '#qmc-test:matrix.org' "Travis CI job $TRAVIS_JOB_NUMBER"; fi -- cgit v1.2.3 From ccf4f267f294c1e731fecdada9470ed84ad78ecf Mon Sep 17 00:00:00 2001 From: Black Hat Date: Fri, 27 Sep 2019 12:27:18 -0700 Subject: Fix QMake travis ci --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index e4ceae90..68118423 100644 --- a/.travis.yml +++ b/.travis.yml @@ -68,7 +68,7 @@ script: - cmake --build . --target all - popd # Build with qmake -- qmake qmc-example.pro "CONFIG += debug" "CONFIG -= app_bundle" "QMAKE_CC = $CC" "QMAKE_CXX = $CXX" "INCLUDEPATH += olm/include" "LIBS += -Lbuild/lib" +- qmake qmc-example.pro "CONFIG += debug" "CONFIG -= app_bundle" "QMAKE_CC = $CC" "QMAKE_CXX = $CXX" "INCLUDEPATH += olm/include" "LIBS += -Lbuild/lib" "LIBS += -Lolm/install/lib" - make all # Run the qmake-compiled qmc-example under valgrind - if [ "$QMC_TEST_USER" != "" ]; then LD_LIBRARY_PATH="build/lib" $VALGRIND ./qmc-example "$QMC_TEST_USER" "$QMC_TEST_PWD" qmc-example-travis '#qmc-test:matrix.org' "Travis CI job $TRAVIS_JOB_NUMBER"; fi -- cgit v1.2.3 From 67b31ac6400833bc7ef33b48e2126d8aca1c5f18 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Fri, 11 Oct 2019 09:31:25 +0900 Subject: .travis.yml: factor out common parts --- .travis.yml | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 68118423..5cd45ac7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,37 +36,33 @@ matrix: before_install: - eval "${ENV_EVAL}" -- if [ "$TRAVIS_OS_NAME" = "linux" ]; then USE_NINJA="-GNinja"; fi +- export CMAKE_ARGS="-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} -DCMAKE_PREFIX_PATH=../install -DCMAKE_INSTALL_PREFIX=../install" +- if [ "$TRAVIS_OS_NAME" = "linux" ]; then export CMAKE_ARGS="$CMAKE_ARGS -GNinja"; fi - if [ "$TRAVIS_OS_NAME" = "linux" ]; then VALGRIND="valgrind $VALGRIND_OPTIONS"; fi install: - git clone https://gitlab.matrix.org/matrix-org/olm.git - pushd olm -- cmake . -Bbuild -DBUILD_SHARED_LIBS=NO -DCMAKE_INSTALL_PREFIX=install -- cmake --build build +- cmake . -Bbuild -DBUILD_SHARED_LIBS=NO $CMAKE_ARGS - cmake --build build --target install - popd - git clone https://github.com/quotient-im/matrix-doc.git - git clone --recursive https://github.com/KitsuneRal/gtad.git - pushd gtad -- cmake $USE_NINJA -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} . +- cmake $CMAKE_ARGS . - cmake --build . - popd before_script: -- mkdir build && pushd build -- cmake $USE_NINJA -DMATRIX_DOC_PATH="matrix-doc" -DGTAD_PATH="gtad/gtad" -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} -DCMAKE_INSTALL_PREFIX=../install -DOlm_DIR=../olm/install/lib/cmake/Olm .. -- cmake --build . --target update-api -- popd +- cmake . -Bbuild -DMATRIX_DOC_PATH="matrix-doc" -DGTAD_PATH="gtad/gtad" $CMAKE_ARGS +- cmake --build build --target update-api script: - cmake --build build --target all - cmake --build build --target install # Build qmc-example with the installed library -- mkdir build-example && pushd build-example -- cmake -DCMAKE_PREFIX_PATH=../install -DOlm_DIR=../olm/install/lib/cmake/Olm ../examples -- cmake --build . --target all -- popd +- cmake examples -Bbuild-example $CMAKE_ARGS +- cmake --build build-example --target all # Build with qmake - qmake qmc-example.pro "CONFIG += debug" "CONFIG -= app_bundle" "QMAKE_CC = $CC" "QMAKE_CXX = $CXX" "INCLUDEPATH += olm/include" "LIBS += -Lbuild/lib" "LIBS += -Lolm/install/lib" - make all -- cgit v1.2.3 From a4538e65359ea71f285d352d9cb44bdcdcab7139 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sat, 12 Oct 2019 14:56:12 +0900 Subject: CI: use env variables to group common CMake (and other) values For AppVeyor, skip olm installation as we don't intend to check dynamic linkage. --- .appveyor.yml | 13 +++++-------- .travis.yml | 35 ++++++++++++++++++++++++++--------- 2 files changed, 31 insertions(+), 17 deletions(-) (limited to '.travis.yml') diff --git a/.appveyor.yml b/.appveyor.yml index 725adc8c..701028af 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,7 +1,7 @@ image: Visual Studio 2017 environment: - #DEPLOY_DIR: quotient-%APPVEYOR_BUILD_VERSION% + CMAKE_ARGS: '-G "NMake Makefiles JOM" -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo' matrix: - QTDIR: C:\Qt\5.13\msvc2017_64 VCVARS: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvars64.bat" @@ -19,17 +19,14 @@ init: before_build: - git submodule update --init --recursive - git clone https://gitlab.matrix.org/matrix-org/olm.git -- cd olm -- cmake -G "NMake Makefiles JOM" -H. -Bbuild -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=install -- cmake --build build -- cmake --build build --target install -- cd .. -- cmake -G "NMake Makefiles JOM" -H. -Bbuild -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX="%DEPLOY_DIR%" -DOlm_DIR="olm/install/lib/cmake/Olm" +- cmake %CMAKE_ARGS% -Holm -Bbuild/olm +- cmake --build build/olm build_script: +- cmake %CMAKE_ARGS% -H. -Bbuild "-DOlm_DIR=build/olm" - cmake --build build # qmake uses olm just built by CMake - it can't build olm on its own. -- qmake "INCLUDEPATH += olm/install/include" "LIBS += -Lbuild" "LIBS += -Lolm/install/lib" && jom +- qmake "INCLUDEPATH += olm/include" "LIBS += -Lbuild" "LIBS += -Lbuild/olm" && jom #after_build: #- cmake --build build --target install diff --git a/.travis.yml b/.travis.yml index 5cd45ac7..db92dc59 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,6 +19,17 @@ addons: - qtmultimedia5-dev - valgrind +env: + global: + - DESTDIR="$TRAVIS_BUILD_DIR/install" + - CMAKE_ARGS="-DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_PREFIX_PATH=$DESTDIR/usr" + - VALGRIND_OPTIONS="--tool=memcheck --leak-check=yes --gen-suppressions=all --suppressions=.valgrind.qmc-example.supp" + # RPM spec-style: swallow a command with default parameters into a variable + # and add/override parameters further in the code if/as necessary + - _CMAKE_CONFIG="cmake $CMAKE_ARGS . -Bbuild" + - _CMAKE_BUILD="cmake --build build" + - _CMAKE_BUILD_INSTALL="$_CMAKE_BUILD --target install" + matrix: include: - os: linux @@ -36,15 +47,22 @@ matrix: before_install: - eval "${ENV_EVAL}" -- export CMAKE_ARGS="-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} -DCMAKE_PREFIX_PATH=../install -DCMAKE_INSTALL_PREFIX=../install" +#- export DESTDIR=$TRAVIS_BUILD_DIR/install +#- export CMAKE_ARGS="-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} -DCMAKE_PREFIX_PATH=${DESTDIR}/install" - if [ "$TRAVIS_OS_NAME" = "linux" ]; then export CMAKE_ARGS="$CMAKE_ARGS -GNinja"; fi - if [ "$TRAVIS_OS_NAME" = "linux" ]; then VALGRIND="valgrind $VALGRIND_OPTIONS"; fi +# RPM spec-style: swallow a command with default parameters into a variable +# and add/override parameters further in the code if/as necessary +#- export _CMAKE_CONFIG="cmake $CMAKE_ARGS . -Bbuild" +#- export _CMAKE_BUILD="cmake --build build" +#- export _CMAKE_BUILD_INSTALL="$_CMAKE_BUILD --target install" + install: - git clone https://gitlab.matrix.org/matrix-org/olm.git - pushd olm -- cmake . -Bbuild -DBUILD_SHARED_LIBS=NO $CMAKE_ARGS -- cmake --build build --target install +- $_CMAKE_CONFIG -DBUILD_SHARED_LIBS=NO +- $_CMAKE_BUILD_INSTALL - popd - git clone https://github.com/quotient-im/matrix-doc.git - git clone --recursive https://github.com/KitsuneRal/gtad.git @@ -54,17 +72,16 @@ install: - popd before_script: -- cmake . -Bbuild -DMATRIX_DOC_PATH="matrix-doc" -DGTAD_PATH="gtad/gtad" $CMAKE_ARGS -- cmake --build build --target update-api +- $_CMAKE_CONFIG -DMATRIX_DOC_PATH="matrix-doc" -DGTAD_PATH="gtad/gtad" +- $_CMAKE_BUILD --target update-api script: -- cmake --build build --target all -- cmake --build build --target install +- $_CMAKE_BUILD_INSTALL # Build qmc-example with the installed library -- cmake examples -Bbuild-example $CMAKE_ARGS +- cmake $CMAKE_ARGS examples -Bbuild-example - cmake --build build-example --target all # Build with qmake -- qmake qmc-example.pro "CONFIG += debug" "CONFIG -= app_bundle" "QMAKE_CC = $CC" "QMAKE_CXX = $CXX" "INCLUDEPATH += olm/include" "LIBS += -Lbuild/lib" "LIBS += -Lolm/install/lib" +- qmake qmc-example.pro "CONFIG += debug" "CONFIG -= app_bundle" "QMAKE_CC = $CC" "QMAKE_CXX = $CXX" "INCLUDEPATH += $DESTDIR/include" "LIBS += -Lbuild/lib" "LIBS += -L$DESTDIR/lib" - make all # Run the qmake-compiled qmc-example under valgrind - if [ "$QMC_TEST_USER" != "" ]; then LD_LIBRARY_PATH="build/lib" $VALGRIND ./qmc-example "$QMC_TEST_USER" "$QMC_TEST_PWD" qmc-example-travis '#qmc-test:matrix.org' "Travis CI job $TRAVIS_JOB_NUMBER"; fi -- cgit v1.2.3 From 143b7f98664854a3204f7a4395f903d4149b1ca1 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sat, 12 Oct 2019 18:04:09 +0900 Subject: Travis CI: Use built rather than installed olm ...until the patch to fix olm CMake installation is accepted upstream. --- .travis.yml | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index db92dc59..84f83e24 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,17 +47,9 @@ matrix: before_install: - eval "${ENV_EVAL}" -#- export DESTDIR=$TRAVIS_BUILD_DIR/install -#- export CMAKE_ARGS="-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} -DCMAKE_PREFIX_PATH=${DESTDIR}/install" - if [ "$TRAVIS_OS_NAME" = "linux" ]; then export CMAKE_ARGS="$CMAKE_ARGS -GNinja"; fi - if [ "$TRAVIS_OS_NAME" = "linux" ]; then VALGRIND="valgrind $VALGRIND_OPTIONS"; fi -# RPM spec-style: swallow a command with default parameters into a variable -# and add/override parameters further in the code if/as necessary -#- export _CMAKE_CONFIG="cmake $CMAKE_ARGS . -Bbuild" -#- export _CMAKE_BUILD="cmake --build build" -#- export _CMAKE_BUILD_INSTALL="$_CMAKE_BUILD --target install" - install: - git clone https://gitlab.matrix.org/matrix-org/olm.git - pushd olm @@ -72,16 +64,16 @@ install: - popd before_script: -- $_CMAKE_CONFIG -DMATRIX_DOC_PATH="matrix-doc" -DGTAD_PATH="gtad/gtad" +- $_CMAKE_CONFIG -DMATRIX_DOC_PATH="matrix-doc" -DGTAD_PATH="gtad/gtad" -DOlm_DIR=olm/build - $_CMAKE_BUILD --target update-api script: - $_CMAKE_BUILD_INSTALL # Build qmc-example with the installed library -- cmake $CMAKE_ARGS examples -Bbuild-example +- cmake $CMAKE_ARGS examples -Bbuild-example -DOlm_DIR=olm/build - cmake --build build-example --target all # Build with qmake -- qmake qmc-example.pro "CONFIG += debug" "CONFIG -= app_bundle" "QMAKE_CC = $CC" "QMAKE_CXX = $CXX" "INCLUDEPATH += $DESTDIR/include" "LIBS += -Lbuild/lib" "LIBS += -L$DESTDIR/lib" +- qmake qmc-example.pro "CONFIG += debug" "CONFIG -= app_bundle" "QMAKE_CC = $CC" "QMAKE_CXX = $CXX" "INCLUDEPATH += olm/include" "LIBS += -Lbuild/lib" "LIBS += -Lolm/build" - make all # Run the qmake-compiled qmc-example under valgrind - if [ "$QMC_TEST_USER" != "" ]; then LD_LIBRARY_PATH="build/lib" $VALGRIND ./qmc-example "$QMC_TEST_USER" "$QMC_TEST_PWD" qmc-example-travis '#qmc-test:matrix.org' "Travis CI job $TRAVIS_JOB_NUMBER"; fi -- cgit v1.2.3 From a3aa9b5addcc87cfe18c831207f0e97481b0e428 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 13 Oct 2019 16:02:10 +0900 Subject: Travis CI: Build olm as a dynamic object --- .travis.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 84f83e24..3f6aa27d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -53,8 +53,9 @@ before_install: install: - git clone https://gitlab.matrix.org/matrix-org/olm.git - pushd olm -- $_CMAKE_CONFIG -DBUILD_SHARED_LIBS=NO -- $_CMAKE_BUILD_INSTALL +- $_CMAKE_CONFIG +- $_CMAKE_BUILD +#- $_CMAKE_BUILD_INSTALL - popd - git clone https://github.com/quotient-im/matrix-doc.git - git clone --recursive https://github.com/KitsuneRal/gtad.git @@ -76,7 +77,7 @@ script: - qmake qmc-example.pro "CONFIG += debug" "CONFIG -= app_bundle" "QMAKE_CC = $CC" "QMAKE_CXX = $CXX" "INCLUDEPATH += olm/include" "LIBS += -Lbuild/lib" "LIBS += -Lolm/build" - make all # Run the qmake-compiled qmc-example under valgrind -- if [ "$QMC_TEST_USER" != "" ]; then LD_LIBRARY_PATH="build/lib" $VALGRIND ./qmc-example "$QMC_TEST_USER" "$QMC_TEST_PWD" qmc-example-travis '#qmc-test:matrix.org' "Travis CI job $TRAVIS_JOB_NUMBER"; fi +- if [ "$QMC_TEST_USER" != "" ]; then LD_LIBRARY_PATH="olm/build" $VALGRIND ./qmc-example "$QMC_TEST_USER" "$QMC_TEST_PWD" qmc-example-travis '#qmc-test:matrix.org' "Travis CI job $TRAVIS_JOB_NUMBER"; fi notifications: webhooks: -- cgit v1.2.3 From 1047c85d9b21559d27f2d70147faac38d3e78fb0 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Mon, 14 Oct 2019 14:41:58 +0900 Subject: .travis.yml: A few smaller improvements --- .travis.yml | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 3f6aa27d..f089f977 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,13 +4,6 @@ dist: bionic git: depth: false -before_cache: -- brew cleanup - -cache: - directories: - - $HOME/Library/Caches/Homebrew - addons: apt: packages: @@ -23,7 +16,7 @@ env: global: - DESTDIR="$TRAVIS_BUILD_DIR/install" - CMAKE_ARGS="-DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_PREFIX_PATH=$DESTDIR/usr" - - VALGRIND_OPTIONS="--tool=memcheck --leak-check=yes --gen-suppressions=all --suppressions=.valgrind.qmc-example.supp" + - VALGRIND="valgrind --tool=memcheck --leak-check=yes --gen-suppressions=all --suppressions=.valgrind.qmc-example.supp $VALGRIND_OPTIONS" # RPM spec-style: swallow a command with default parameters into a variable # and add/override parameters further in the code if/as necessary - _CMAKE_CONFIG="cmake $CMAKE_ARGS . -Bbuild" @@ -38,17 +31,20 @@ matrix: compiler: clang - os: osx osx_image: xcode10.1 - env: [ 'PATH=/usr/local/opt/qt/bin:$PATH' ] + env: [ 'PATH=/usr/local/opt/qt/bin:$PATH', 'VALGRIND=' ] addons: homebrew: update: true packages: - qt5 + before_cache: + - brew cleanup + cache: + directories: + - $HOME/Library/Caches/Homebrew before_install: -- eval "${ENV_EVAL}" -- if [ "$TRAVIS_OS_NAME" = "linux" ]; then export CMAKE_ARGS="$CMAKE_ARGS -GNinja"; fi -- if [ "$TRAVIS_OS_NAME" = "linux" ]; then VALGRIND="valgrind $VALGRIND_OPTIONS"; fi +- if [ -f "$(which ninja)" ]; then export CMAKE_ARGS="$CMAKE_ARGS -GNinja"; fi install: - git clone https://gitlab.matrix.org/matrix-org/olm.git @@ -70,7 +66,7 @@ before_script: script: - $_CMAKE_BUILD_INSTALL -# Build qmc-example with the installed library +# Build qmc-example with the installed libQuotient - cmake $CMAKE_ARGS examples -Bbuild-example -DOlm_DIR=olm/build - cmake --build build-example --target all # Build with qmake -- cgit v1.2.3 From 53e5a26e662e8f2eb92e9f9df7b27ae0dcacee6e Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Mon, 14 Oct 2019 16:37:32 +0900 Subject: Use aliases instead of env variables They are a tad cleaner. --- .travis.yml | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index f089f977..21b2fd64 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,11 +17,6 @@ env: - DESTDIR="$TRAVIS_BUILD_DIR/install" - CMAKE_ARGS="-DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_PREFIX_PATH=$DESTDIR/usr" - VALGRIND="valgrind --tool=memcheck --leak-check=yes --gen-suppressions=all --suppressions=.valgrind.qmc-example.supp $VALGRIND_OPTIONS" - # RPM spec-style: swallow a command with default parameters into a variable - # and add/override parameters further in the code if/as necessary - - _CMAKE_CONFIG="cmake $CMAKE_ARGS . -Bbuild" - - _CMAKE_BUILD="cmake --build build" - - _CMAKE_BUILD_INSTALL="$_CMAKE_BUILD --target install" matrix: include: @@ -45,13 +40,17 @@ matrix: before_install: - if [ -f "$(which ninja)" ]; then export CMAKE_ARGS="$CMAKE_ARGS -GNinja"; fi +# RPM spec-style: swallow a command with default parameters into an alias +# and add/override parameters further in the code if/as necessary +- shopt -s expand_aliases +- alias _cmake_config='cmake $CMAKE_ARGS . -Bbuild' +- alias _cmake_build='cmake --build build' install: - git clone https://gitlab.matrix.org/matrix-org/olm.git - pushd olm -- $_CMAKE_CONFIG -- $_CMAKE_BUILD -#- $_CMAKE_BUILD_INSTALL +- _cmake_config +- _cmake_build # TODO: add --target install when the patch lands in olm - popd - git clone https://github.com/quotient-im/matrix-doc.git - git clone --recursive https://github.com/KitsuneRal/gtad.git @@ -61,11 +60,11 @@ install: - popd before_script: -- $_CMAKE_CONFIG -DMATRIX_DOC_PATH="matrix-doc" -DGTAD_PATH="gtad/gtad" -DOlm_DIR=olm/build -- $_CMAKE_BUILD --target update-api +- _cmake_config -DMATRIX_DOC_PATH="matrix-doc" -DGTAD_PATH="gtad/gtad" -DOlm_DIR=olm/build +- _cmake_build --target update-api script: -- $_CMAKE_BUILD_INSTALL +- _cmake_build --target install # Build qmc-example with the installed libQuotient - cmake $CMAKE_ARGS examples -Bbuild-example -DOlm_DIR=olm/build - cmake --build build-example --target all -- cgit v1.2.3 From d59ca7ac194e8d57177afb1ac89603e22b61b4ec Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Thu, 3 Oct 2019 08:16:29 +0900 Subject: qmc-example -> quotest, QMCTest -> TestManager Also: some bits of refactoring in the test code to make it more extensible. Closes #352. --- .travis.yml | 14 +- .valgrind.qmc-example.supp | 68 ------ CMakeLists.txt | 18 +- examples/CMakeLists.txt | 69 ------ lib/csapi/gtad.yaml | 4 +- qmc-example.pro | 12 - quotest.pro | 13 + tests/.valgrind.supp | 68 ++++++ tests/CMakeLists.txt | 69 ++++++ tests/quotest.cpp | 577 +++++++++++++++++++++++++++++++++++++++++++++ 10 files changed, 746 insertions(+), 166 deletions(-) delete mode 100644 .valgrind.qmc-example.supp delete mode 100644 examples/CMakeLists.txt delete mode 100644 qmc-example.pro create mode 100644 quotest.pro create mode 100644 tests/.valgrind.supp create mode 100644 tests/CMakeLists.txt create mode 100644 tests/quotest.cpp (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 21b2fd64..3f2759bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ env: global: - DESTDIR="$TRAVIS_BUILD_DIR/install" - CMAKE_ARGS="-DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_PREFIX_PATH=$DESTDIR/usr" - - VALGRIND="valgrind --tool=memcheck --leak-check=yes --gen-suppressions=all --suppressions=.valgrind.qmc-example.supp $VALGRIND_OPTIONS" + - VALGRIND="valgrind --tool=memcheck --leak-check=yes --gen-suppressions=all --suppressions=tests/.valgrind.supp $VALGRIND_OPTIONS" matrix: include: @@ -65,14 +65,14 @@ before_script: script: - _cmake_build --target install -# Build qmc-example with the installed libQuotient -- cmake $CMAKE_ARGS examples -Bbuild-example -DOlm_DIR=olm/build -- cmake --build build-example --target all +# Build quotest with the installed libQuotient +- cmake $CMAKE_ARGS tests -Bbuild-test -DOlm_DIR=olm/build +- cmake --build build-test --target all # Build with qmake -- qmake qmc-example.pro "CONFIG += debug" "CONFIG -= app_bundle" "QMAKE_CC = $CC" "QMAKE_CXX = $CXX" "INCLUDEPATH += olm/include" "LIBS += -Lbuild/lib" "LIBS += -Lolm/build" +- qmake quotest.pro "CONFIG += debug" "CONFIG -= app_bundle" "QMAKE_CC = $CC" "QMAKE_CXX = $CXX" "INCLUDEPATH += olm/include" "LIBS += -Lbuild/lib" "LIBS += -Lolm/build" - make all -# Run the qmake-compiled qmc-example under valgrind -- if [ "$QMC_TEST_USER" != "" ]; then LD_LIBRARY_PATH="olm/build" $VALGRIND ./qmc-example "$QMC_TEST_USER" "$QMC_TEST_PWD" qmc-example-travis '#qmc-test:matrix.org' "Travis CI job $TRAVIS_JOB_NUMBER"; fi +# Run the qmake-compiled quotest under valgrind +- if [ "$TEST_USER" != "" ]; then LD_LIBRARY_PATH="olm/build" $VALGRIND ./quotest "$QMC_TEST_USER" "$QMC_TEST_PWD" quotest-travis '#quotest:matrix.org' "Travis CI job $TRAVIS_JOB_NUMBER"; fi notifications: webhooks: diff --git a/.valgrind.qmc-example.supp b/.valgrind.qmc-example.supp deleted file mode 100644 index d65fb52e..00000000 --- a/.valgrind.qmc-example.supp +++ /dev/null @@ -1,68 +0,0 @@ -{ - libc_dirty_free_on_exit - Memcheck:Free - fun:free - fun:__libc_freeres - fun:_vgnU_freeres - fun:__run_exit_handlers - fun:exit -} - -{ - QAuthenticator - Memcheck:Leak - match-leak-kinds: possible - ... - fun:_ZN14QAuthenticator6detachEv -} - -{ - QTimer - Memcheck:Leak - match-leak-kinds: possible - fun:_Znwm - fun:_ZN7QObjectC1EPS_ - fun:_ZN6QTimerC1EP7QObject -} - -{ - QSslConfiguration - Memcheck:Leak - match-leak-kinds: possible - fun:_Znwm - ... - fun:_ZN17QSslConfigurationC1Ev -} - -{ - libcrypto_ASN1 - Memcheck:Leak - match-leak-kinds: definite - fun:malloc - ... - fun:ASN1_item_ex_d2i -} - -{ - malloc_from_libcrypto - Memcheck:Leak - match-leak-kinds: possible - fun:malloc - fun:CRYPTO_malloc - ... - obj:/lib/x86_64-linux-gnu/libcrypto.so.* -} - -{ - Slot_activation_from_QtNetwork - Memcheck:Leak - match-leak-kinds: definite - fun:malloc - fun:inflateInit2_ - obj:/*/*/*/libQt5Network.so.* - ... - fun:_ZN11QMetaObject8activateEP7QObjectiiPPv - ... - fun:_ZN11QMetaObject8activateEP7QObjectiiPPv - obj:/*/*/*/libQt5Network.so.* -} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index ce4af9a8..58509eae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ endif() set(API_VERSION "0.6") project(Quotient VERSION "${API_VERSION}.0" LANGUAGES CXX) -option(QUOTIENT_INSTALL_EXAMPLE "install qmc-example application" ON) +option(${PROJECT_NAME}_INSTALL_TESTS "install quotest (former qmc-example) application" ON) include(CheckCXXCompilerFlag) if (NOT WIN32) @@ -52,7 +52,7 @@ else() endforeach () endif() -find_package(Qt5 5.9 REQUIRED Network Gui Multimedia) +find_package(Qt5 5.9 REQUIRED Network Gui Multimedia Test) get_filename_component(Qt5_Prefix "${Qt5_DIR}/../../../.." ABSOLUTE) if ((NOT DEFINED USE_INTREE_LIBQOLM OR USE_INTREE_LIBQOLM) @@ -218,7 +218,7 @@ if (MATRIX_DOC_PATH AND GTAD_PATH) endif() endif() -set(example_SRCS examples/qmc-example.cpp) +set(tests_SRCS tests/quotest.cpp) add_library(${PROJECT_NAME} ${lib_SRCS} ${api_SRCS}) set_target_properties(${PROJECT_NAME} PROPERTIES @@ -237,8 +237,10 @@ target_include_directories(${PROJECT_NAME} PUBLIC ) target_link_libraries(${PROJECT_NAME} QtOlm Qt5::Core Qt5::Network Qt5::Gui Qt5::Multimedia) -add_executable(qmc-example ${example_SRCS}) -target_link_libraries(qmc-example Qt5::Core Quotient) +set(TEST_BINARY quotest) +add_executable(${TEST_BINARY} ${tests_SRCS}) +target_link_libraries(${TEST_BINARY} Qt5::Core Qt5::Test Quotient) + configure_file(Quotient.pc.in ${CMAKE_CURRENT_BINARY_DIR}/Quotient.pc @ONLY NEWLINE_STYLE UNIX) # Installation @@ -281,9 +283,9 @@ if (WIN32) install(FILES mime/packages/freedesktop.org.xml DESTINATION mime/packages) endif (WIN32) -if (QUOTIENT_INSTALL_EXAMPLE) - install(TARGETS qmc-example RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) -endif (QUOTIENT_INSTALL_EXAMPLE) +if (QUOTIENT_INSTALL_TESTS) + install(TARGETS ${TEST_BINARY} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) +endif () if (UNIX AND NOT APPLE) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Quotient.pc diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt deleted file mode 100644 index 1f512958..00000000 --- a/examples/CMakeLists.txt +++ /dev/null @@ -1,69 +0,0 @@ -cmake_minimum_required(VERSION 3.1) - -# This CMakeLists file assumes that the library is installed to CMAKE_INSTALL_PREFIX -# and ignores the in-tree library code. You can use this to start work on your own client. - -project(qmc-example CXX) - -include(CheckCXXCompilerFlag) -if (NOT WIN32) - include(GNUInstallDirs) -endif(NOT WIN32) - -# Find includes in corresponding build directories -set(CMAKE_INCLUDE_CURRENT_DIR ON) -# Instruct CMake to run moc automatically when needed. -set(CMAKE_AUTOMOC ON) - -# Set a default build type if none was specified -if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) - message(STATUS "Setting build type to 'Debug' as none was specified") - set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build" FORCE) - # Set the possible values of build type for cmake-gui - set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" - "MinSizeRel" "RelWithDebInfo") -endif() - -if (NOT CMAKE_INSTALL_LIBDIR) - set(CMAKE_INSTALL_LIBDIR ".") -endif() - -if (NOT CMAKE_INSTALL_BINDIR) - set(CMAKE_INSTALL_BINDIR ".") -endif() - -if (NOT CMAKE_INSTALL_INCLUDEDIR) - set(CMAKE_INSTALL_INCLUDEDIR "include") -endif() - -set(CMAKE_CXX_STANDARD 14) - -foreach (FLAG all "" pedantic extra error=return-type no-unused-parameter no-gnu-zero-variadic-macro-arguments) - CHECK_CXX_COMPILER_FLAG("-W${FLAG}" WARN_${FLAG}_SUPPORTED) - if ( WARN_${FLAG}_SUPPORTED AND NOT CMAKE_CXX_FLAGS MATCHES "(^| )-W?${FLAG}($| )") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W${FLAG}") - endif () -endforeach () - -find_package(Qt5 5.6 REQUIRED Network Gui Multimedia) -get_filename_component(Qt5_Prefix "${Qt5_DIR}/../../../.." ABSOLUTE) - -find_package(Quotient REQUIRED) -get_filename_component(QMC_Prefix "${Quotient_DIR}/../.." ABSOLUTE) - -message( STATUS "qmc-example configuration:" ) -if (CMAKE_BUILD_TYPE) - message( STATUS " Build type: ${CMAKE_BUILD_TYPE}") -endif(CMAKE_BUILD_TYPE) -message( STATUS " Compiler: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}" ) -message( STATUS " Qt: ${Qt5_VERSION} at ${Qt5_Prefix}" ) -message( STATUS " Quotient: ${Quotient_VERSION} at ${QMC_Prefix}" ) - -set(example_SRCS qmc-example.cpp) - -add_executable(qmc-example ${example_SRCS}) -target_link_libraries(qmc-example Qt5::Core Quotient) - -# Installation - -install (TARGETS qmc-example RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/lib/csapi/gtad.yaml b/lib/csapi/gtad.yaml index 301ee0b6..6d4e080f 100644 --- a/lib/csapi/gtad.yaml +++ b/lib/csapi/gtad.yaml @@ -95,9 +95,9 @@ analyzer: - //: { type: "QVector<{{1}}>", imports: } - map: # `additionalProperties` in OpenAPI - RoomState: - type: "std::unordered_map" + type: "UnorderedMap" moveOnly: - imports: + imports: '"util.h"' - /.+/: type: "QHash" imports: diff --git a/qmc-example.pro b/qmc-example.pro deleted file mode 100644 index a9548df9..00000000 --- a/qmc-example.pro +++ /dev/null @@ -1,12 +0,0 @@ -TEMPLATE = app - -CONFIG *= c++1z warn_on object_parallel_to_source - -windows { CONFIG *= console } - -include(libquotient.pri) - -SOURCES += examples/qmc-example.cpp - -DISTFILES += \ - .valgrind.qmc-example.supp diff --git a/quotest.pro b/quotest.pro new file mode 100644 index 00000000..433a2ccc --- /dev/null +++ b/quotest.pro @@ -0,0 +1,13 @@ +TEMPLATE = app + +QT += testlib +CONFIG *= c++1z warn_on object_parallel_to_source + +windows { CONFIG *= console } + +include(libquotient.pri) + +SOURCES += tests/quotest.cpp + +DISTFILES += \ + .valgrind.supp diff --git a/tests/.valgrind.supp b/tests/.valgrind.supp new file mode 100644 index 00000000..d65fb52e --- /dev/null +++ b/tests/.valgrind.supp @@ -0,0 +1,68 @@ +{ + libc_dirty_free_on_exit + Memcheck:Free + fun:free + fun:__libc_freeres + fun:_vgnU_freeres + fun:__run_exit_handlers + fun:exit +} + +{ + QAuthenticator + Memcheck:Leak + match-leak-kinds: possible + ... + fun:_ZN14QAuthenticator6detachEv +} + +{ + QTimer + Memcheck:Leak + match-leak-kinds: possible + fun:_Znwm + fun:_ZN7QObjectC1EPS_ + fun:_ZN6QTimerC1EP7QObject +} + +{ + QSslConfiguration + Memcheck:Leak + match-leak-kinds: possible + fun:_Znwm + ... + fun:_ZN17QSslConfigurationC1Ev +} + +{ + libcrypto_ASN1 + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + ... + fun:ASN1_item_ex_d2i +} + +{ + malloc_from_libcrypto + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:CRYPTO_malloc + ... + obj:/lib/x86_64-linux-gnu/libcrypto.so.* +} + +{ + Slot_activation_from_QtNetwork + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + fun:inflateInit2_ + obj:/*/*/*/libQt5Network.so.* + ... + fun:_ZN11QMetaObject8activateEP7QObjectiiPPv + ... + fun:_ZN11QMetaObject8activateEP7QObjectiiPPv + obj:/*/*/*/libQt5Network.so.* +} \ No newline at end of file diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 00000000..b6ba0f18 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,69 @@ +cmake_minimum_required(VERSION 3.1) + +# This CMakeLists file assumes that the library is installed to CMAKE_INSTALL_PREFIX +# and ignores the in-tree library code. You can use this to start work on your own client. + +project(quotest CXX) + +include(CheckCXXCompilerFlag) +if (NOT WIN32) + include(GNUInstallDirs) +endif(NOT WIN32) + +# Find includes in corresponding build directories +set(CMAKE_INCLUDE_CURRENT_DIR ON) +# Instruct CMake to run moc automatically when needed. +set(CMAKE_AUTOMOC ON) + +# Set a default build type if none was specified +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to 'Debug' as none was specified") + set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build" FORCE) + # Set the possible values of build type for cmake-gui + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" + "MinSizeRel" "RelWithDebInfo") +endif() + +if (NOT CMAKE_INSTALL_LIBDIR) + set(CMAKE_INSTALL_LIBDIR ".") +endif() + +if (NOT CMAKE_INSTALL_BINDIR) + set(CMAKE_INSTALL_BINDIR ".") +endif() + +if (NOT CMAKE_INSTALL_INCLUDEDIR) + set(CMAKE_INSTALL_INCLUDEDIR "include") +endif() + +set(CMAKE_CXX_STANDARD 14) + +foreach (FLAG all "" pedantic extra error=return-type no-unused-parameter no-gnu-zero-variadic-macro-arguments) + CHECK_CXX_COMPILER_FLAG("-W${FLAG}" WARN_${FLAG}_SUPPORTED) + if ( WARN_${FLAG}_SUPPORTED AND NOT CMAKE_CXX_FLAGS MATCHES "(^| )-W?${FLAG}($| )") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W${FLAG}") + endif () +endforeach () + +find_package(Qt5 5.9 REQUIRED Network Gui Multimedia) +get_filename_component(Qt5_Prefix "${Qt5_DIR}/../../../.." ABSOLUTE) + +find_package(Quotient REQUIRED) +get_filename_component(QMC_Prefix "${Quotient_DIR}/../.." ABSOLUTE) + +message( STATUS "${PROJECT_NAME} configuration:" ) +if (CMAKE_BUILD_TYPE) + message( STATUS " Build type: ${CMAKE_BUILD_TYPE}") +endif(CMAKE_BUILD_TYPE) +message( STATUS " Compiler: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}" ) +message( STATUS " Qt: ${Qt5_VERSION} at ${Qt5_Prefix}" ) +message( STATUS " Quotient: ${Quotient_VERSION} at ${QMC_Prefix}" ) + +set(example_SRCS quotest.cpp) + +add_executable(${PROJECT_NAME} ${example_SRCS}) +target_link_libraries(${PROJECT_NAME} Qt5::Core Quotient) + +# Installation + +install (TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/tests/quotest.cpp b/tests/quotest.cpp new file mode 100644 index 00000000..0a25dbc1 --- /dev/null +++ b/tests/quotest.cpp @@ -0,0 +1,577 @@ + +#include "connection.h" +#include "room.h" +#include "user.h" + +#include "csapi/joining.h" +#include "csapi/leaving.h" +#include "csapi/room_send.h" + +#include "events/reactionevent.h" +#include "events/simplestateevents.h" + +#include +#include +#include +#include +#include + +#include +#include + +using namespace Quotient; +using std::cout, std::endl; + +class TestManager : public QObject { +public: + TestManager(Connection* conn, QString testRoomName, QString source); + +private slots: + // clang-format off + void setupAndRun(); + void onNewRoom(Room* r); + void run(); + void doTests(); + void loadMembers(); + void sendMessage(); + void sendReaction(const QString& targetEvtId); + void sendFile(); + void checkFileSendingOutcome(const QString& txnId, + const QString& fileName); + void setTopic(); + void sendAndRedact(); + bool checkRedactionOutcome(const QString& evtIdToRedact); + void addAndRemoveTag(); + void markDirectChat(); + void checkDirectChatOutcome( + const Connection::DirectChatsMap& added); + void conclude(); + void finalize(); + // clang-format on + +private: + QScopedPointer c; + QStringList running; + QStringList succeeded; + QStringList failed; + QString origin; + QString targetRoomName; + Room* targetRoom = nullptr; + +using TestToken = QByteArray; // return value of QMetaMethod::name +// For now, the token itself is the test name but that may change. +const char* testName(const TestToken& token) { return token.constData(); } + bool validatePendingEvent(const QString& txnId); + void finishTest(const TestToken& token, bool condition, const char* file, + int line);}; + +#define TEST_IMPL(Name) void TestManager::Name() + +#define FINISH_TEST(description, Condition) \ + finishTest(description, Condition, __FILE__, __LINE__) + +#define FAIL_TEST(description) FINISH_TEST(description, false) + +bool TestManager::validatePendingEvent(const QString& txnId) +{ + auto it = targetRoom->findPendingEvent(txnId); + return it != targetRoom->pendingEvents().end() + && it->deliveryStatus() == EventStatus::Submitted + && (*it)->transactionId() == txnId; +} + +void TestManager::finishTest(const TestToken& token, bool condition, + const char* file, int line) +{ + const auto& item = testName(token); + Q_ASSERT_X(running.contains(item), item, + "Trying to finish an item that's not running"); + running.removeOne(item); + if (condition) { + succeeded.push_back(item); + cout << item << " successful" << endl; + if (targetRoom) + targetRoom->postMessage(origin % ": " % item % " successful", + MessageEventType::Notice); + } else { + failed.push_back(item); + cout << item << " FAILED at " << file << ":" << line << endl; + if (targetRoom) + targetRoom->postPlainText(origin % ": " % item % " FAILED at " + % file % ", line " % QString::number(line)); + } +} + +TestManager::TestManager(Connection* conn, QString testRoomName, QString source) + : c(conn), origin(std::move(source)), targetRoomName(std::move(testRoomName)) +{ + if (!origin.isEmpty()) + cout << "Origin for the test message: " << origin.toStdString() << endl; + cout << "Test room name: " << targetRoomName.toStdString() << endl; + + connect(c.data(), &Connection::connected, this, &TestManager::setupAndRun); + connect(c.data(), &Connection::loadedRoomState, this, &TestManager::onNewRoom); + // Big countdown watchdog + QTimer::singleShot(180000, this, &TestManager::conclude); +} + +void TestManager::setupAndRun() +{ + Q_ASSERT(!c->homeserver().isEmpty() && c->homeserver().isValid()); + Q_ASSERT(c->domain() == c->userId().section(':', 1)); + cout << "Connected, server: " + << c->homeserver().toDisplayString().toStdString() << endl; + cout << "Access token: " << c->accessToken().toStdString() << endl; + + cout << "Joining " << targetRoomName.toStdString() << endl; + running.push_back("Join room"); + auto joinJob = c->joinRoom(targetRoomName); + connect(joinJob, &BaseJob::failure, this, [this] { + FAIL_TEST("Join room"); + conclude(); + }); + // Connection::joinRoom() creates a Room object upon JoinRoomJob::success + // but this object is empty until the first sync is done. + connect(joinJob, &BaseJob::success, this, [this, joinJob] { + targetRoom = c->room(joinJob->roomId(), JoinState::Join); + FINISH_TEST("Join room", targetRoom != nullptr); + + run(); + }); +} + +void TestManager::onNewRoom(Room* r) +{ + cout << "New room: " << r->id().toStdString() << endl + << " Name: " << r->name().toStdString() << endl + << " Canonical alias: " << r->canonicalAlias().toStdString() << endl + << endl; + connect(r, &Room::aboutToAddNewMessages, r, [r](RoomEventsRange timeline) { + cout << timeline.size() << " new event(s) in room " + << r->canonicalAlias().toStdString() << endl; + // for (const auto& item: timeline) + // { + // cout << "From: " + // << r->roomMembername(item->senderId()).toStdString() + // << endl << "Timestamp:" + // << item->timestamp().toString().toStdString() << endl + // << "JSON:" << endl << + // item->originalJson().toStdString() << endl; + // } + }); +} + +void TestManager::run() +{ + c->setLazyLoading(true); + c->syncLoop(); + connectSingleShot(c.data(), &Connection::syncDone, this, &TestManager::doTests); + connect(c.data(), &Connection::syncDone, c.data(), [this] { + cout << "Sync complete, " << running.size() + << " test(s) in the air: " << running.join(", ").toStdString() + << endl; + if (running.isEmpty()) + conclude(); + }); +} + +void TestManager::doTests() +{ + cout << "Starting tests" << endl; + + loadMembers(); + + sendMessage(); + sendFile(); + setTopic(); + addAndRemoveTag(); + sendAndRedact(); + markDirectChat(); + // Add here tests with the test room +} + +TEST_IMPL(loadMembers) +{ + running.push_back("Loading members"); + auto* r = c->roomByAlias(QStringLiteral("#quotient:matrix.org"), + JoinState::Join); + if (!r) { + cout << "#quotient:matrix.org is not found in the test user's rooms" + << endl; + FAIL_TEST("Loading members"); + return; + } + // It's not exactly correct because an arbitrary server might not support + // lazy loading; but in the absence of capabilities framework we assume + // it does. + if (r->memberNames().size() >= r->joinedCount()) { + cout << "Lazy loading doesn't seem to be enabled" << endl; + FAIL_TEST("Loading members"); + return; + } + r->setDisplayed(); + connect(r, &Room::allMembersLoaded, [this, r] { + FINISH_TEST("Loading members", + r->memberNames().size() >= r->joinedCount()); + }); +} + +TEST_IMPL(sendMessage) +{ + running.push_back("Message sending"); + cout << "Sending a message" << endl; + auto txnId = targetRoom->postPlainText("Hello, " % origin % " is here"); + if (!validatePendingEvent(txnId)) { + cout << "Invalid pending event right after submitting" << endl; + FAIL_TEST("Message sending"); + return; + } + connectUntil( + targetRoom, &Room::pendingEventAboutToMerge, this, + [this, txnId](const RoomEvent* evt, int pendingIdx) { + const auto& pendingEvents = targetRoom->pendingEvents(); + Q_ASSERT(pendingIdx >= 0 && pendingIdx < int(pendingEvents.size())); + + if (evt->transactionId() != txnId) + return false; + + FINISH_TEST("Message sending", + is(*evt) && !evt->id().isEmpty() + && pendingEvents[size_t(pendingIdx)]->transactionId() + == evt->transactionId()); + sendReaction(evt->id()); + return true; + }); +} + +void TestManager::sendReaction(const QString& targetEvtId) +{ + running.push_back("Reaction sending"); + cout << "Reacting to the newest message in the room" << endl; + Q_ASSERT(targetRoom->timelineSize() > 0); + const auto key = QStringLiteral("+1"); + const auto txnId = targetRoom->postReaction(targetEvtId, key); + if (!validatePendingEvent(txnId)) { + cout << "Invalid pending event right after submitting" << endl; + FAIL_TEST("Reaction sending"); + return; + } + + // TODO: Check that it came back as a reaction event and that it attached to + // the right event + connectUntil( + targetRoom, &Room::updatedEvent, this, + [this, txnId, key, targetEvtId](const QString& actualTargetEvtId) { + if (actualTargetEvtId != targetEvtId) + return false; + const auto reactions = targetRoom->relatedEvents( + targetEvtId, EventRelation::Annotation()); + // It's a test room, assuming no interference there should + // be exactly one reaction + if (reactions.size() != 1) { + FAIL_TEST("Reaction sending"); + } else { + const auto* evt = + eventCast(reactions.back()); + FINISH_TEST("Reaction sending", + is(*evt) && !evt->id().isEmpty() + && evt->relation().key == key + && evt->transactionId() == txnId); + } + return true; + }); +} + +TEST_IMPL(sendFile) +{ + running.push_back("File sending"); + cout << "Sending a file" << endl; + auto* tf = new QTemporaryFile; + if (!tf->open()) { + cout << "Failed to create a temporary file" << endl; + FAIL_TEST("File sending"); + return; + } + tf->write("Test"); + tf->close(); + // QFileInfo::fileName brings only the file name; QFile::fileName brings + // the full path + const auto tfName = QFileInfo(*tf).fileName(); + cout << "Sending file " << tfName.toStdString() << endl; + const auto txnId = + targetRoom->postFile("Test file", QUrl::fromLocalFile(tf->fileName())); + if (!validatePendingEvent(txnId)) { + cout << "Invalid pending event right after submitting" << endl; + delete tf; + FAIL_TEST("File sending"); + return; + } + + // FIXME: Clean away connections (connectUntil doesn't help here). + connect(targetRoom, &Room::fileTransferCompleted, this, + [this, txnId, tf, tfName](const QString& id) { + auto fti = targetRoom->fileTransferInfo(id); + Q_ASSERT(fti.status == FileTransferInfo::Completed); + + if (id != txnId) + return; + + delete tf; + + checkFileSendingOutcome(txnId, tfName); + }); + connect(targetRoom, &Room::fileTransferFailed, this, + [this, txnId, tf](const QString& id, const QString& error) { + if (id != txnId) + return; + + targetRoom->postPlainText(origin % ": File upload failed: " + % error); + delete tf; + + FAIL_TEST("File sending"); + }); +} + +void TestManager::checkFileSendingOutcome(const QString& txnId, + const QString& fileName) +{ + auto it = targetRoom->findPendingEvent(txnId); + if (it == targetRoom->pendingEvents().end()) { + cout << "Pending file event dropped before upload completion" << endl; + FAIL_TEST("File sending"); + return; + } + if (it->deliveryStatus() != EventStatus::FileUploaded) { + cout << "Pending file event status upon upload completion is " + << it->deliveryStatus() << " != FileUploaded(" + << EventStatus::FileUploaded << ')' << endl; + FAIL_TEST("File sending"); + return; + } + + connectUntil( + targetRoom, &Room::pendingEventAboutToMerge, this, + [this, txnId, fileName](const RoomEvent* evt, int pendingIdx) { + const auto& pendingEvents = targetRoom->pendingEvents(); + Q_ASSERT(pendingIdx >= 0 && pendingIdx < int(pendingEvents.size())); + + if (evt->transactionId() != txnId) + return false; + + cout << "File event " << txnId.toStdString() + << " arrived in the timeline" << endl; + visit( + *evt, + [&](const RoomMessageEvent& e) { + FINISH_TEST( + "File sending", + !e.id().isEmpty() + && pendingEvents[size_t(pendingIdx)]->transactionId() + == txnId + && e.hasFileContent() + && e.content()->fileInfo()->originalName == fileName); + }, + [this](const RoomEvent&) { FAIL_TEST("File sending"); }); + return true; + }); +} + +TEST_IMPL(setTopic) +{ + running.push_back("State setting test"); + + const auto newTopic = c->generateTxnId(); // Just a way to get a unique id + targetRoom->setTopic(newTopic); + + connectUntil(targetRoom, &Room::topicChanged, this, + [this, newTopic] { + FINISH_TEST("State setting test", + targetRoom->topic() == newTopic); + return true; + }); +} + +TEST_IMPL(sendAndRedact) +{ + running.push_back("Redaction"); + cout << "Sending a message to redact" << endl; + auto txnId = targetRoom->postPlainText(origin % ": message to redact"); + if (txnId.isEmpty()) { + FAIL_TEST("Redaction"); + return; + } + connect(targetRoom, &Room::messageSent, this, + [this, txnId](const QString& tId, const QString& evtId) { + if (tId != txnId) + return; + + cout << "Redacting the message" << endl; + targetRoom->redactEvent(evtId, origin); + + connectUntil(targetRoom, &Room::addedMessages, this, + [this, evtId] { + return checkRedactionOutcome(evtId); + }); + }); +} + +bool TestManager::checkRedactionOutcome(const QString& evtIdToRedact) +{ + // There are two possible (correct) outcomes: either the event comes already + // redacted at the next sync, or the nearest sync completes with + // the unredacted event but the next one brings redaction. + auto it = targetRoom->findInTimeline(evtIdToRedact); + if (it == targetRoom->timelineEdge()) + return false; // Waiting for the next sync + + if ((*it)->isRedacted()) { + cout << "The sync brought already redacted message" << endl; + FINISH_TEST("Redaction", true); + } else { + cout << "Message came non-redacted with the sync, waiting for redaction" + << endl; + connectUntil(targetRoom, &Room::replacedEvent, this, + [this, evtIdToRedact](const RoomEvent* newEvent, + const RoomEvent* oldEvent) { + if (oldEvent->id() != evtIdToRedact) + return false; + + FINISH_TEST("Redaction", + newEvent->isRedacted() + && newEvent->redactionReason() == origin); + return true; + }); + } + return true; +} + +TEST_IMPL(addAndRemoveTag) +{ + running.push_back("Tagging test"); + static const auto TestTag = QStringLiteral("org.quotient.test"); + // Pre-requisite + if (targetRoom->tags().contains(TestTag)) + targetRoom->removeTag(TestTag); + + // Connect first because the signal is emitted synchronously. + connect(targetRoom, &Room::tagsChanged, targetRoom, [=] { + cout << "Room " << targetRoom->id().toStdString() + << ", tag(s) changed:" << endl + << " " << targetRoom->tagNames().join(", ").toStdString() << endl; + if (targetRoom->tags().contains(TestTag)) { + cout << "Test tag set, removing it now" << endl; + targetRoom->removeTag(TestTag); + FINISH_TEST("Tagging test", !targetRoom->tags().contains(TestTag)); + disconnect(targetRoom, &Room::tagsChanged, nullptr, nullptr); + } + }); + cout << "Adding a tag" << endl; + targetRoom->addTag(TestTag); +} + +TEST_IMPL(markDirectChat) +{ + running.push_back("Direct chat test"); + if (targetRoom->directChatUsers().contains(c->user())) { + cout << "Warning: the room is already a direct chat," + " only unmarking will be tested" + << endl; + checkDirectChatOutcome({ { c->user(), targetRoom->id() } }); + return; + } + // Connect first because the signal is emitted synchronously. + connect(c.data(), &Connection::directChatsListChanged, this, + &TestManager::checkDirectChatOutcome); + cout << "Marking the room as a direct chat" << endl; + c->addToDirectChats(targetRoom, c->user()); +} + +void TestManager::checkDirectChatOutcome(const Connection::DirectChatsMap& added) +{ + disconnect(c.data(), &Connection::directChatsListChanged, nullptr, nullptr); + if (!targetRoom->isDirectChat()) { + cout << "The room has not been marked as a direct chat" << endl; + FAIL_TEST("Direct chat test"); + return; + } + if (!added.contains(c->user(), targetRoom->id())) { + cout << "The room has not been listed in new direct chats" << endl; + FAIL_TEST("Direct chat test"); + return; + } + + cout << "Unmarking the direct chat" << endl; + c->removeFromDirectChats(targetRoom->id(), c->user()); + FINISH_TEST("Direct chat test", !c->isDirectChat(targetRoom->id())); +} + +void TestManager::conclude() +{ + c->stopSync(); + auto succeededRec = QString::number(succeeded.size()) + " tests succeeded"; + if (!failed.empty() || !running.empty()) + succeededRec += + " of " + % QString::number(succeeded.size() + failed.size() + running.size()) + % " total"; + QString plainReport = origin % ": Testing complete, " % succeededRec; + QString color = failed.empty() && running.empty() ? "00AA00" : "AA0000"; + QString htmlReport = origin % ": Testing complete, " % succeededRec; + if (!failed.empty()) { + plainReport += "\nFAILED: " % failed.join(", "); + htmlReport += "
Failed: " % failed.join(", "); + } + if (!running.empty()) { + plainReport += "\nDID NOT FINISH: " % running.join(", "); + htmlReport += "
Did not finish: " + % running.join(", "); + } + cout << plainReport.toStdString() << endl; + + if (targetRoom) { + // TODO: Waiting for proper futures to come so that it could be: + // targetRoom->postHtmlText(...) + // .then(this, &TestManager::finalize); // Qt-style or + // .then([this] { finalize(); }); // STL-style + auto txnId = targetRoom->postHtmlText(plainReport, htmlReport); + connect(targetRoom, &Room::messageSent, this, + [this, txnId](const QString& serverTxnId) { + if (txnId != serverTxnId) + return; + + cout << "Leaving the room" << endl; + connect(targetRoom->leaveRoom(), &BaseJob::finished, this, + &TestManager::finalize); + }); + } else + finalize(); +} + +void TestManager::finalize() +{ + cout << "Logging out" << endl; + c->logout(); + connect(c.data(), &Connection::loggedOut, qApp, [this] { + QCoreApplication::processEvents(); + QCoreApplication::exit(failed.size() + running.size()); + }); +} + +int main(int argc, char* argv[]) +{ + QCoreApplication app(argc, argv); + if (argc < 5) { + cout << "Usage: quotest [origin]" + << endl; + return -1; + } + + cout << "Connecting to the server as " << argv[1] << endl; + auto conn = new Connection; + conn->connectToServer(argv[1], argv[2], argv[3]); + TestManager test { conn, argv[4], argc >= 6 ? argv[5] : nullptr }; + return app.exec(); +} -- cgit v1.2.3 From 8782ae93ddcf6925eee9189aa07441c822e3b9ba Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Thu, 12 Dec 2019 21:32:13 +0300 Subject: .travis.yml: use correct environment variables It should be TEST_USER and TEST_PWD, not QMC_* legacy stuff. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 3f2759bb..b1b3ef95 100644 --- a/.travis.yml +++ b/.travis.yml @@ -72,7 +72,7 @@ script: - qmake quotest.pro "CONFIG += debug" "CONFIG -= app_bundle" "QMAKE_CC = $CC" "QMAKE_CXX = $CXX" "INCLUDEPATH += olm/include" "LIBS += -Lbuild/lib" "LIBS += -Lolm/build" - make all # Run the qmake-compiled quotest under valgrind -- if [ "$TEST_USER" != "" ]; then LD_LIBRARY_PATH="olm/build" $VALGRIND ./quotest "$QMC_TEST_USER" "$QMC_TEST_PWD" quotest-travis '#quotest:matrix.org' "Travis CI job $TRAVIS_JOB_NUMBER"; fi +- if [ "$TEST_USER" != "" ]; then LD_LIBRARY_PATH="olm/build" $VALGRIND ./quotest "$TEST_USER" "$TEST_PWD" quotest-travis '#quotest:matrix.org' "Travis CI job $TRAVIS_JOB_NUMBER"; fi notifications: webhooks: -- cgit v1.2.3 From 2ff67baac4b8352f06421089c2b94566df032b21 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Thu, 26 Mar 2020 23:24:08 +0100 Subject: Travis CI: build with and without E2EE --- .travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index b1b3ef95..729931a0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,6 +22,9 @@ matrix: include: - os: linux compiler: gcc + - os: linux + compiler: gcc + env: [ 'E2EE="-DQuotient_ENABLE_E2EE"' ] - os: linux compiler: clang - os: osx @@ -60,7 +63,7 @@ install: - popd before_script: -- _cmake_config -DMATRIX_DOC_PATH="matrix-doc" -DGTAD_PATH="gtad/gtad" -DOlm_DIR=olm/build +- _cmake_config -DMATRIX_DOC_PATH="matrix-doc" -DGTAD_PATH="gtad/gtad" -DOlm_DIR=olm/build $E2EE - _cmake_build --target update-api script: -- cgit v1.2.3 From 01abbe7008b1614760740ba425a174c61af695a1 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Fri, 27 Mar 2020 09:24:11 +0100 Subject: .travis.yml: fix a typo --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 729931a0..2449c003 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ matrix: compiler: gcc - os: linux compiler: gcc - env: [ 'E2EE="-DQuotient_ENABLE_E2EE"' ] + env: [ 'E2EE="-DQuotient_ENABLE_E2EE=ON"' ] - os: linux compiler: clang - os: osx -- cgit v1.2.3 From 6f8f373efd5ae6909a481d17e6b20bca885ccd48 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 29 Mar 2020 10:51:05 +0200 Subject: Travis CI: install olm ...now that its CMake files are fixed for that. --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 2449c003..74b2d0da 100644 --- a/.travis.yml +++ b/.travis.yml @@ -53,7 +53,7 @@ install: - git clone https://gitlab.matrix.org/matrix-org/olm.git - pushd olm - _cmake_config -- _cmake_build # TODO: add --target install when the patch lands in olm +- _cmake_build --target install - popd - git clone https://github.com/quotient-im/matrix-doc.git - git clone --recursive https://github.com/KitsuneRal/gtad.git @@ -63,13 +63,13 @@ install: - popd before_script: -- _cmake_config -DMATRIX_DOC_PATH="matrix-doc" -DGTAD_PATH="gtad/gtad" -DOlm_DIR=olm/build $E2EE +- _cmake_config -DMATRIX_DOC_PATH="matrix-doc" -DGTAD_PATH="gtad/gtad" $E2EE - _cmake_build --target update-api script: - _cmake_build --target install # Build quotest with the installed libQuotient -- cmake $CMAKE_ARGS tests -Bbuild-test -DOlm_DIR=olm/build +- cmake $CMAKE_ARGS tests -Bbuild-test - cmake --build build-test --target all # Build with qmake - qmake quotest.pro "CONFIG += debug" "CONFIG -= app_bundle" "QMAKE_CC = $CC" "QMAKE_CXX = $CXX" "INCLUDEPATH += olm/include" "LIBS += -Lbuild/lib" "LIBS += -Lolm/build" -- cgit v1.2.3 From 4c012575f6ffcf61b9e66ba8a1f798caa8c08748 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 31 May 2020 21:24:05 +0200 Subject: .travis.yml: adjust to new GTAD --- .travis.yml | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 74b2d0da..d3f4711f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,7 @@ addons: - qt5-default - qtmultimedia5-dev - valgrind + - g++-8 env: global: @@ -24,7 +25,7 @@ matrix: compiler: gcc - os: linux compiler: gcc - env: [ 'E2EE="-DQuotient_ENABLE_E2EE=ON"' ] + env: [ 'E2EE="-DQuotient_ENABLE_E2EE=ON"', 'UPDATE_API=1' ] - os: linux compiler: clang - os: osx @@ -43,6 +44,12 @@ matrix: before_install: - if [ -f "$(which ninja)" ]; then export CMAKE_ARGS="$CMAKE_ARGS -GNinja"; fi +# The recent GTAD uses std::filesystem that's not available in stock bionic +- | + if [ -n "$UPDATE_API" ]; then + export CC=gcc-8 CXX=g++-8 + export CMAKE_UPDATE_API_ARGS="-DMATRIX_DOC_PATH=matrix-doc -DGTAD_PATH=gtad/gtad" + fi # RPM spec-style: swallow a command with default parameters into an alias # and add/override parameters further in the code if/as necessary - shopt -s expand_aliases @@ -55,16 +62,20 @@ install: - _cmake_config - _cmake_build --target install - popd -- git clone https://github.com/quotient-im/matrix-doc.git -- git clone --recursive https://github.com/KitsuneRal/gtad.git -- pushd gtad -- cmake $CMAKE_ARGS . -- cmake --build . -- popd + +- | + if [ -n "$UPDATE_API" ]; then + git clone https://github.com/quotient-im/matrix-doc.git + git clone --recursive https://github.com/KitsuneRal/gtad.git + pushd gtad + cmake $CMAKE_ARGS . + cmake --build . + popd + fi before_script: -- _cmake_config -DMATRIX_DOC_PATH="matrix-doc" -DGTAD_PATH="gtad/gtad" $E2EE -- _cmake_build --target update-api +- _cmake_config $CMAKE_UPDATE_API_ARGS $E2EE +- if [ -n "$UPDATE_API" ]; then _cmake_build --target update-api; fi script: - _cmake_build --target install -- cgit v1.2.3 From 4ff89aa1ec48623264944f18f97cd92115268eaf Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sat, 6 Jun 2020 21:25:14 +0200 Subject: Travis CI: clone olm and gtad outside of source tree libQuotient now has gtad/ directory that stands in the way of cloning GTAD - which is just to emphasize that cloning other projects into the source tree has never been a good idea. --- .travis.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index d3f4711f..9eed9949 100644 --- a/.travis.yml +++ b/.travis.yml @@ -48,7 +48,7 @@ before_install: - | if [ -n "$UPDATE_API" ]; then export CC=gcc-8 CXX=g++-8 - export CMAKE_UPDATE_API_ARGS="-DMATRIX_DOC_PATH=matrix-doc -DGTAD_PATH=gtad/gtad" + export CMAKE_UPDATE_API_ARGS="-DMATRIX_DOC_PATH=../matrix-doc -DGTAD_PATH=../gtad/gtad" fi # RPM spec-style: swallow a command with default parameters into an alias # and add/override parameters further in the code if/as necessary @@ -57,6 +57,7 @@ before_install: - alias _cmake_build='cmake --build build' install: +- pushd .. # Go out of libQuotient source tree - git clone https://gitlab.matrix.org/matrix-org/olm.git - pushd olm - _cmake_config @@ -65,13 +66,14 @@ install: - | if [ -n "$UPDATE_API" ]; then - git clone https://github.com/quotient-im/matrix-doc.git + git clone https://github.com/matrix.org/matrix-doc.git git clone --recursive https://github.com/KitsuneRal/gtad.git pushd gtad cmake $CMAKE_ARGS . cmake --build . popd fi +- popd # back to libQuotient source tree before_script: - _cmake_config $CMAKE_UPDATE_API_ARGS $E2EE -- cgit v1.2.3 From 9e10771ed3195de3e23ef9e8bffc8eb0b734991f Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Wed, 10 Jun 2020 15:06:16 +0200 Subject: .travis.yml: fix a typo in the matrix-doc URL --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 9eed9949..d1a62c7f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -66,7 +66,7 @@ install: - | if [ -n "$UPDATE_API" ]; then - git clone https://github.com/matrix.org/matrix-doc.git + git clone https://github.com/matrix-org/matrix-doc.git git clone --recursive https://github.com/KitsuneRal/gtad.git pushd gtad cmake $CMAKE_ARGS . -- cgit v1.2.3 From 4237a138f9ad1baa7384f3a539e9343a1471b538 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Tue, 9 Jun 2020 15:09:37 +0200 Subject: CI: test more configurations --- .appveyor.yml | 22 ++++++++++++++++------ .travis.yml | 43 ++++++++++++++++++++++++++++++------------- 2 files changed, 46 insertions(+), 19 deletions(-) (limited to '.travis.yml') diff --git a/.appveyor.yml b/.appveyor.yml index 13991ada..764d56d6 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -3,12 +3,22 @@ image: Visual Studio 2017 environment: CMAKE_ARGS: '-G "NMake Makefiles JOM" -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo' matrix: - - QTDIR: C:\Qt\5.13\msvc2017_64 - VCVARS: "vcvars64.bat" - PLATFORM: - - QTDIR: C:\Qt\5.13\msvc2017 + - QTDIR: C:\Qt\5.13\msvc2017 # Fresh Qt, 32-bit VCVARS: "vcvars32.bat" PLATFORM: x86 + - QTDIR: C:\Qt\5.13\msvc2017_64 # Fresh Qt, 64-bit + VCVARS: "vcvars64.bat" + PLATFORM: + - QTDIR: C:\Qt\5.9\msvc2017_64 # Oldest supported Qt, 64-bit, E2EE + VCVARS: "vcvars64.bat" + QMAKE_E2EE_ARGS: '"DEFINES += Quotient_E2EE_ENABLED USE_INTREE_LIBQOLM" "INCLUDEPATH += olm/include" "LIBS += -Lbuild/olm"' + CMAKE_E2EE_ARGS: '-DQuotient_ENABLE_E2EE=ON -DOlm_DIR=build/olm' + PLATFORM: + - QTDIR: C:\Qt\5.13\msvc2017_64 # Fresh Qt, 64-bit, E2EE + VCVARS: "vcvars64.bat" + QMAKE_E2EE_ARGS: '"DEFINES += Quotient_E2EE_ENABLED USE_INTREE_LIBQOLM" "INCLUDEPATH += olm/include" "LIBS += -Lbuild/olm"' + CMAKE_E2EE_ARGS: '-DQuotient_ENABLE_E2EE=ON -DOlm_DIR=build/olm' + PLATFORM: init: - call "%QTDIR%\bin\qtenv2.bat" @@ -23,10 +33,10 @@ before_build: - cmake --build build/olm build_script: -- cmake %CMAKE_ARGS% -H. -Bbuild "-DOlm_DIR=build/olm" +- cmake %CMAKE_ARGS% %CMAKE_E2EE_ARGS% -H. -Bbuild - cmake --build build # qmake uses olm just built by CMake - it can't build olm on its own. -- qmake "INCLUDEPATH += olm/include" "LIBS += -Lbuild" "LIBS += -Lbuild/olm" && jom +- qmake -Wall quotest.pro -- %QMAKE_E2EE_ARGS% && jom #after_build: #- cmake --build build --target install diff --git a/.travis.yml b/.travis.yml index d1a62c7f..9982be30 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,18 +19,15 @@ env: - CMAKE_ARGS="-DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_PREFIX_PATH=$DESTDIR/usr" - VALGRIND="valgrind --tool=memcheck --leak-check=yes --gen-suppressions=all --suppressions=tests/.valgrind.supp $VALGRIND_OPTIONS" -matrix: +matrix: # TODO: consider parallel execution, this thing takes an hour to run include: - os: linux compiler: gcc - - os: linux - compiler: gcc - env: [ 'E2EE="-DQuotient_ENABLE_E2EE=ON"', 'UPDATE_API=1' ] - os: linux compiler: clang - os: osx osx_image: xcode10.1 - env: [ 'PATH=/usr/local/opt/qt/bin:$PATH', 'VALGRIND=' ] + env: [ 'E2EE=1', 'VALGRIND=' ] addons: homebrew: update: true @@ -41,15 +38,32 @@ matrix: cache: directories: - $HOME/Library/Caches/Homebrew + # Check a few more advanced configurations + - os: linux + compiler: gcc + env: [ E2EE=1, UPDATE_API=1 ] # Check UPDATE_API with one of fatter options + - os: linux + compiler: clang + env: [ E2EE=1 ] + - os: linux + compiler: gcc + env: [ E2EE=1 ] before_install: - if [ -f "$(which ninja)" ]; then export CMAKE_ARGS="$CMAKE_ARGS -GNinja"; fi +- if [ "$TRAVIS_OS_NAME" = "osx" ]; then export PATH=/usr/local/opt/qt/bin:$PATH; fi # The recent GTAD uses std::filesystem that's not available in stock bionic - | if [ -n "$UPDATE_API" ]; then export CC=gcc-8 CXX=g++-8 export CMAKE_UPDATE_API_ARGS="-DMATRIX_DOC_PATH=../matrix-doc -DGTAD_PATH=../gtad/gtad" fi +- | + if [ -n "$E2EE" ]; then + export CMAKE_E2EE_ARGS="-DQuotient_ENABLE_E2EE=ON" + export QMAKE_E2EE_ARGS='"DEFINES += Quotient_E2EE_ENABLED USE_INTREE_LIBQOLM" "INCLUDEPATH += olm/include" "LIBS += -Lolm/build"' + export LIB_PATH_E2EE=olm/build + fi # RPM spec-style: swallow a command with default parameters into an alias # and add/override parameters further in the code if/as necessary - shopt -s expand_aliases @@ -58,11 +72,14 @@ before_install: install: - pushd .. # Go out of libQuotient source tree -- git clone https://gitlab.matrix.org/matrix-org/olm.git -- pushd olm -- _cmake_config -- _cmake_build --target install -- popd +- | + if [ -n "$E2EE" ]; then + git clone https://gitlab.matrix.org/matrix-org/olm.git + pushd olm + _cmake_config + _cmake_build --target install + popd + fi - | if [ -n "$UPDATE_API" ]; then @@ -76,7 +93,7 @@ install: - popd # back to libQuotient source tree before_script: -- _cmake_config $CMAKE_UPDATE_API_ARGS $E2EE +- _cmake_config $CMAKE_UPDATE_API_ARGS $CMAKE_E2EE_ARGS - if [ -n "$UPDATE_API" ]; then _cmake_build --target update-api; fi script: @@ -85,10 +102,10 @@ script: - cmake $CMAKE_ARGS tests -Bbuild-test - cmake --build build-test --target all # Build with qmake -- qmake quotest.pro "CONFIG += debug" "CONFIG -= app_bundle" "QMAKE_CC = $CC" "QMAKE_CXX = $CXX" "INCLUDEPATH += olm/include" "LIBS += -Lbuild/lib" "LIBS += -Lolm/build" +- qmake -Wall quotest.pro "CONFIG += debug" "CONFIG -= app_bundle" "QMAKE_CC = $CC" "QMAKE_CXX = $CXX" -- $QMAKE_E2EE_ARGS - make all # Run the qmake-compiled quotest under valgrind -- if [ "$TEST_USER" != "" ]; then LD_LIBRARY_PATH="olm/build" $VALGRIND ./quotest "$TEST_USER" "$TEST_PWD" quotest-travis '#quotest:matrix.org' "Travis CI job $TRAVIS_JOB_NUMBER"; fi +- if [ "$TEST_USER" != "" ]; then LD_LIBRARY_PATH="$LIB_PATH_E2EE" $VALGRIND ./quotest "$TEST_USER" "$TEST_PWD" quotest-travis '#quotest:matrix.org' "Travis CI job $TRAVIS_JOB_NUMBER"; fi notifications: webhooks: -- cgit v1.2.3 From 0966f4821b6e5460b62d9fe8be14066ed001c1c2 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sat, 2 Jan 2021 16:18:11 +0100 Subject: Drop .travis.yml [skip ci] --- .travis.yml | 116 ------------------------------------------------------------ 1 file changed, 116 deletions(-) delete mode 100644 .travis.yml (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 9982be30..00000000 --- a/.travis.yml +++ /dev/null @@ -1,116 +0,0 @@ -language: cpp -dist: bionic - -git: - depth: false - -addons: - apt: - packages: - - ninja-build - - qt5-default - - qtmultimedia5-dev - - valgrind - - g++-8 - -env: - global: - - DESTDIR="$TRAVIS_BUILD_DIR/install" - - CMAKE_ARGS="-DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_PREFIX_PATH=$DESTDIR/usr" - - VALGRIND="valgrind --tool=memcheck --leak-check=yes --gen-suppressions=all --suppressions=tests/.valgrind.supp $VALGRIND_OPTIONS" - -matrix: # TODO: consider parallel execution, this thing takes an hour to run - include: - - os: linux - compiler: gcc - - os: linux - compiler: clang - - os: osx - osx_image: xcode10.1 - env: [ 'E2EE=1', 'VALGRIND=' ] - addons: - homebrew: - update: true - packages: - - qt5 - before_cache: - - brew cleanup - cache: - directories: - - $HOME/Library/Caches/Homebrew - # Check a few more advanced configurations - - os: linux - compiler: gcc - env: [ E2EE=1, UPDATE_API=1 ] # Check UPDATE_API with one of fatter options - - os: linux - compiler: clang - env: [ E2EE=1 ] - - os: linux - compiler: gcc - env: [ E2EE=1 ] - -before_install: -- if [ -f "$(which ninja)" ]; then export CMAKE_ARGS="$CMAKE_ARGS -GNinja"; fi -- if [ "$TRAVIS_OS_NAME" = "osx" ]; then export PATH=/usr/local/opt/qt/bin:$PATH; fi -# The recent GTAD uses std::filesystem that's not available in stock bionic -- | - if [ -n "$UPDATE_API" ]; then - export CC=gcc-8 CXX=g++-8 - export CMAKE_UPDATE_API_ARGS="-DMATRIX_DOC_PATH=../matrix-doc -DGTAD_PATH=../gtad/gtad" - fi -- | - if [ -n "$E2EE" ]; then - export CMAKE_E2EE_ARGS="-DQuotient_ENABLE_E2EE=ON" - export QMAKE_E2EE_ARGS='"DEFINES += Quotient_E2EE_ENABLED USE_INTREE_LIBQOLM" "INCLUDEPATH += olm/include" "LIBS += -Lolm/build"' - export LIB_PATH_E2EE=olm/build - fi -# RPM spec-style: swallow a command with default parameters into an alias -# and add/override parameters further in the code if/as necessary -- shopt -s expand_aliases -- alias _cmake_config='cmake $CMAKE_ARGS . -Bbuild' -- alias _cmake_build='cmake --build build' - -install: -- pushd .. # Go out of libQuotient source tree -- | - if [ -n "$E2EE" ]; then - git clone https://gitlab.matrix.org/matrix-org/olm.git - pushd olm - _cmake_config - _cmake_build --target install - popd - fi - -- | - if [ -n "$UPDATE_API" ]; then - git clone https://github.com/matrix-org/matrix-doc.git - git clone --recursive https://github.com/KitsuneRal/gtad.git - pushd gtad - cmake $CMAKE_ARGS . - cmake --build . - popd - fi -- popd # back to libQuotient source tree - -before_script: -- _cmake_config $CMAKE_UPDATE_API_ARGS $CMAKE_E2EE_ARGS -- if [ -n "$UPDATE_API" ]; then _cmake_build --target update-api; fi - -script: -- _cmake_build --target install -# Build quotest with the installed libQuotient -- cmake $CMAKE_ARGS tests -Bbuild-test -- cmake --build build-test --target all -# Build with qmake -- qmake -Wall quotest.pro "CONFIG += debug" "CONFIG -= app_bundle" "QMAKE_CC = $CC" "QMAKE_CXX = $CXX" -- $QMAKE_E2EE_ARGS -- make all -# Run the qmake-compiled quotest under valgrind -- if [ "$TEST_USER" != "" ]; then LD_LIBRARY_PATH="$LIB_PATH_E2EE" $VALGRIND ./quotest "$TEST_USER" "$TEST_PWD" quotest-travis '#quotest:matrix.org' "Travis CI job $TRAVIS_JOB_NUMBER"; fi - -notifications: - webhooks: - urls: - - "https://scalar.vector.im/api/neb/services/hooks/dHJhdmlzLWNpLyU0MGtpdHN1bmUlM0FtYXRyaXgub3JnLyUyMVBDelV0eHRPalV5U3hTZWxvZiUzQW1hdHJpeC5vcmc" - on_success: change # always|never|change - on_failure: always - on_start: never -- cgit v1.2.3