diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2024-03-23 20:41:57 +0100 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2024-04-04 09:43:49 +0100 |
commit | 082634268a4bd23ff08b9a58d4537eaf800b7b84 (patch) | |
tree | a135b81a516b0b5f71f1fa87a45548cc1e196cca /tests/auto/qml/ecmascripttests/test262runner.cpp | |
parent | cd5d2ec701be8de32e83ee778d161de17f1400b4 (diff) |
Tests: check that QFile::open succeeds
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>
Diffstat (limited to 'tests/auto/qml/ecmascripttests/test262runner.cpp')
-rw-r--r-- | tests/auto/qml/ecmascripttests/test262runner.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/auto/qml/ecmascripttests/test262runner.cpp b/tests/auto/qml/ecmascripttests/test262runner.cpp index ab2dc20e51..90ac10a38b 100644 --- a/tests/auto/qml/ecmascripttests/test262runner.cpp +++ b/tests/auto/qml/ecmascripttests/test262runner.cpp @@ -688,7 +688,10 @@ void Test262Runner::updateTestExpectations() } QTemporaryFile updatedExpectations; - updatedExpectations.open(); + if (!updatedExpectations.open()) { + qFatal("Could not open temporary TestExpectations file: %s", + qPrintable(updatedExpectations.errorString())); + } while (!file.atEnd()) { QByteArray originalLine = file.readLine(); @@ -726,7 +729,10 @@ void Test262Runner::writeTestExpectations() QFile file(expectationsFile); QTemporaryFile expectations; - expectations.open(); + if (!expectations.open()) { + qFatal("Could not open temporary TestExpectations file: %s", + qPrintable(expectations.errorString())); + } for (const auto &c : std::as_const(testCases)) { TestExpectationLine line = TestExpectationLine::fromTestCase(c); @@ -747,7 +753,10 @@ void Test262Runner::runAsExternalTests() for (TestData &testData : tasks) { auto runTest = [&] (const char *header, TestCase::Result *result) { QTemporaryFile tempFile; - tempFile.open(); + if (!tempFile.open()) { + qFatal("Could not open temporary test data file: %s", + qPrintable(tempFile.errorString())); + } tempFile.write(header); tempFile.write(testData.content); tempFile.close(); |