From 970e2742b0abb2474d926c121bbd48654761f1b0 Mon Sep 17 00:00:00 2001 From: Assam Boudjelthia Date: Mon, 16 Sep 2024 15:25:14 +0300 Subject: [PATCH] Add test to check the libs are working properly It's a simple check at runtime to see if ssl is supported using the included libs. --- .gitignore | 1 + tst_openssl/CMakeLists.txt | 17 +++++++++++++++++ tst_openssl/tst_openssl.cpp | 17 +++++++++++++++++ tst_openssl/tst_openssl.pro | 9 +++++++++ 4 files changed, 44 insertions(+) create mode 100644 tst_openssl/CMakeLists.txt create mode 100644 tst_openssl/tst_openssl.cpp create mode 100644 tst_openssl/tst_openssl.pro diff --git a/.gitignore b/.gitignore index 880ac59..1c072b5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ build/ .DS_Store +*.user diff --git a/tst_openssl/CMakeLists.txt b/tst_openssl/CMakeLists.txt new file mode 100644 index 0000000..5c990f0 --- /dev/null +++ b/tst_openssl/CMakeLists.txt @@ -0,0 +1,17 @@ +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_openssl LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + +qt_internal_add_test(tst_openssl + SOURCES + tst_openssl.cpp + LIBRARIES + Qt::Network +) + +if (ANDROID) + include(../android_openssl.cmake) + add_android_openssl_libraries(tst_openssl) +endif() diff --git a/tst_openssl/tst_openssl.cpp b/tst_openssl/tst_openssl.cpp new file mode 100644 index 0000000..a5d3850 --- /dev/null +++ b/tst_openssl/tst_openssl.cpp @@ -0,0 +1,17 @@ +#include +#include + +class tst_OpenSsl : public QObject +{ + Q_OBJECT +private slots: + void supportsSsl(); +}; + +void tst_OpenSsl::supportsSsl() { + QVERIFY(QSslSocket::supportsSsl()); +} + +QTEST_MAIN(tst_OpenSsl) + +#include "tst_openssl.moc" diff --git a/tst_openssl/tst_openssl.pro b/tst_openssl/tst_openssl.pro new file mode 100644 index 0000000..94cbac2 --- /dev/null +++ b/tst_openssl/tst_openssl.pro @@ -0,0 +1,9 @@ +QT += testlib gui network + +CONFIG += qt warn_on depend_includepath testcase + +TEMPLATE = app + +SOURCES += tst_openssl.cpp + +android: include(../openssl.pri)