aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/ecmascripttests
Commit message (Collapse)AuthorAgeFilesLines
* Clean up ECMAScript test runnerUlf Hermann2025-06-183-115/+82
| | | | | | | | | | | | | | Remove some unused code and allow it to run without QProcess. We can use threads after all. Also, activate the "filter" mode via an environment variable. Running only a subset of the tests is very handy at times. Most of the dead code was supposed to be used with the qjstest executable from d9c4a527241e0ef3a30e990c518197b0ba345b50, but d08ede57dd530a67c3420b3858fe39bf1e5eb598 removed qjstest in favor of using tst_ecmascripttests itself for all ways of running the tests. Change-Id: I0d220964a98c3f49e97fc6650cf3169db5644af5 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* QtQml: Avoid direct file access in ECMAScript test runnerUlf Hermann2025-06-173-64/+162
| | | | | | | | | | | | | | | | | | We want the type loader to do this job rather than poorly duplicate it in the test. In particular, the local implementation didn't properly register the dependencies of loaded ECMAScript modules. So far we could only load ECMAScript modules using the type loader if their file names ended it ".mjs". The ECMAScript test suite does not follow this convention. In order to deal with that, we need to add a second characteristic. ECMAScript modules can now also be marked using a URL fragment "#module". Furthermore, since JavaScript files loaded outside any QML document get full access to the global context, we introduce another URL fragment "#global" to discern them from the same files loaded from a QML document. Change-Id: I625088335d16d5b8eeaa2673f07718367dca1605 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* ECMAScript tests: Add option to use threads instead of processesUlf Hermann2025-06-141-2/+8
| | | | | | | | | This is a handy way to torture test the type registry. Also, you can attach a debugger to the tests without gymnastics this way. Change-Id: I6b6e273d2b640ad28c22714b3aea9a9833b92917 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
* Tests: include QTest, not QtTestGiuseppe D'Angelo2025-04-151-1/+1
| | | | | | | | | | | | | Never use module-wide inclusions. They blow up build times. For QtTest this is usually just a typo (QTest was meant instead). Add missing includes as needed. In the diffs I've spotted other huge inclusions (QtQuick, QtQml), but those need more attention. Task-number: QTQAINFRA-7110 Pick-to: 6.9 6.8 Change-Id: I74bf3fe212f50a7a3a6af2b1c80bbcaabc2516d7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QtQml: Deal with platform-dependent results in ECMAScript test suiteUlf Hermann2024-12-083-45/+103
| | | | | | | | | | | | | | | | | | For cases where the test expectations would need to cover multiple conditions we finally throw the towel now and simply expect that the test doesn't crash. Encoding the platforms with various degrees of half-sane locale-dependent upper- and lower-casing into a domain specific language is not something we're going to do here. The nonICUFails expectation is accordingly rephrased as "passesWithICU", which means we only expect it to survive otherwise, but don't expect any particular result. String/prototype/toLocaleUpperCase/special_casing.js now also fails on Windows, so change its expectation to passesWithICU. Change-Id: If53565de7e0df4a3d0ffea324a402b9f2f6b358f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QtQml: Model native modules as compilation unitsUlf Hermann2024-12-061-4/+3
| | | | | | | | | | | | | | | | | | | | | | | QQmlTypeLoader::injectedScript() was unsafe and impossible to fix because it had to query the engine from the type loader thread in order to find out whether to load a script from an actual file. By removing the whole special-casing of native modules, we can make the script loading thread safe. A native module is now also a compilation unit, with a regular QV4::Module as value. This means we can remove a lot of code that deals with the native modules in the engine. The downside is that native modules are now a lot larger than before. However, given that they don't appear in any examples and hardly any bugs have been filed about native modules since their introduction, we can assume that they are not a very popular feature. The reduction in complexity and the removal of the native modules map in the engine is expected to outweigh the extra memory overhead for native modules. Task-number: QTBUG-131721 Pick-to: 6.8 Change-Id: Ia7388d7ba8d71637559a791d874257fba4646330 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* V4: make JS functions toLocale{Lower,Upper}Case aware of the localeJohnny Jazeix2024-11-222-4/+11
| | | | | | | | | We now call the toUpper/toLower function for the correct locale. It fixes the case of the Turkish uppercase i is İ not I. Fixes: QTBUG-112898 Change-Id: Ibd0174656e0aa561747490f3e6d52c639bd06b63 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Add Qt::Qml before Qt::QmlPrivate to auto testsKarim Pinter2024-10-221-0/+1
| | | | | | | | | | The build for auto tests for VxWorks fails because Qt::Qml is not added before Qt::QmlPrivate resulting in many unresolved symbols from Qt::Qml library. When Qt::Qml is added before it solves this problem. Task-number: QTBUG-129113 Change-Id: I89d553ac1d6706e2e934665fed2f308e6b01ed78 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QJSEngine: Do not skip values in Map/Set.prototype.forEachLuca Di Sera2024-08-301-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The backing storage implementation for Maps/Sets, `ESTable`, currently uses a pair of arrays for its storage of keys and values, respectively. Additional elements that should be added are appended to the arrays. When an element is removed, all elements past it are shifted to the left, to avoid having empty spaces. The arrays naturally preserve insertion order, which is required to be the iteration order for `forEach` based on the spec. `Map/Set.prototype.forEach` implementations make use of this fact by iterating per-index so that the iteration follows the required order. As per the spec, during the execution of a `Map/Set.prototype.forEach` call, a call to `callbackFn` might modify the iterated upon collection itself. Depending on the specific changes that are performed, this might break the iteration cycle in the index-based iteration that the `forEach` implementation performs. For example, given: ``` let set = new Set([1,2,3]); set.forEach((v) => { console.log(v) set.delete(v) }) ``` The index based implementation would perform the following iterations: - Set = [1, 2, 3]; index = 0; - visit 1 - 1 is deleted from the Set - ... - Set = [2, 3]; index = 1; - visit 3 ... Skipping the required visit of 2 due to the index not being re-adjusted between iterations. To avoid the issue, the way that `forEach` implementations iterate over an `ESTable` was slightly modified. `ESTable` now exposes a simple structure that can be used to observe changes in position in relation to a an indexed entry. An instance of the structure can be registered with the table to observe the internal changes that the table performs, allowing the re-adjustment of an index during an index-based iteration. A small test was added to ensure that the case reported in attached bug report is solved. `tst_ecmascripttests` was modified to enable some `forEach` related tests that were previously failing and will now work due to the iteration changes. Fixes: QTBUG-123377 Pick-to: 6.8 Change-Id: I8fc72b747eb295f009c2e2c2933f05b26f1ce717 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* ECMAScript test suite: Increase ctest timeoutUlf Hermann2024-08-071-0/+4
| | | | | | | | | | | | In the Android case, the test may actually take up to an hour to complete. In other cases it's faster, but QTest will already stop it when it overruns its 900+900 allotted seconds. There is no need to do the same from from ctest. Pick-to: 6.8 Change-Id: Ib86149b3dfea8292b3b4056c9c182fd07fee4294 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* QtQml: Straighten out some logging categoriesUlf Hermann2024-06-171-3/+1
| | | | | | | | | | | Either make them static or declare them in a header. We want them to be static wherever possible, in order to reduce the number of visible symbols. If they can't be static, however, they should at least be declared in only one place. Task-number: QTBUG-67692 Change-Id: I91fa641b46510ea8902b478d31dfd60d34b5f580 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Rework the sort implementation for SequencesLuca Di Sera2024-06-061-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When QML reads a property with a C++ provenance it sometimes apply certain transformations to work with the property in a JS environment. For example, certain containers, such as `QJsonArray` or `QVariantList`, are converted to a `Sequence`, an array-like object that knows how to modify the container and takes care of reflecting mutations back to the property. `Sequence` provides a specialized implementation for the built-in sort method. Generally, the default sort implementation for an array in JS converts the elements to a string and compares the stringified representation. In the case of `Sequence`, the sort implementation will treats the elements as `QVariant`s and use `QVariant::toString` to perform this part of the sorting algorithm. Due to the way `QVariant::toString` works, this can fail for certain elements. For example, `QVariant::toString` is unaware of how to produce a string from a `QJsonValue`, the type of the elements that compose a `QJsonArray`, thus failing to correctly sort a container with such elements. Other than the `Sequence` implementation, the JS runtime provides, as per specification, a sort method for the Array prototype. Contrary to other methods that are implemented for the prototype, the `sort` method is implemented so that it can only work on values that have a populated `ArrayData`, an optimized storage for certain array and array-like objects. As `Sequences` do not use an `ArrayData` storage for their elements, the method is unable to work on a `Sequence`. To broaden the ability of the sort method implementation for `Sequence` to work more generically, the default sort implementation for the Array prototype sort method was modified to work more generically on objects that do not present an `ArrayData` storage, with an implementation based on the latest draft of the JS specification. The specialized `Sequence` implementation was removed, in favor of `Sequence` delegating to the Array prototype implementation which would now support working with `Sequence`s. While this should be generally slower than the specialized implementation, foregoing some performance, it should allow a more generic foundation for the sort method for `Sequences` or other elements that act like an array but do not use the specialized `ArrayData` representation. Some specialization could later be reapplied to `Sequence` to improve the performances of the implementation. Previously, the Array prototype implementation would directly delegate to `ArrayData::sort`, the sort implementation for the specialized `ArrayData` storage. This was modified to dispatch to an implementation based on generic methods when no `ArrayData` is populated on the object of the sort. The code related to the specialized `Sequence` implementation for sort was removed and the sequence prototype was modified to not present a specialized `sort` property, so as to fallback on the Array prototype one. The `ArrayData::sort` implementation was slightly modified. `ArrayData::sort` would perform a check on the presence of a defined callback for the sorting and throw a type error if the non-undefined element is not callable, as per specification. This check was moved to the Array prototype implementation, to be shared between the specialized `ArrayData::sort` implementation and the generic implementation. As per the spec, the check should be performed as soon as the method is entered and before the receiver of the method is converted to an object. With the check moved to the start of the Array prototype sort implementation this ordering of operations is now fulfilled. The compliance test that checks for this behavior, `comparefn-nonfunction-call-throws`, that was previously failing, will now pass and was thus removed from the list of expected failures for the `ecmascript` tests. A `QEXPECT_FAIL` related to testing the default sort of a `QJsonArray` property was removed from `tst_qqmllanguage`, as the sort is now expected to work correctly. Fixes: QTBUG-125400 Change-Id: I158a9a160b8bdde2b8a06bb349a76469fc25c5a1 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* V4: Store the sign bit of NaNs in QV4::StaticValueUlf Hermann2024-05-281-1/+0
| | | | | | | | | | | We have a bit for this, which is already used on UMinus. We should also use it when directly encoding a double. This makes some ECMAScript tests pass. Pick-to: 6.7 6.5 Change-Id: Ie90c7ae9ce57064d14db0ed719a08d5858b47cd4 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* TypedArray: Preserve exact NaN bit pattern on fill()Ulf Hermann2024-05-251-1/+0
| | | | | | | | ... as required by ECMAScript. Pick-to: 6.7 6.5 Change-Id: I31bc7e6a87e404a8e6d314c99f163f82208e13a1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* ecmascripttests: Actually fail the test if the runner crashesUlf Hermann2024-05-111-2/+2
| | | | | | | | | | The runner can have a "normal" exit status but a non-zero exit code. That's still a crash. Amends commit 4e0cf9658a28b7d048a016b9d0ab5926964e9a60 Change-Id: Ia803a947b51c9ea5486d0ca5b6cdd9c01040c84f Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
* ecmascripttests: Fail test if the test runner crashesUlf Hermann2024-05-061-3/+13
| | | | | | Change-Id: I61c8a24cf25fef98df4ce274fb5f829867059922 Reviewed-by: Semih Yavuz <semih.yavuz@qt.io> Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
* test262: Remove outdated test runnerUlf Hermann2024-04-231-611/+0
| | | | | | | | | We use the C++ test runner these days. Change-Id: I74c892c43a699b62da396c7b0bd0ec861f3781bd Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io> Reviewed-by: Lucie Gerard <lucie.gerard@qt.io>
* Tests: check that QFile::open succeedsGiuseppe D'Angelo2024-04-041-3/+12
| | | | | | | | | | Wrap it in QVERIFY if possible. If not possible (e.g. a function that returns non-void, or not an autotest function) use qFatal to abort the test. Change-Id: Ie255024d29507e928a94e67d9af1cd436df4f1df Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Correct license for test filesLucie Gérard2024-02-274-4/+4
| | | | | | | | | | | | | | According to QUIP-18 [1], all test files should be LicenseRef-Qt-Commercial OR GPL-3.0-only [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: I26d72e8de04d4c7c57b3b7838af5d033265de5ba Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Kai Köhne <kai.koehne@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* V4: Fix setting of regexp flagsUlf Hermann2024-02-151-1/+6
| | | | | | | | | | | | | | | | We of course have to amend the previously set flags, not the origin. This only worked sort of because most of the flags are the same in input and output. This causes one test in the ECMAScript suite to pass and three to fail. Those three were passing for the wrong reason, relying on the confusion between the unicode and sticky flags. The failures are actually due to a defect in Yarr that will have to be addressed separately. Fixes: QTBUG-121509 Change-Id: Id930bba49e12dede2eb699e446eb528072f092b4 Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QtQml: Use CompiledData::CompilationUnit in more placesUlf Hermann2024-01-201-1/+0
| | | | | | | | | | We rarely actually need the executable CU, and where we need it, we can dynamically create or retrieve it from the engine. To that end, store all the CUs in the same container in the engine. Change-Id: I0b786048c578ac4f41ae4aee601da850fa400f2e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QtQml: Get rid of the module mutexUlf Hermann2024-01-101-1/+2
| | | | | | | | | | | | | It only exists so that the type loader can query pre-compiled and native modules from the loader thread. However, the type loader already has a mutex of its own. We can use that to inject a "native" blob into its script cache for the same effect. We need to get rid of the mutex so that we can use the module map for other compilation units, too. Change-Id: I5a9c266ea36b50f5ea69214110def644f7501674 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QtQml: Always link executable CU on creationUlf Hermann2024-01-101-1/+1
| | | | | | | | | | | | | | | We don't want floating unlinked executable CUs. They should always be tied to an engine, and the engine should not change. This gives us one definite point where to register them with the engine (to be done in subsequent change). Unfortunately, due to the refcounting, we need to remove the engine from any still-referenced CUs when the engine itself is destructed. We will be able to drop the refcounting and make the engine fully own its executable CUs once we can hold base CUs in most places. Change-Id: I9a53e83d5c4746c2b2bca896b51baa4fe7fee757 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* tst_ecmascript: Run tests on separate processes instead of threadsOlivier De Cannière2023-12-206-319/+450
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, tests were run in parallel on separate threads. This was faster than running them on only one but was still significantly slower than it could be, on Windows. This is due to them sharing the same heap and the fact that each memory allocation and free would temporarilly lock the heap for all other threads making the tests run much slower than on other platforms. This patch changes the way the test is run so that each js test file is run on a separate process. This ensures that the heap is no longer being shared by all test runners and reduces overhead significantly. The test runner processes listen for test data in JSON format over their standard input, run the test, return the results over their standard output and then wait for the next test data. tst_ecmascripttests on 13900k with 32 threads Debug MSVC Windows Debug GCC Linux threads: 569s 105s processes: 89s (~ -84%) 52s (~ -50%) On platforms where QT_CONFIG(process) returns false, the tests fallback to running on threads as before. Change-Id: Id51fc9d6e0d5ef0ae5c88f96b0119aa99e57f0fe Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* tst_ecmascripttests: Add a heartbeat messageFabian Kosmale2023-11-231-1/+6
| | | | | | | | | The test sometimes gets killed, because it runs for a very long time without any output. Avoid that by peridoically printing a heartbeat message. Change-Id: Ib39f75ce1ab9e38b6390ead64b729eb82095ba5d Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* tst_ecmascripttests: Adapt to renaming of logging categoryUlf Hermann2023-10-201-2/+2
| | | | | | | | Amends commit 1bd18723f72b451d3c5abf4560b4dd31394e5243. Change-Id: I2752af68dd463cb8a81cc3ff90a2653e876f6cfb Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Make qml tests standalone projectsAlexandru Croitor2023-07-051-0/+6
| | | | | | | | | | | | | | | | | Add the boilerplate standalone test prelude to each test, so that they can be opened with an IDE without the qt-cmake-standalone-test script, but directly with qt-cmake or cmake. Boilerplate was added using the follow script: https://git.qt.io/alcroito/cmake_refactor Manual adjustments were made where the code was inserted in the wrong location. Task-number: QTBUG-93020 Change-Id: Ia68c9d263e7454f0c4a26c29b10f1c535d08e2f6 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
* Exclude the .git directory from the test_dataAmir Masoud Abdol2023-06-231-0/+1
| | | | | | | | | | | | We shouldn't install the contents of the .git directory. P.S. On macOS, this can break the installation if `git fsmonitor` is enabled at the top-level repository, as CMake fails to install `test262/.git/fsmonitor--daemon.ipc`. Pick-to: 6.5 6.6 Change-Id: I1b57965c486f1ba96195285cfc4ad065f1b7239b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Test262Runner: fix -Wunused-but-set-variableMarc Mutz2023-01-201-4/+0
| | | | | | | | | | | | | | | | | | | | | The 'int line' variable is shadowed a few lines below by the 'QByteArray line' one, even in the initial commit, so it can never have been used, except for the increment in the first line of the loop's bodies. Remove the variable, fix the warning. Found by Clang 15: test262runner.cpp:380:9: warning: variable 'line' set but not used [-Wunused-but-set-variable] int line = 0; ^ Amends d9c4a527241e0ef3a30e990c518197b0ba345b50. Pick-to: 6.5 6.4 6.2 5.15 Change-Id: I2139aa4552d1ff2ddbb5737e2a1b26650d6519e7 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Retire the qt_parse_all_argumentsAmir Masoud Abdol2023-01-201-2/+2
| | | | | | Task-number: QTBUG-99238 Change-Id: Ia11c9cbd7c06347319ab3674ec0cd8da0214747e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-071-5/+5
| | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace. Task-number: QTBUG-99313 Change-Id: I601bf70f020f511019ed28731ba53b14b765dbf0 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Port from container::count() and length() to size()Marc Mutz2022-10-071-3/+3
| | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8: auto QtContainerClass = anyOf( expr(hasType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))))).bind(o), expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o)); makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container', with the extended set of container classes recognized. Change-Id: Idb1f75dfe2323bd1d9e8b4d58d54f1b4b80c7ed7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QML: Test ECMAScript compliance on all platformsUlf Hermann2022-09-301-6/+7
| | | | | | Fixes: QTBUG-100242 Change-Id: Iddd9be89b11327afb1e1e520992d52fe8de524b0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Tests: Define function timeout in C++ rather than CMakeUlf Hermann2022-09-132-2/+4
| | | | | | | | | Setting the timeout in C++ is more robust because it applies to all ways of starting the test binary, not only ctest. Task-number: QTBUG-100242 Change-Id: Ifd51b2b1067b2c8d6bb90615129fc26f36a76e90 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Use QQmlDataTest in tst_ecmascripttests.cppUlf Hermann2022-09-075-27/+60
| | | | | | | | This should make it possible to run the tests on android. Task-number: QTBUG-100242 Change-Id: I7bec37d2cfda21e43979b4f33faf827f7a6c9017 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Change the license of all CMakeLists.txt and *.cmake files to BSDLucie Gérard2022-09-072-2/+2
| | | | | | | Task-number: QTBUG-105718 Change-Id: Id89ed14990804a5024183e75382cc539d4293da1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QML: Make modules imported with registerModule() available in QMLUlf Hermann2022-09-021-6/+6
| | | | | | | | | So far, you could only use them from pure JavaScript programs. Also, fix re-exporting parts of native modules. Fixes: QTBUG-105901 Change-Id: I170017083284e6457b1aa0c6e606fd26227edae3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Print assert messages in tst_ecmascripttestsSami Shalayel2022-09-012-54/+90
| | | | | | | | | | Up to now, just the test result (pass or fail) was saved during testing. Add an errorMessage in the test result that is retrieved from the engine and print it out when a test is failling. Fixes: QTBUG-106096 Change-Id: I73f9f7daaa92a942d89391043682d8d9ebbcdfa3 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* V4: Fix index calculations in String prototypeUlf Hermann2022-08-311-1/+0
| | | | | | | | | We generally have to do those calculations in double as we must not collapse inf into 0. Task-number: QTBUG-100242 Change-Id: Iaf8082160a1ab25060c131ee1a5fa259bbd31214 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix error when calling byteLength on detached ArrayBufferBenjamin Terrier2022-08-251-0/+0
| | | | | | | | | | | | | | | | | ArrayBuffer constructed from en empty QByteArray are detached, calling byteLength should not throw an error. According to ECMA specifications the `byteLength` property of a detached ArrayBuffer should retrurn 0. See https://tc39.es/ecma262/multipage/structured-data.html#sec-get-arraybuffer.prototype.bytelength [ChangeLog][QtQml][Important Behavior Changes] ArrayBuffer.byteLength() now returns 0 on detached ArrayBuffers, conforming to ECMAScript 2021. Fixes: QTBUG-103925 Change-Id: Ib1c325eff25459980e10a1f3cd9fb7cb3b8eb5e5 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Revert accidental change to test262Ulf Hermann2022-08-041-0/+0
| | | | | | | | Amends commit 0dc4fd240a2897c5c443a0ef6d84c416843e4938. Pick-to: 6.4 Change-Id: I8b74645becdfa91402f49156f77799dc5dd8ec5c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Don't use PUBLIC_LIBRARIES for tests and test helpersAlexandru Croitor2022-07-282-2/+2
| | | | | Change-Id: I1cd769f85d5f82c43639d6787d98e536619249e6 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Add license headers to cmake filesLucie Gérard2022-07-082-0/+6
| | | | | | | | | | | | CMakeLists.txt and .cmake files of significant size (more than 2 lines according to our check in tst_license.pl) now have the copyright and license header. Existing copyright statements remain intact Task-number: QTBUG-88621 Change-Id: I72c89a98c42bbc9234d8495e9e503bec81d11037 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-116-135/+11
| | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Split two long lines for the sake of readabilityEdward Welbourne2022-06-101-2/+8
| | | | | | | | It's easier to see which flags are being set this way. Pick-to: 6.4 Change-Id: I5ed7e9bcedacde19cb751512d404a872981f6eb0 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Suppress ES-compiler warnings against the ES-262 test-suiteEdward Welbourne2022-06-101-2/+44
| | | | | | | | | | | | | | | | | | V4's ES-compiler warns about assorted variables in the ES-262 test-suite being used before declaration. We aren't about to fix that test-suite, so the warnings are just noise to us. As there are many of them, they overflow the QTestLib logger's -maxwarnings threshold, causing actually relevant messages (like test failures) to be lost in the output. Install a trivial QLoggingCategory::CategoryFilter to filter out warnings and debug for the qt.qml.compiler category (and all sub-categories of it). Condition this on a define so that someone who actually wants to see those warnings can turn them on. Pick-to: 6.4 Change-Id: If7decc241b407e816f5d7979b32f31a9f614d30f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Make uninteresting JS-test output easier to ignoreEdward Welbourne2022-06-101-10/+18
| | | | | | | | | | | | | | | | | | | | | | | The JS-tests produce so much output that it routinely surpasses the maximum number of debug messages testlib is willing to produce, after which it cuts off and we don't get to see the output of failing tests, which we actually need to see. Add a logging category, just for this test, and condition the boring bits on this category being enabled. Those are all qCDebug()s, so disable the category for debug by default. In the process, re-enable a commented-out qDebug() by converting it to use the new logging category (and fixing the bit-rot that it had suffered while commented out). This should mean any future Coin failures in this test are reported more usefully. If seeing all the PASS lines is really important to you, enable category "qt.v4.ecma262.tests" in your Qt logging options and pass -maxwarnings with a huge value when you run the test. Pick-to: 6.4 Change-Id: I8ba1f6575120fcef533ae756d31cc40635c13370 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* CMake: Don't cross-compile qjtestAlexandru Croitor2022-01-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Previously it was only excluded on ANDROID, but cross-compiled for other platforms. The executable should only be built when the target Qt is meant to be used as a development SDK, to be executed on some host machine. Because at the moment we lack a proper abstraction for that, as a work around, we exclude building it when cross-compiling. The executable is not called automatically by any test, it is only run manually by a developer. In the future, the qt_internal_add_tool call should likely be replaced by a customized qt_internal_add_app call, installing the executable into $prefix/libexec rather than $prefix/bin. Amends 5a55e526382f0bb6eb647c2e6b7ce55661889990 Pick-to: 6.2 6.3 Task-number: QTBUG-92591 Task-number: QTBUG-100040 Task-number: QTBUG-100047 Change-Id: If20e73fe378acd51fe41d181078d273a7842fc81 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* V4: Fix naming of array data classesUlf Hermann2022-01-201-2/+2
| | | | | | | | | | | Provide convenience wrappers for access to const/mutable data, properly discern between the "buffer" object and the actual data, especially regarding shared/detached state. Change-Id: I48f1f1eb8c204c29277746e5dee63892cbf3ac89 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Android: Disable qjstest and qml ecmascripttests testsAssam Boudjelthia2021-10-131-0/+2
| | | | | | | | | | | | | qjstest and ecmascripttests fail to be configured on Android, and require CMake API changes to fix that. They could be disabled in the meantime to allow CI builds to proceed when building tests for other modules that depend on qtdeclarative. Task-number: QTBUG-92591 Task-number: QTBUG-88846 Pick-to: 6.2 Change-Id: I58e17166efc844efd089cce44d81dba027e9198c Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>