summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/plugin/qpluginloader/theplugin
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/plugin/qpluginloader/theplugin')
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/theplugin/CMakeLists.txt32
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/theplugin/plugininterface.h29
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/theplugin/theoldplugin.cpp80
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/theplugin/theoldplugin.h21
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.cpp29
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.h29
6 files changed, 128 insertions, 92 deletions
diff --git a/tests/auto/corelib/plugin/qpluginloader/theplugin/CMakeLists.txt b/tests/auto/corelib/plugin/qpluginloader/theplugin/CMakeLists.txt
index 5a8bf518c5..dfce9d6a52 100644
--- a/tests/auto/corelib/plugin/qpluginloader/theplugin/CMakeLists.txt
+++ b/tests/auto/corelib/plugin/qpluginloader/theplugin/CMakeLists.txt
@@ -1,8 +1,5 @@
-# Generated from theplugin.pro.
-
-#####################################################################
-## theplugin Generic Library:
-#####################################################################
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
qt_internal_add_cmake_library(theplugin
MODULE
@@ -10,13 +7,26 @@ qt_internal_add_cmake_library(theplugin
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../bin"
SOURCES
theplugin.cpp theplugin.h
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Core
)
+qt_autogen_tools_initial_setup(theplugin)
-#### Keys ignored in scope 1:.:.:theplugin.pro:<TRUE>:
-# INSTALLS = "target"
-# TEMPLATE = "lib"
-# target.path = "$$[QT_INSTALL_TESTS]/tst_qpluginloader/bin"
+if (UNIX AND NOT APPLE)
+ qt_internal_add_cmake_library(theoldplugin
+ MODULE
+ INSTALL_DIRECTORY "${INSTALL_TESTSDIR}/tst_qpluginloader/bin"
+ OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../bin"
+ SOURCES
+ theoldplugin.cpp theoldplugin.h
+ LIBRARIES
+ Qt::Core
+ )
+ qt_autogen_tools_initial_setup(theoldplugin)
+
+ # Force unoptimized builds with debugging information so some "QTMETADATA !"
+ # strings appear elsewhere in the binary.
+ target_compile_options(theplugin PRIVATE -O0 -g3)
+ target_compile_options(theoldplugin PRIVATE -O0 -g3)
+endif()
-qt_autogen_tools_initial_setup(theplugin)
diff --git a/tests/auto/corelib/plugin/qpluginloader/theplugin/plugininterface.h b/tests/auto/corelib/plugin/qpluginloader/theplugin/plugininterface.h
index 12285ba016..3fd6c384a4 100644
--- a/tests/auto/corelib/plugin/qpluginloader/theplugin/plugininterface.h
+++ b/tests/auto/corelib/plugin/qpluginloader/theplugin/plugininterface.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef PLUGININTERFACE_H
#define PLUGININTERFACE_H
diff --git a/tests/auto/corelib/plugin/qpluginloader/theplugin/theoldplugin.cpp b/tests/auto/corelib/plugin/qpluginloader/theplugin/theoldplugin.cpp
new file mode 100644
index 0000000000..20e65b4bb0
--- /dev/null
+++ b/tests/auto/corelib/plugin/qpluginloader/theplugin/theoldplugin.cpp
@@ -0,0 +1,80 @@
+// Copyright (C) 2021 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+#include "theoldplugin.h"
+#include <QtCore/QString>
+#include <QtCore/qplugin.h>
+
+QString TheOldPlugin::pluginName() const
+{
+ return QLatin1String("Plugin ok");
+}
+
+static int pluginVariable = 0xc0ffee;
+extern "C" Q_DECL_EXPORT int *pointerAddress()
+{
+ return &pluginVariable;
+}
+
+// This hardcodes the old plugin metadata from before Qt 6.2
+QT_PLUGIN_METADATA_SECTION
+static constexpr unsigned char qt_pluginMetaData_ThePlugin[] = {
+ 'Q', 'T', 'M', 'E', 'T', 'A', 'D', 'A', 'T', 'A', ' ', '!',
+ // metadata version, Qt version, architectural requirements
+ 0, QT_VERSION_MAJOR, QT_VERSION_MINOR, qPluginArchRequirements(),
+ 0xbf,
+ // "IID"
+ 0x02, 0x78, 0x2b, 'o', 'r', 'g', '.', 'q',
+ 't', '-', 'p', 'r', 'o', 'j', 'e', 'c',
+ 't', '.', 'Q', 't', '.', 'a', 'u', 't',
+ 'o', 't', 'e', 's', 't', 's', '.', 'p',
+ 'l', 'u', 'g', 'i', 'n', 'i', 'n', 't',
+ 'e', 'r', 'f', 'a', 'c', 'e',
+ // "className"
+ 0x03, 0x69, 'T', 'h', 'e', 'P', 'l', 'u',
+ 'g', 'i', 'n',
+ // "MetaData"
+ 0x04, 0xa2, 0x67, 'K', 'P', 'l', 'u', 'g',
+ 'i', 'n', 0xa8, 0x64, 'N', 'a', 'm', 'e',
+ 0x6e, 'W', 'i', 'n', 'd', 'o', 'w', 'G',
+ 'e', 'o', 'm', 'e', 't', 'r', 'y', 0x68,
+ 'N', 'a', 'm', 'e', '[', 'm', 'r', ']',
+ 0x78, 0x1f, uchar('\xe0'), uchar('\xa4'), uchar('\x9a'), uchar('\xe0'), uchar('\xa5'), uchar('\x8c'),
+ uchar('\xe0'), uchar('\xa4'), uchar('\x95'), uchar('\xe0'), uchar('\xa4'), uchar('\x9f'), ' ', uchar('\xe0'),
+ uchar('\xa4'), uchar('\xad'), uchar('\xe0'), uchar('\xa5'), uchar('\x82'), uchar('\xe0'), uchar('\xa4'), uchar('\xae'),
+ uchar('\xe0'), uchar('\xa4'), uchar('\xbf'), uchar('\xe0'), uchar('\xa4'), uchar('\xa4'), uchar('\xe0'), uchar('\xa5'),
+ uchar('\x80'), 0x68, 'N', 'a', 'm', 'e', '[', 'p',
+ 'a', ']', 0x78, 0x24, uchar('\xe0'), uchar('\xa8'), uchar('\xb5'), uchar('\xe0'),
+ uchar('\xa8'), uchar('\xbf'), uchar('\xe0'), uchar('\xa9'), uchar('\xb0'), uchar('\xe0'), uchar('\xa8'), uchar('\xa1'),
+ uchar('\xe0'), uchar('\xa9'), uchar('\x8b'), uchar('\xe0'), uchar('\xa8'), uchar('\x9c'), uchar('\xe0'), uchar('\xa9'),
+ uchar('\x81'), uchar('\xe0'), uchar('\xa8'), uchar('\xae'), uchar('\xe0'), uchar('\xa9'), uchar('\x88'), uchar('\xe0'),
+ uchar('\xa8'), uchar('\x9f'), uchar('\xe0'), uchar('\xa8'), uchar('\xb0'), uchar('\xe0'), uchar('\xa9'), uchar('\x80'),
+ 0x68, 'N', 'a', 'm', 'e', '[', 't', 'h',
+ ']', 0x78, 0x39, uchar('\xe0'), uchar('\xb8'), uchar('\xa1'), uchar('\xe0'), uchar('\xb8'),
+ uchar('\xb4'), uchar('\xe0'), uchar('\xb8'), uchar('\x95'), uchar('\xe0'), uchar('\xb8'), uchar('\xb4'), uchar('\xe0'),
+ uchar('\xb8'), uchar('\x82'), uchar('\xe0'), uchar('\xb8'), uchar('\x99'), uchar('\xe0'), uchar('\xb8'), uchar('\xb2'),
+ uchar('\xe0'), uchar('\xb8'), uchar('\x94'), uchar('\xe0'), uchar('\xb8'), uchar('\x82'), uchar('\xe0'), uchar('\xb8'),
+ uchar('\xad'), uchar('\xe0'), uchar('\xb8'), uchar('\x87'), uchar('\xe0'), uchar('\xb8'), uchar('\xab'), uchar('\xe0'),
+ uchar('\xb8'), uchar('\x99'), uchar('\xe0'), uchar('\xb9'), uchar('\x89'), uchar('\xe0'), uchar('\xb8'), uchar('\xb2'),
+ uchar('\xe0'), uchar('\xb8'), uchar('\x95'), uchar('\xe0'), uchar('\xb9'), uchar('\x88'), uchar('\xe0'), uchar('\xb8'),
+ uchar('\xb2'), uchar('\xe0'), uchar('\xb8'), uchar('\x87'), 0x68, 'N', 'a', 'm',
+ 'e', '[', 'u', 'k', ']', 0x78, 0x19, uchar('\xd0'),
+ uchar('\xa0'), uchar('\xd0'), uchar('\xbe'), uchar('\xd0'), uchar('\xb7'), uchar('\xd0'), uchar('\xbc'), uchar('\xd1'),
+ uchar('\x96'), uchar('\xd1'), uchar('\x80'), uchar('\xd0'), uchar('\xb8'), ' ', uchar('\xd0'), uchar('\xb2'),
+ uchar('\xd1'), uchar('\x96'), uchar('\xd0'), uchar('\xba'), uchar('\xd0'), uchar('\xbd'), uchar('\xd0'), uchar('\xb0'),
+ 0x6b, 'N', 'a', 'm', 'e', '[', 'z', 'h',
+ '_', 'C', 'N', ']', 0x6c, uchar('\xe7'), uchar('\xaa'), uchar('\x97'),
+ uchar('\xe5'), uchar('\x8f'), uchar('\xa3'), uchar('\xe5'), uchar('\xbd'), uchar('\xa2'), uchar('\xe7'), uchar('\x8a'),
+ uchar('\xb6'), 0x6b, 'N', 'a', 'm', 'e', '[', 'z',
+ 'h', '_', 'T', 'W', ']', 0x6c, uchar('\xe8'), uchar('\xa6'),
+ uchar('\x96'), uchar('\xe7'), uchar('\xaa'), uchar('\x97'), uchar('\xe4'), uchar('\xbd'), uchar('\x8d'), uchar('\xe7'),
+ uchar('\xbd'), uchar('\xae'), 0x6c, 'S', 'e', 'r', 'v', 'i',
+ 'c', 'e', 'T', 'y', 'p', 'e', 's', 0x81,
+ 0x68, 'K', 'C', 'M', 'o', 'd', 'u', 'l',
+ 'e', 0x76, 'X', '-', 'K', 'D', 'E', '-',
+ 'P', 'a', 'r', 'e', 'n', 't', 'C', 'o',
+ 'm', 'p', 'o', 'n', 'e', 'n', 't', 's',
+ 0x81, 0x6e, 'w', 'i', 'n', 'd', 'o', 'w',
+ 'g', 'e', 'o', 'm', 'e', 't', 'r', 'y',
+ 0xff,
+};
+QT_MOC_EXPORT_PLUGIN(TheOldPlugin, ThePlugin)
diff --git a/tests/auto/corelib/plugin/qpluginloader/theplugin/theoldplugin.h b/tests/auto/corelib/plugin/qpluginloader/theplugin/theoldplugin.h
new file mode 100644
index 0000000000..786ce3f618
--- /dev/null
+++ b/tests/auto/corelib/plugin/qpluginloader/theplugin/theoldplugin.h
@@ -0,0 +1,21 @@
+// Copyright (C) 2021 Intel Corportaion.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+#ifndef THEOLDPLUGIN_H
+#define THEOLDPLUGIN_H
+
+#include <QObject>
+#include <QtPlugin>
+#include "plugininterface.h"
+
+class TheOldPlugin : public QObject, public PluginInterface
+{
+ Q_OBJECT
+ // Q_PLUGIN_METADATA intentionally missing
+ Q_INTERFACES(PluginInterface)
+
+public:
+ virtual QString pluginName() const override;
+};
+
+#endif // THEOLDPLUGIN_H
+
diff --git a/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.cpp b/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.cpp
index 01563c3dc9..bfa45c7c48 100644
--- a/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.cpp
+++ b/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtCore/QString>
#include "theplugin.h"
#include <QtCore/qplugin.h>
diff --git a/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.h b/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.h
index 7c9324b8b3..a6b7e4a083 100644
--- a/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.h
+++ b/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef THEPLUGIN_H
#define THEPLUGIN_H