diff options
author | Liang Qi <liang.qi@qt.io> | 2019-08-26 09:07:05 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2019-08-26 09:07:05 +0200 |
commit | 15805ae43ebf828b2481542407fffa12bd6c3c41 (patch) | |
tree | 1d488ca010d8f7ae27ba0865180da64c8fa56a5e /tests | |
parent | 45e3f8129a2dd6d871a627d024023eb5e6a72911 (diff) | |
parent | 53453bea465dbc7a15824ad4db2b19df44e62623 (diff) |
Merge remote-tracking branch 'origin/5.13' into 5.14
Conflicts:
src/3rdparty/open62541.pri
tests/auto/security/tst_security.cpp
Change-Id: I47a14da350c938ddce57327aadfc723f189c6227
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/auto.pro | 4 | ||||
-rw-r--r-- | tests/auto/security/security.pro | 6 | ||||
-rw-r--r-- | tests/auto/security/tst_security.cpp | 18 |
3 files changed, 21 insertions, 7 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index a90406f..9d8b7db 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -1,5 +1,5 @@ TEMPLATE = subdirs -SUBDIRS += qopcuaclient connection clientSetupInCpp +SUBDIRS += qopcuaclient connection clientSetupInCpp security QT_FOR_CONFIG += opcua-private @@ -8,5 +8,3 @@ qtHaveModule(qmltest):qtConfig(open62541)|qtConfig(uacpp) { SUBDIRS += declarative } -# This tries to check if the server supports security -qtConfig(mbedtls): SUBDIRS += security diff --git a/tests/auto/security/security.pro b/tests/auto/security/security.pro index d3d203e..bde83f7 100644 --- a/tests/auto/security/security.pro +++ b/tests/auto/security/security.pro @@ -7,3 +7,9 @@ RESOURCES += certs.qrc SOURCES += \ tst_security.cpp + +HEADERS += \ + $$PWD/../../common/backend_environment.h + +INCLUDEPATH += \ + $$PWD/../../common diff --git a/tests/auto/security/tst_security.cpp b/tests/auto/security/tst_security.cpp index d91f702..6b68bc2 100644 --- a/tests/auto/security/tst_security.cpp +++ b/tests/auto/security/tst_security.cpp @@ -34,6 +34,8 @@ ** ****************************************************************************/ +#include "backend_environment.h" + #include <QtOpcUa/QOpcUaAuthenticationInformation> #include <QtOpcUa/QOpcUaClient> #include <QtOpcUa/QOpcUaEndpointDescription> @@ -249,13 +251,14 @@ void Tst_QOpcUaSecurity::initTestCase() qDebug() << endpoint.securityPolicy(); } } - - QVERIFY(m_endpoints.size() > 0); } } void Tst_QOpcUaSecurity::connectAndDisconnectSecureUnencryptedKey() { + if (m_endpoints.size() == 0) + QSKIP("No secure endpoints available"); + QFETCH(QString, backend); QFETCH(QOpcUaEndpointDescription, endpoint); @@ -263,8 +266,8 @@ void Tst_QOpcUaSecurity::connectAndDisconnectSecureUnencryptedKey() QVERIFY2(client, QString("Loading backend failed: %1").arg(backend).toLatin1().data()); if (!client->supportedSecurityPolicies().contains(endpoint.securityPolicy())) - QSKIP(QString("This test is skipped because backend %1 does not support security policy %2").arg( - client->backend()).arg(endpoint.securityPolicy()).toLatin1().constData()); + QSKIP(QString("This test is skipped because backend %1 does not support security policy %2").arg( + client->backend()).arg(endpoint.securityPolicy()).toLatin1().constData()); const QString pkidir = m_pkiData->path(); QOpcUaPkiConfiguration pkiConfig; @@ -319,6 +322,9 @@ void Tst_QOpcUaSecurity::connectAndDisconnectSecureUnencryptedKey() void Tst_QOpcUaSecurity::connectAndDisconnectSecureEncryptedKey() { + if (m_endpoints.size() == 0) + QSKIP("No secure endpoints available"); + QFETCH(QString, backend); QFETCH(QOpcUaEndpointDescription, endpoint); @@ -328,6 +334,9 @@ void Tst_QOpcUaSecurity::connectAndDisconnectSecureEncryptedKey() if (client->backend() == QLatin1String("open62541")) QSKIP(QString("This test is skipped because backend %1 does not support encrypted keys").arg(client->backend()).toLatin1().constData()); + if (!client->supportedSecurityPolicies().contains(endpoint.securityPolicy())) + QSKIP(QString("This test is skipped because backend %1 does not support security policy %2").arg(client->backend()).arg(endpoint.securityPolicy()).toLatin1().constData()); + const QString pkidir = m_pkiData->path(); QOpcUaPkiConfiguration pkiConfig; pkiConfig.setClientCertificateFile(pkidir + "/own/certs/tst_security.der"); @@ -400,6 +409,7 @@ void Tst_QOpcUaSecurity::cleanupTestCase() int main(int argc, char *argv[]) { + updateEnvironment(); QCoreApplication app(argc, argv); QTEST_SET_MAIN_SOURCE_PATH |