Reorganise QtTest 3rdparty to separate its various parts

In the process, update the Linux perf_event.h provenance details to
make it possible to find the latest version. Also, remove 3rdparty
headers from the module's CMakeLists.txt (where possible) so that
anything that includes them makes its 3rdparty dependence visible in
the relative path. That can't be applied to cycle_p.h, though, as it's
used by the tests.

Task-number: QTBUG-126080
Change-Id: I3a7099bc123ba7188ad096714cb7ed45ff35a392
Reviewed-by: Jason McDonald <macadder1@gmail.com>
(cherry picked from commit b14906884c63b3f5f239d7d008eb23aba66836fa)
This commit is contained in:
Edward Welbourne 2024-06-05 16:39:03 +02:00
parent 2f319c889d
commit 23e0318d24
17 changed files with 77 additions and 60 deletions

View File

@ -18,7 +18,7 @@
#include <assert.h>
#ifdef Q_OS_LINUX
# include "../testlib/3rdparty/valgrind_p.h"
# include "../testlib/3rdparty/valgrind/valgrind_p.h"
#endif
#define QT_FUNCTION_TARGET_BASELINE

View File

@ -0,0 +1,16 @@
[
{
"Id": "cycle",
"Name": "Cycle",
"QDocModule": "qttestlib",
"QtUsage": "Used in the Qt Test module.",
"Files": "cycle_p.h",
"Description": "Allows to access the CPU's cycle counters.",
"License": "MIT License",
"LicenseId": "MIT",
"LicenseFile": "LICENSE.txt",
"Copyright": ["Copyright (c) 2003, 2006 Matteo Frigo",
"Copyright (c) 2003, 2006 Massachusetts Institute of Technology"]
}
]

View File

@ -0,0 +1,28 @@
[
{
"Id": "linuxperf",
"Name": "Linux Performance Events",
"QDocModule": "qttestlib",
"QtUsage": "Used on Linux and Android in the Qt Test module.",
"Comment": { "UpstreamFile": "include/uapi/linux/perf_event.h",
"Repository": "https://github.com/torvalds/linux",
"License-note": "The SPDX's 'WITH Linux-syscall-note' is why we can use it",
"Update": [
"Not normally needed unless",
"New feature in QtTest needs something in a newer version",
"or if a Linux port to some new architecture omits old API"
]
},
"Files": "perf_event_p.h",
"Description": "Allows access to the Linux kernel's performance events.",
"Homepage": "https://www.kernel.org",
"Version": "6.0",
"License": "GNU General Public License v2.0 only with Linux Syscall Note",
"LicenseId": "GPL-2.0-only WITH Linux-syscall-note",
"LicenseFile": "LICENSE.txt",
"Copyright": ["Copyright (C) 2008-2009, Thomas Gleixner <tglx@linutronix.de>",
"Copyright (C) 2008-2011, Red Hat, Inc., Ingo Molnar",
"Copyright (C) 2008-2011, Red Hat, Inc., Peter Zijlstra"]
}
]

View File

@ -1,51 +0,0 @@
[
{
"Id": "valgrind",
"Name": "Valgrind",
"QDocModule": "qttestlib",
"QtUsage": "Used on Linux ond MacOS in the Qt Test module.",
"Comment": { "UpstreamFiles": [ "include/valgrind.h.in", "callgrind/callgrind.h" ],
"License": "These two files are BSD; the rest of valgrind is GPL" },
"Files": [ "valgrind_p.h", "callgrind_p.h" ],
"Description": "An instrumentation framework for building dynamic analysis tools.",
"Homepage": "http://valgrind.org/",
"Version": "3.22.0",
"License": "BSD 4-clause \"Original\" or \"Old\" License",
"LicenseId": "BSD-4-Clause",
"LicenseFile": "VALGRIND_LICENSE.txt",
"Copyright": ["Copyright (C) 2000-2017 Julian Seward",
"Copyright (C) 2003-2017 Josef Weidendorfer."]
},
{
"Id": "cycle",
"Name": "Cycle",
"QDocModule": "qttestlib",
"QtUsage": "Used in the Qt Test module.",
"Files": "cycle_p.h",
"Description": "Allows to access the CPU's cycle counters.",
"License": "MIT License",
"LicenseId": "MIT",
"LicenseFile": "CYCLE_LICENSE.txt",
"Copyright": ["Copyright (c) 2003, 2006 Matteo Frigo",
"Copyright (c) 2003, 2006 Massachusetts Institute of Technology"]
},
{
"Id": "linuxperf",
"Name": "Linux Performance Events",
"QDocModule": "qttestlib",
"QtUsage": "Used on Linux and Android in the Qt Test module. Note that this is a copy of the respective Linux header, and the clarifications of the Linux Syscall Note apply.",
"Files": "linux_perf_event_p.h",
"Description": "Allows access to the Linux kernel's performance events.",
"Homepage": "https://www.kernel.org",
"Version": "3.7",
"License": "GNU General Public License v2.0 only with Linux Syscall Note",
"LicenseId": "GPL-2.0-only WITH Linux-syscall-note",
"LicenseFile": "LINUX_LICENSE.txt",
"Copyright": ["Copyright (C) 2008-2009, Thomas Gleixner <tglx@linutronix.de>",
"Copyright (C) 2008-2011, Red Hat, Inc., Ingo Molnar",
"Copyright (C) 2008-2011, Red Hat, Inc., Peter Zijlstra"]
}
]

