summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
Commit message (Collapse)AuthorAgeFilesLines
* QHash: avoid crashing when reserving on a shared hashMårten Nordheim2021-10-261-0/+17
| | | | | | | | Pick-to: 6.2 Change-Id: I21ad13fa223bd5a2c61112e790965093a2750268 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QHash: double the size of the stored seedThiago Macieira2021-10-261-0/+12
| | | | | | | | | | | | | | | | There's now another half of the seed which will be used by the hashers. This is not stored in QHash, so it is never changed for the lifetime of the application (not even when QHashSeed::setDeterministicGlobalSeed() is called). However, we will not use it when we're in deterministic mode. This commit uses the compiler thread-safe statics to implement the initialization of more than one atomic word, thus freeing us from having to have a reserved value. As a bonus, the QT_HASH_SEED warning will only be printed once. Change-Id: Id2983978ad544ff79911fffd16723f1673f9a5b4 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix overflow issue on parsing min-qint64 with its minus sign repeatedEdward Welbourne2021-10-261-0/+1
| | | | | | | | | | | The call to std::from_chars() accepts a sign, but we've already dealt with a sign, so that would be a second sign. Check the first character after any prefix is in fact a digit (for the base in use). This is a follow-up to commit 5644af6f8a800a1516360a42ba4c1a8dc61fc516. Fixes: QTBUG-97521 Change-Id: I65fb144bf6a8430da90ec5f65088ca20e79bf02f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QVarLengthArray: Reduce memory allocations in emplace()Robert Löhning2021-10-231-0/+27
| | | | | | | | | | | | | | | | Currently, we allocate memory for elements one by one which can get pretty slow when adding many elements. [ChangeLog][QtCore][QVarLengthArray] Reduced number of memory allocations in emplace() by allocating more memory at once. Fixes: QTBUG-97489 Pick-to: 6.2 Change-Id: Idfb5b5946b047d5215c8ed00770574249f9f5d40 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Consistently restore threadpool limit at end of testsVolker Hilsheimer2021-10-221-12/+23
| | | | | | | | | | | Fix warning about unused variable, and use qScopeGuard to make sure that the limit of the global threadpool is restored even if one of the tests fail. Pick-to: 6.2 Change-Id: I36747cb451074cceea961561478210728ed6d313 Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* tst_QVariant: suppress warning about memcpying over QVariantThiago Macieira2021-10-211-1/+1
| | | | | | | tst_qvariant.cpp:3624:15: warning: ‘void* memcpy(void*, const void*, size_t)’ writing to an object of type ‘class QVariant’ with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Wclass-memaccess] Change-Id: Ic17a33f599b844d8ab5dfffd16aafcbd74823696 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Remove the unnecessary compile-time check for recursive QSetSona Kurazyan2021-10-211-2/+0
| | | | | | | | | | | | It doesn't make sense to have a recursive QSet with deleted operator==, since it's not possible to add elements to it. Consequently declaring a metatype for it also doesn't make sense. Remove the commented compile-time check for it. Task-number: QTBUG-96257 Change-Id: I74ebefb38adcbe36d5c2f317188743e1f37fe16d Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix metatype declaration for QHash/QMultiHash with no operator==Sona Kurazyan2021-10-201-6/+4
| | | | | | | | | | | | | | | | | | | | | | | When declaring metatypes, the metatype system tries to detect if the comparison operators for the given type exist and automatically register them. In case of QHash, the equality operator was enabled if the value type provides one. But the implementation needs equality operator of the key type as well. As a result, when the key type has no equality operator, the metatype system detects that the equality operator is available for the QHash itself, but the compilation for metatype registration fails when trying to instantiate the code that uses equality operator for the key. This is fixed by enabling equality operators for the QHash only when both the key and value types provide one. The same issue existed also for QMultiHash, with the difference, that QMultiHash didn't have the constraints even on the value type. So added checks for both. Fixes: QTBUG-96256 Pick-to: 6.2 Change-Id: Ib8b6d365223f2b3515cbcb1843524cd6f867a6ac Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QObjectCompatProperty: Add support for custom gettersIevgenii Meshcheriakov2021-10-201-1/+56
| | | | | | | | | | Add additional template argument to QObjectCompatProperty to specify a custom getter. This may be useful for classes like QAbstractProxyModelPrivate the need to customize property getters. Task-number: QTBUG-89655 Change-Id: I34fe4bdebbbf1446aff60bd20a946454607f52d5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Make QDir::mkpath() return true when given an existing root pathKarsten Heimrich2021-10-201-4/+4
| | | | | | | | | | On macOs with APFS mkdir sets errno to EISDIR, so take the error code into account. Pick-to: 6.2 Fixes: QTBUG-97110 Change-Id: I8e7d10c95430a2802bdbfbf94dd65219bd9071a7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Make QDir::mkpath() return true when given an existing drive nameKarsten Heimrich2021-10-201-0/+5
| | | | | | | | | | | | Commit ed48391c592e8ba68c723e3017ac384f0c7a7c23 removed the check for ERROR_ACCESS_DENIED reported by the Windows CreateDirectory(...) function in case an existing windows drive name was passed as argument. This restores the behavior of the function which broke after 5.15. Pick-to: 6.2 Fixes: QTBUG-85997 Change-Id: Ie86188100766f7364acee57b15a250f4a2720b9f Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* Compile Private API autotests for INTEGRITYTatiana Borisova2021-10-201-3/+1
| | | | | | | | | | | | | | | | | | | | | - GHS's __PRETTY_FUNCTION__ (used by QT as Q_FUNC_INFO) doesn't have spaces round the = operator when indicating the type of the template parameter. The compilation error: qt5/qtbase/src/corelib/kernel/qmetatype.h", line 2104: note #3316-D: cannot access position 53 in array of 49 elements constexpr const char *begin = func + prefix; ^ detected during: instantiation of "auto QtPrivate::typenameHelper<T>() [with T=void]" at line 2186 Task-number: QTBUG-97087 Pick-to: 6.2 Change-Id: I33e61f5d54a61944a5aecf07d149a8dee0ef1e5d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update UCD to Revision 28Ievgenii Meshcheriakov2021-10-189-259/+261
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This corresponds to Unicode version 14.0.0. Added the following scripts: * CyproMinoan * OldUyghur * Tangsa * Toto * Vithkuqi Full support of these scripts requires harfbuzz version 3.0.0, this version adds support for Unicode 14.0: https://github.com/harfbuzz/harfbuzz/releases/tag/3.0.0 With this release 10 test cases in tst_qurluts46 were fixed, one additional test case is failing in tst_qtextboundaryfinder and is commented out. In total 62 line break test cases and 44 word break test cases are failing. A comment in src/corelib/text/qt_attribution.json was updated to include the URL of the page containing UCD version number. Fixes: QTBUG-94359 Change-Id: Iefc9ff13f3df279f91cbdb1246d56f75b20ecb35 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QPlugin: Move the plugin metadata to a note in ELF platformsThiago Macieira2021-10-186-62/+503
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A few systems, like OpenWRT, may strip the section table off the resulting binaries (see [1]), making it impossible for us to pinpoint the exact location of the Qt plugin metadata. This commit moves the meta data to a location that is identifiable even in fully stripped binaries: an ELF note. By naming our section ".note.qt.metadata", we instruct the linker to place it along the other notes and to mark it in the program header section. Another advantage is that the notes are usually in the very beginning of the file, as they are used by the dynamic linker itself, so we'll need to read much less of the full contents. The unit test is modified not to attempt to strip the plugin of debugging data. In fact, we add something to the end that would, otherwise, be matched as (invalid) metadata. The following was produced with GCC 11 and GNU binutils ld 2.36.1. Section Headers: [Nr] Name Type Addr Off Size ES Flags Lk Inf Al [ 0] NULL 0000000000000000 00000000 00000000 0 0 0 0 [ 1] .note.gnu.property NOTE 00000000000002a8 000002a8 00000030 0 A 0 0 8 [ 2] .note.gnu.build-id NOTE 00000000000002d8 000002d8 00000024 0 A 0 0 4 [ 3] .note.qt.metadata NOTE 00000000000002fc 000002fc 000001ac 0 A 0 0 4 Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align ... NOTE 0x0002a8 0x00000000000002a8 0x00000000000002a8 0x000030 0x000030 R 0x8 NOTE 0x0002d8 0x00000000000002d8 0x00000000000002d8 0x0001d0 0x0001d0 R 0x4 The Qt metadata note is 4-byte aligned and can thus be found in the second note section, which spans from 0x02d8 to 0x02d8+0xac=0x0384. GNU readelf -n can even show it: Displaying notes found in: .note.qt.metadata Owner Data size Description qt-project! 0x0000018f Unknown note type: (0x74510001) description data: 01 06 03 81 bf ...... ff I chose 0x7451 as the prefix for our notes, even though they're already namespaced by the owner in the first place, because eu-readelf mistakenly tries to interpret note 1 as a GNU ABI tag regardless of owner. The owner name was chosen to be 12 bytes long, so the ELF note header is 24 bytes in total. There's no space wasted because the payload needs to be aligned to 32-bit anyway and I didn't want to use only 4 characters (header total size 16 bytes) so we'd skip the "GNU" note on size, without string comparison. And I couldn't think of a 4-character representative string ("QtP" ?). [1] https://github.com/openwrt/video/issues/1 Fixes: QTBUG-96327 Change-Id: I2de1b4dfacd443148279fffd16a3987729346567 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix autotest public API compilation for INTEGRITYTatiana Borisova2021-10-151-4/+8
| | | | | | | | | | - getgid/getpwuid are not supported - process should be used with config check Task-number: QTBUG-96176 Pick-to: 6.2 Change-Id: Ib6854772bcf52f3533cb722f963426717926258b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QList: avoid a iterator->pointer conversion in the testGiuseppe D'Angelo2021-10-141-1/+1
| | | | | | | | Being a test, I'm going to abuse operator-> on end() to check that we get what we want (a pointer past the end). Change-Id: I7ab8d017b0fe320018820eff336d496328ade481 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: remove support for building Qt with the old Intel compilerThiago Macieira2021-10-131-11/+0
| | | | | | | | | | | | | | | | | | This hasn't worked for some time. It's not in our CI and I don't think it was working at all. When I tried to build it, I ran into several problems with C++17 and an Internal Compiler Error I did not have any interest in working around. After discussing with the Intel compiler team, it was decided that fixing those issues in the old compiler is not going to happen. Instead, their recommendation is to adopt the new LLVM-based compiler, which the last commit added support for. This commit does not remove qmake support for the old ICC. It's possible someone is using qmake with a non-Qt6 project and ICC. Change-Id: Icb2516126f674e7b8bb3fffd16ad6350ddbd49e5 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Re-enable QT_NO_NARROWING_CONVERSIONS_IN_CONNECT for QtGiuseppe D'Angelo2021-10-131-0/+5
| | | | | | | | | | This define used to be set for the entirety of the Qt build but was lost during the qmake->CMake transition. Re-enable it. Change-Id: Idc4cb6ada485158559485b60f62f76439550b255 Pick-to: 6.2 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Fix handling of time-zone gap in QTimeZonePrivate::dataForLocalTime()Edward Welbourne2021-10-121-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | This was handled correctly when the backend supplies transitions bracketing the time in question, but the fallback code tried to use the DST offset at the time with larger offset from UTC; this did not work when the gap was due to a change in standard time. Discovered by ANS1 parsing of a date-time with two-digit year, for which the date-time parser tried to use 1921-05-01T00:00 local time when filling in the fields it had parsed; but, when run in Europe/Helsinki, there is no such time due to the 20m 11s skipped when joining EET from the prior local solar mean time. Correct the calculation to use the actual change in offset from UTC, as used in the (far better tested) between-transitions branch of the code, rather than the DST offset after the transition. Add a test-case based on the ASN.1 certificate date whose parsing revealed the issue. Although it seems nothing in Coin can reproduce the issue, the reporter has verified that the test does indeed fail on the system where the bug was found and the fix does fix it. Fixes: QTBUG-96861 Pick-to: 6.2 Change-Id: I12b02bad01daca2073d1a356452cd573684aa688 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QList::iterator: use templates for advancing operatorsThiago Macieira2021-10-121-0/+134
| | | | | | | | | | | | | | | | | | | | | | | | | Because of the addition of the operator T*(), the expression "it + N" where N was not exactly qsizetype but any other integer type was a compilation failure because of ambiguous overload resolution. With GCC it's apparently a warning: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second: note: candidate 1: ‘QList<T>::iterator QList<T>::iterator::operator+(qsizetype) const [with T = char; qsizetype = long long int]’ note: candidate 2: ‘operator+(char*, ptrdiff_t {aka long int})’ (built-in) With Clang, it's an error: error: use of overloaded operator '+' is ambiguous (with operand types 'QList<int>::const_iterator' and 'ptrdiff_t' (aka 'long')) note: candidate function inline const_iterator operator+(qsizetype j) const { return const_iterator(i+j); } note: built-in candidate operator+(const int *, long) Pick-to: 6.2 Fixes: QTBUG-96128 Change-Id: Ie72b0dd0fbe84d2caae0fffd16a06f23dd56b060 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QOffsetStringArray: rewrite in modern C++17Thiago Macieira2021-10-112-13/+18
| | | | | | | | | Less clunky due to having better constexpr support, plus fold expressions. Change-Id: I3eb1bd30e0124f89a052fffd16a6bc73ba79ec19 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Optimize QPromise destructorSona Kurazyan2021-10-082-0/+72
| | | | | | | | | Unify cancel and finish in QPromise destructor in a single call. This saves us one extra mutex lock and atomic state change. Task-number: QTBUG-84977 Change-Id: Iac06302c39a2863008b27325fcf6792d4f58c8ae Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Add a basic round-trip test for QStringConverterEdward Welbourne2021-10-071-1/+56
| | | | | | | | | | | | For now it only has a trivial test (empty) and an all-surrogate test (Chakma digits) - but at least now all conversions to and from UTF-16 are tested. In particular, there were previously no UTF-32 tests. Pick-to: 6.2 Change-Id: I9317928a88b9990530126db80e4756b880a364df Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QElfParser: rewrite using elf.hThiago Macieira2021-10-069-55/+317
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This rewrite uses the actual structures supplied by the system's C library, so it should be easier to read. It removes hardcoded constants with little evident meaning in favor of sizeof() and the macros from that header. It also removes advancing the data pointer in favor of having absolute offsets. The resulting implementation is stricter than the original, checking more fields in the header. Because the QPluginLoader and QFactoryLoader users may make decisions based on availability of plugins before attempting to load them, it's better to be stricter here than to fail later when trying to dlopen() them. Debugging and testing are much improved. Instead of stored artifacts, I added a routine to modify a valid plugin to make it invalid, given the conditions we've found so far. If you turn debugging on for this category, you'll see things like: not-elf.fcqdMq.so : Not an ELF file (invalid signature) wrong-word-size.QrnSAx.so : ELF 32-bit LSB (GNU/Linux), version 1, shared library or PIC executable, x86-64 invalid-word-size.bOkXvp.so : Invalid ELF file (class 0), LSB (GNU/Linux) unknown-word-size.ogYKeF.so : Invalid ELF file (class 66), LSB (GNU/Linux) wrong-endian.owiElX.so : ELF 64-bit MSB (GNU/Linux), version 1, shared library or PIC executable, x86-64 invalid-endian.FRxClR.so : ELF 64-bit invalid endianness (0) (GNU/Linux) unknown-endian.FfvRrP.so : ELF 64-bit invalid endianness (65) (GNU/Linux) elf-version-0.gPTdpQ.so : ELF 64-bit LSB (GNU/Linux), file version 0 elf-version-2.jlIUUg.so : ELF 64-bit LSB (GNU/Linux), file version 2 executable.LlXiFp.so : ELF 64-bit LSB (GNU/Linux), version 1, executable, x86-64 relocatable.UsOYuy.so : ELF 64-bit LSB (GNU/Linux), version 1, relocatable, x86-64 core-file.hqvNRz.so : ELF 64-bit LSB (GNU/Linux), version 1, core dump, x86-64 invalid-type.CIJgfS.so : ELF 64-bit LSB (GNU/Linux), version 1, unknown type 259, x86-64 wrong-arch.UcNmgz.so : ELF 64-bit LSB (GNU/Linux), version 1, shared library or PIC executable, AArch64 file-version-0.lZYuda.so : ELF 64-bit LSB (GNU/Linux), version 0, shared library or PIC executable, x86-64 file-version-2.ucfdwL.so : ELF 64-bit LSB (GNU/Linux), version 2, shared library or PIC executable, x86-64 no-sections.rSjsHh.so : ELF 64-bit LSB (GNU/Linux), version 1, shared library or PIC executable, x86-64 no-sections.rSjsHh.so : contains 0 sections of 64 bytes at offset 0 ; section header string table (shstrtab) is entry 0 no-sections.rSjsHh.so : no section table present, not able to find Qt metadata qtmetadata-executable.vrxcIf.so : ELF 64-bit LSB (GNU/Linux), version 1, shared library or PIC executable, x86-64 qtmetadata-executable.vrxcIf.so : contains 42 sections of 64 bytes at offset 997256 ; section header string table (shstrtab) is entry 41 qtmetadata-executable.vrxcIf.so : shstrtab section is located at offset 996831 size 423 qtmetadata-executable.vrxcIf.so : section 0 name "" type NULL flags X offset 0x0 size 0x0 qtmetadata-executable.vrxcIf.so : section 1 name ".note.gnu.property" type NOTE flags AX offset 0x2a8 size 0x30 qtmetadata-executable.vrxcIf.so : section 2 name ".note.gnu.build-id" type NOTE flags AX offset 0x2d8 size 0x24 qtmetadata-executable.vrxcIf.so : section 3 name ".hash" type HASH flags AX offset 0x300 size 0x44c qtmetadata-executable.vrxcIf.so : section 4 name ".gnu.hash" type 0x6ffffff6 flags AX offset 0x750 size 0x3b8 qtmetadata-executable.vrxcIf.so : section 5 name ".dynsym" type DYNSYM flags AX offset 0xb08 size 0xd50 qtmetadata-executable.vrxcIf.so : section 6 name ".dynstr" type STRTAB flags AX offset 0x1858 size 0x15d8 qtmetadata-executable.vrxcIf.so : section 7 name ".gnu.version" type 0x6fffffff flags AX offset 0x2e30 size 0x11c qtmetadata-executable.vrxcIf.so : section 8 name ".gnu.version_r" type 0x6ffffffe flags AX offset 0x2f50 size 0xb0 qtmetadata-executable.vrxcIf.so : section 9 name ".rela.dyn" type RELA flags AX offset 0x3000 size 0x480 qtmetadata-executable.vrxcIf.so : section 10 name ".rela.plt" type RELA flags AX offset 0x3480 size 0x7e0 qtmetadata-executable.vrxcIf.so : section 11 name ".init" type PROGBITS flags AX offset 0x4000 size 0x1b qtmetadata-executable.vrxcIf.so : section 12 name ".plt" type PROGBITS flags AX offset 0x4020 size 0x550 qtmetadata-executable.vrxcIf.so : section 13 name ".plt.got" type PROGBITS flags AX offset 0x4570 size 0x8 qtmetadata-executable.vrxcIf.so : section 14 name ".text" type PROGBITS flags AX offset 0x4580 size 0x110e qtmetadata-executable.vrxcIf.so : section 15 name ".fini" type PROGBITS flags AX offset 0x5690 size 0xd qtmetadata-executable.vrxcIf.so : section 16 name ".rodata" type PROGBITS flags AX offset 0x6000 size 0x473 qtmetadata-executable.vrxcIf.so : section 17 name ".qtversion" type PROGBITS flags AX offset 0x6478 size 0x10 qtmetadata-executable.vrxcIf.so : section 18 name ".qtmetadata" type PROGBITS flags AX offset 0x64a0 size 0x19b qtmetadata-executable.vrxcIf.so : found .qtmetadata section qtmetadata-writable.stzwrk.so : ELF 64-bit LSB (GNU/Linux), version 1, shared library or PIC executable, x86-64 Change-Id: I42eb903a916645db9900fffd16a4437af9728eea Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Silence compiler warningVolker Hilsheimer2021-10-061-1/+1
| | | | | | | | | | clang warns that: local variable 'big' will be copied despite being returned by name [-Wreturn-std-move] So force the intended move using std::move. Change-Id: If5ff557c1b577789e6659783d8106295fafb3485 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Add a safer way to use QThreadPool::reserveThreadAllan Sandfeld Jensen2021-10-061-2/+52
| | | | | | | | | Add startOnReservedThread that specifically releases a reserved thread and uses it atomically for a given task. This can make a positive number of reserved threads work. Change-Id: I4bd1dced24bb46fcb365f12cbc9c7905dc66cdf1 Reviewed-by: David Faure <david.faure@kdab.com>
* Always enable QRegularExpression's JIT when testingGiuseppe D'Angelo2021-10-061-0/+14
| | | | | | | | | | | | | | | | | | | | Given on most CI configurations we run tests only on debug builds, this means that effectively we don't test JIT paths (JIT is kept disabled in debug builds). To keep it enabled in a test, we have a few options: * export a developer-build-only variable from QtCore, to force JIT usage, and set it in the test. This is still suboptimal as many configurations aren't using developer builds in the first place; * use the already existing QT_REGEXP_USE_JIT environment variable, setting it from CMake/CTest. The problem here is that although add_test does support it, we don't expose it through our wrapper functions; * just set that env variable from within the test itself. I went for this option. Change-Id: I73abfb7fc0d76ec77e881f24c5daf5be304ab948 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Compile private Qt APIs autotests for INTEGRITYTatiana Borisova2021-10-052-2/+3
| | | | | | | | | | - getgrgid/getpwuid are not supported - the default constructor of "ObserverOrUninit" must be referenced for GHS compiler Task-number: QTBUG-96176 Pick-to: 6.2 Change-Id: I24093da76e116aba4b87a8f5c5763b03d082a2cd Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Q{Elf,Mach}Parser: harmonize the arguments passedThiago Macieira2021-10-041-3/+4
| | | | | | | | | | | | | | Both functions took a QString for the input file name, but while the ELF parser had an optional QLibrary pointer (which was never null) where to store the error string, the Mach-O parser received a pointer to a QString. So make both of them take a single in/out QString pointer, which has the file name on input and is cheap for us because of COW. Drive-by fix the name of the static function in qmachparser.cpp from "ns" (which stood for "not suitable") to "notfound". Change-Id: I3eb1bd30e0124f89a052fffd16a8182f4f8541c3 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QPlugin: update the arch requirements to match the x86-64 ISA levelsThiago Macieira2021-10-041-9/+10
| | | | | | | | | | When we created the functionality, the levels were not yet standardized. Now they are and you can use -march=x86-64-v3 (for example) to get to them. We're making a split between "v1" and "baseline" here for the benefit of 32-bit, which is not included in the ISA levels. Change-Id: I2de1b4dfacd443148279fffd16a397a700b9a15a Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QPlugin: move some of the logic from moc's output to qplugin.hThiago Macieira2021-10-041-7/+4
| | | | | | | | | | | | | | This will allow us to make changes in QtCore itself, without having to worry about moc compatibility. The output uses an #ifdef so this version of moc can still be used to compile earlier versions of Qt (usually, in cross-compilation environments). See discussion in the mailing list[1]. [1] https://lists.qt-project.org/pipermail/development/2021-September/041732.html Change-Id: I2de1b4dfacd443148279fffd16a39784c80c5f3b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove checks for features available in C++17Ievgenii Meshcheriakov2021-10-028-46/+0
| | | | | | | | | | This patch removes most of the checks that are made using C++20 __cpp_* macros for features available in C++17 and earlier. Library feature check macros (__cpp_lib_*) are unaffected. Change-Id: I557b2bd0d4ff09b13837555e9880eb28e0355f64 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Untangle qsortfilterproxymodel unittestsDavid Faure2021-10-016-18/+20
| | | | | | | | | | | | | | With the QRegExp variant removed, it was weird to have all QSFPM tests in "tst_qsortfilterproxymodel_regularexpression", even those completely unrelated to regexps. Instead of reuniting into a single executable as before, I simply split it out in separate executables: * tst_qsortfilterproxymodel has the "standard" QSFPM tests * tst_qsortfilterproxymodel_regularexpression has the regexp-related tests * tst_qsortfilterproxymodel_recursive is separate as before Change-Id: I345530b4352671164008bba4805af7b12ac90247 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Cleanup of qthreadpoolAllan Sandfeld Jensen2021-10-011-7/+56
| | | | | | | | | | | | | Don't bother overwaiting in waitForDone(), if it was done at one point after it was called we can return true. And do not stop threads recently awakened by a startThread call as they have tasks to do. Make allowing at least one thread regardless of reservation more standard instead of hacked in certain places. Pick-to: 6.2 Change-Id: I304bcdc5822f440d5e72fc33ba2aa1678c9ba0d0 Reviewed-by: David Faure <david.faure@kdab.com>
* Assume that <variant> header is always presentIevgenii Meshcheriakov2021-10-011-4/+0
| | | | | | | | | This header is a C++17 feature that is already used unconditionally in qtypeinfo.h. Change-Id: I26330d298e95102f3e94c0c69fc95c1025666eb4 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* tst_qthread: Don't use QVERIFY in multiple threads in threadIdReuse()Ievgenii Meshcheriakov2021-10-011-2/+5
| | | | | | | | | | Testlib is not thread safe. Store the status into variable and check it in the main thread instead. Pick-to: 6.2 Change-Id: I840c8a3dceb1115a1b81ffeaa0fab96f9d2f1ff0 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove checks for C++ standard versions C++17 and belowIevgenii Meshcheriakov2021-10-012-3/+3
| | | | | | | | | | | Qt requires a compiler that support C++17 thus __cplusplus is always 201703L or higher. This patch removes checks for __cplusplus value that always succeed. Change-Id: I4b830683ecefab8f913d8b09604086d53209d2e3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Fix QDir::entryList to work for directories that end with '.lnk'Karsten Heimrich2021-09-304-3/+6
| | | | | | | | | | | | | In addition to checking the .lnk extension, check that the the specified path is not a path to a directory. Pick-to: 6.2 Fixes: QTBUG-85058 Change-Id: I83cef3d94c6ffa82a88f374c5b41779e88fe40b8 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QThread: Reset the system thread ID when thread exits on UnixIevgenii Meshcheriakov2021-09-291-0/+53
| | | | | | | | | | | | | | | | | | | | | Unix QThread implementation stores pthread_t as a system thread ID when the thread is created, but never resets the system ID when those threads are destroyed. Some implementations may reuse the same thread IDs for new threads, and this may cause QThread::wait() to erroneously complain that "Thread tried to wait on itself". This patch sets the system thread ID to nullptr when the thread is about to exit and be destroyed by the system. A regression test is added to tst_qthread. Fixes: QTBUG-96846 Pick-to: 5.15 6.2 Change-Id: I0850425dd0e09af50e59c9038e7e662a2a624beb Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Q{Elf,Mach}Parser: simplify the return codesThiago Macieira2021-09-241-33/+33
| | | | | | | | | | | | | | | | | The multi-state return code was a legacy of how Arvid wrote the ELF parser code back in the day, the fact that it scanned for two different types of plugins in Qt 4 and that the metadata could exist in different places. None of that matters nowadays: who cares if the file is a corrupt binary, not a valid binary, does not have the right architecture, or has no suitable section? It's not a plugin, period. The Qt 4 plugin mechanism was removed for Qt 5.0 in commit 7443895857fdaee132c8efc643e471f02b3d0fa4 ("Remove support for Qt 4 style plugins"). Change-Id: I42eb903a916645db9900fffd16a442d800399b98 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* tst_qplugin{,loader}: make it pass on MacsThiago Macieira2021-09-241-6/+6
| | | | | | | | | | | | | | | Debug builds were broken. WARNING: tst_QPluginLoader::errorString() testdata bin/libtst_qpluginloaderlib.dylib could not be located! $ ls -l bin total 112 -rwxr-xr-x 1 tjmaciei staff 77296 Sep 14 08:46 libtheplugin_debug.dylib -rwxr-xr-x 1 tjmaciei staff 33408 Sep 14 08:46 libtst_qpluginloaderlib_debug.dylib Pick-to: 6.2 Change-Id: I42eb903a916645db9900fffd16a4bb0a51ef967c Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Revert "QProcess: do not emit aboutToClose() twice"Alex Trotsenko2021-09-241-2/+0
| | | | | | | | | | This reverts commit efb90f6e7ed3e8d4f7b6c0fb96012cb3a9a9d037. Reason for revert: behavior change for signal listeners Change-Id: Ibe3c5d496cd61a9fccab17a10cc9fda8334fc9d4 Reviewed-by: Björn Schäpers <qt-codereview@hazardy.de> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add isValidUtf8() methods to QUtf8StringView and QByteArray{,View}Ievgenii Meshcheriakov2021-09-221-0/+83
| | | | | | | | | | | | | | | The new methods return true if the string contains valid UTF-8 encoded data, or false otherwise. [ChangeLog][QtCore][QByteArray] Added isValidUtf8() method. [ChangeLog][QtCore][QByteArrayView] Added isValidUtf8() method. [ChangeLog][QtCore][QUtf8StringView] Added isValidUtf8() method. Task-number: QTBUG-92021 Change-Id: I5d0cb613265d98b1f189c5f5cc09c1f7db302272 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* tst_qmetatype: Fix operator< detection for std::optionalFabian Kosmale2021-09-211-0/+2
| | | | | | | | | | Amends ca54b741d6edda24773137aacee229db31dd3585. operator< is not constrained in MSVC's standard library, either. Pick-to: 6.2 Fixes: QTBUG-96690 Change-Id: Ibcbb9e53a1f9e8b13786f6d8c01489c61d8d2d7f Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Compile autotests for IntegrityTatiana Borisova2021-09-2021-23/+86
| | | | | | | | | - process environment/DNS are OFF for INTEGRITY Task-number: QTBUG-96176 Pick-to: 6.2 Change-Id: I189a97f88c96a428586c31a66b8d250e04482900 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fix QDateTimeParser's handling of 't' format to match serializationEdward Welbourne2021-09-201-1/+6
| | | | | | | | | | | | | | | | | | This amends commit 68f19fb630dc02463c2d61fc511de7407687795e to only consume one 't' from the format string, to match qlocale.cpp's serialization of time-zone specifiers, which only consumes one, so will repeat the time-zone specifier as many times as unquoted t appears in the format. It's hard to imagine why anyone would want this behavior, but it's what our serialization has always done and parsing should match serialization. Add test-cases for double time-zone specifier. Delete a lie in the process. Task-number: QTBUG-95966 Change-Id: I574896040a74085dee89a4fefd8384be44ad827b Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QProcess: do not emit aboutToClose() twiceAlex Trotsenko2021-09-191-0/+2
| | | | | | | | | This signal is emitted by the QIODevice itself, so we don't have to emit it from QProcess::close(). Pick-to: 6.1 6.2 Change-Id: I9165b3eebadc17a66cc834d5ef54441d13f23d7d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove conditioning on Android embeddedEdward Welbourne2021-09-1726-67/+74
| | | | | | | | It is no longer handled separately from Android. This effectively reverts commit 6d50f746fe05a7008b63818e77784dd0c99270a1 Change-Id: Ic2d75b8c5a09895810913311ab2fe3355d4d2983 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Add missing dependencies of tests on their helper programsEdward Welbourne2021-09-1713-65/+67
| | | | | | | | | | | | | | | | | This ensures that a command such as $ ninja tst_qlocale && ninja tst_qlocale_check will automagically build the syslocaleapp program that the test runs from a subtest. Similar for testlib's selftests and tst_QProcess. As a drive-by, pruned some legacy comments from when CMakeLists.txt files were generated from .pro files. Change-Id: I67691a8175aaef124d4104cf1898193993408bdf Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* QThreadPool: Fix restarting of expired threadsIevgenii Meshcheriakov2021-09-151-0/+25
| | | | | | | | | | | | | | | | Ensure that expired threads have actually finished before attempting to restart them. Calling start() on a thread that is not yet finished does nothing. Add a regression test into tst_qthreadpool that attempts to trigger reuse of expired threads and verifies that all submitted tasks execute. Fixes: QTBUG-72872 Pick-to: 6.2 Change-Id: I2109b628b8a4e91491115dc56aebf3eb249646b5 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>