View File

@ -0,0 +1,20 @@
[
{
"Id": "valgrind",
"Name": "Valgrind",
"QDocModule": "qttestlib",
"QtUsage": "Used on Linux ond MacOS in the Qt Test module.",
"Comment": { "UpstreamFiles": [ "include/valgrind.h.in", "callgrind/callgrind.h" ],
"License": "These two files are BSD; the rest of valgrind is GPL" },
"Files": [ "valgrind_p.h", "callgrind_p.h" ],
"Description": "An instrumentation framework for building dynamic analysis tools.",
"Homepage": "http://valgrind.org/",
"Version": "3.22.0",
"License": "BSD 4-clause \"Original\" or \"Old\" License",
"LicenseId": "BSD-4-Clause",
"LicenseFile": "LICENSE.txt",
"Copyright": ["Copyright (C) 2000-2017 Julian Seward",
"Copyright (C) 2003-2017 Josef Weidendorfer."]
}
]

View File

@ -12,7 +12,7 @@ qt_internal_add_module(Test
QMAKE_MODULE_CONFIG console testlib_defines
EXCEPTIONS
SOURCES
3rdparty/cycle_p.h
3rdparty/cycle/cycle_p.h # Needed by tests, so visible to syncqt.
removed_api.cpp # keep first
qabstracttestlogger.cpp qabstracttestlogger_p.h
qasciikey.cpp
@ -79,7 +79,9 @@ qt_internal_add_module(Test
PRIVATE_MODULE_INTERFACE
Qt::CorePrivate
ATTRIBUTION_FILE_DIR_PATHS
3rdparty
3rdparty/cycle
3rdparty/linux
3rdparty/valgrind
)
if(TARGET Gui)
@ -100,10 +102,12 @@ qt_internal_extend_target(Test CONDITION QT_FEATURE_batch_test_support
qtestregistry.cpp qtestregistry_p.h
)
# 3rdparty/valgrind/*_p.h deliberately omitted, so syncqt doesn't
# mirror it in generated include/ directory - #include using "..._p.h"
# with a relative path. Only this module's sources and Core's qsimd.h
# should need to.
qt_internal_extend_target(Test CONDITION QT_FEATURE_valgrind
SOURCES
3rdparty/callgrind_p.h
3rdparty/valgrind_p.h
qbenchmarkvalgrind.cpp qbenchmarkvalgrind_p.h
)

View File

@ -41,7 +41,7 @@ int QBenchmarkTimeMeasurer::adjustMedianCount(int)
return 1;
}
#ifdef HAVE_TICK_COUNTER // defined in 3rdparty/cycle_p.h
#ifdef HAVE_TICK_COUNTER // defined in 3rdparty/cycle/cycle_p.h
void QBenchmarkTickMeasurer::start()
{

View File

@ -21,7 +21,7 @@
#include <sys/prctl.h>
#include <sys/syscall.h>
#include "3rdparty/linux_perf_event_p.h"
#include "3rdparty/linux/perf_event_p.h"
// for PERF_TYPE_HW_CACHE, the config is a bitmask
// lowest 8 bits: cache type

View File

@ -34,7 +34,7 @@ private:
QElapsedTimer time;
};
#ifdef HAVE_TICK_COUNTER // defined in 3rdparty/cycle_p.h
#ifdef HAVE_TICK_COUNTER // defined in 3rdparty/cycle/cycle_p.h
class QBenchmarkTickMeasurer : public QBenchmarkMeasurerBase
{

View File

@ -10,7 +10,7 @@
#include <QtCore/qdir.h>
#include <QtCore/qregularexpression.h>
#include <QtCore/qset.h>
#include <QtTest/private/callgrind_p.h>
#include "3rdparty/valgrind/callgrind_p.h"
#include <charconv>
#include <optional>