diff options
author | Milian Wolff <milian.wolff@kdab.com> | 2022-12-03 15:56:48 +0100 |
---|---|---|
committer | Milian Wolff <milian.wolff@kdab.com> | 2022-12-08 19:42:05 +0000 |
commit | 813e5fa8cad97eb1af227bf8bdcd60d7cd8bffa1 (patch) | |
tree | 92dea66959eaa3f4e345cce924ba3cd390d11721 /tests | |
parent | a4b06facbdeb370c4fcf721eca266fca19e4fe59 (diff) |
Fix compile with -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII
Change-Id: If53db019f7855128fa705b1f9bc344b4d78dcdc8
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/perfdata/tst_perfdata.cpp | 75 |
1 files changed, 42 insertions, 33 deletions
diff --git a/tests/auto/perfdata/tst_perfdata.cpp b/tests/auto/perfdata/tst_perfdata.cpp index caa20e3..68436e0 100644 --- a/tests/auto/perfdata/tst_perfdata.cpp +++ b/tests/auto/perfdata/tst_perfdata.cpp @@ -119,32 +119,38 @@ void TestPerfData::testTracingData() QVERIFY(output.open(QIODevice::WriteOnly)); // Don't try to load any system files. They are not the same as the ones we use to report. - PerfUnwind unwind(&output, ":/", QString(), QString(), QString(), stats); + PerfUnwind unwind(&output, QStringLiteral(":/"), QString(), QString(), QString(), stats); if (!stats) { QTest::ignoreMessage(QtWarningMsg, - QRegularExpression(QRegularExpression::escape("Could not find ELF file for " - "/home/ulf/dev/untitled1-Qt_5_9_1_gcc_64-Profile/untitled1. " - "This can break stack unwinding and lead to missing symbols."))); + QRegularExpression(QRegularExpression::escape( + QStringLiteral("Could not find ELF file for " + "/home/ulf/dev/untitled1-Qt_5_9_1_gcc_64-Profile/untitled1. " + "This can break stack unwinding and lead to missing symbols.")))); QTest::ignoreMessage(QtWarningMsg, - QRegularExpression(QRegularExpression::escape("Could not find ELF file for " - "/lib/x86_64-linux-gnu/ld-2.24.so. " - "This can break stack unwinding and lead to missing symbols."))); + QRegularExpression(QRegularExpression::escape( + QStringLiteral("Could not find ELF file for " + "/lib/x86_64-linux-gnu/ld-2.24.so. " + "This can break stack unwinding and lead to missing symbols.")))); QTest::ignoreMessage(QtWarningMsg, - QRegularExpression(QRegularExpression::escape("Could not find ELF file for " - "/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22. " - "This can break stack unwinding and lead to missing symbols."))); + QRegularExpression(QRegularExpression::escape( + QStringLiteral("Could not find ELF file for " + "/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22. " + "This can break stack unwinding and lead to missing symbols.")))); QTest::ignoreMessage(QtWarningMsg, - QRegularExpression(QRegularExpression::escape("Could not find ELF file for " - "/lib/x86_64-linux-gnu/libm-2.24.so. " - "This can break stack unwinding and lead to missing symbols."))); + QRegularExpression(QRegularExpression::escape( + QStringLiteral("Could not find ELF file for " + "/lib/x86_64-linux-gnu/libm-2.24.so. " + "This can break stack unwinding and lead to missing symbols.")))); QTest::ignoreMessage(QtWarningMsg, - QRegularExpression(QRegularExpression::escape("Could not find ELF file for " - "/lib/x86_64-linux-gnu/libgcc_s.so.1. " - "This can break stack unwinding and lead to missing symbols."))); + QRegularExpression(QRegularExpression::escape( + QStringLiteral("Could not find ELF file for " + "/lib/x86_64-linux-gnu/libgcc_s.so.1. " + "This can break stack unwinding and lead to missing symbols.")))); QTest::ignoreMessage(QtWarningMsg, - QRegularExpression(QRegularExpression::escape("Could not find ELF file for " - "/lib/x86_64-linux-gnu/libc-2.24.so. " - "This can break stack unwinding and lead to missing symbols."))); + QRegularExpression(QRegularExpression::escape( + QStringLiteral("Could not find ELF file for " + "/lib/x86_64-linux-gnu/libc-2.24.so. " + "This can break stack unwinding and lead to missing symbols.")))); } process(&unwind, &input, QByteArray("0.5")); @@ -190,7 +196,7 @@ void TestPerfData::testTracingData() void TestPerfData::testContentSize() { - QString file(":/contentsize.data"); + QString file(QStringLiteral(":/contentsize.data")); QBuffer output; QFile input(file); @@ -199,7 +205,7 @@ void TestPerfData::testContentSize() QVERIFY(output.open(QIODevice::WriteOnly)); // Don't try to load any system files. They are not the same as the ones we use to report. - PerfUnwind unwind(&output, ":/", QString(), QString(), QString(), true); + PerfUnwind unwind(&output, QStringLiteral(":/"), QString(), QString(), QString(), true); process(&unwind, &input, QByteArray("0.5")); QCOMPARE(unwind.stats().numSamples, 69u); @@ -210,7 +216,7 @@ Q_DECL_UNUSED static void compressFile(const QString& input, const QString& outp QVERIFY(!input.isEmpty() && QFile::exists(input)); if (output.isEmpty()) { - compressFile(input, input + ".zlib"); + compressFile(input, input + QLatin1String(".zlib")); return; } @@ -276,32 +282,35 @@ void TestPerfData::testFiles() QSKIP("zstd support disabled, skipping test"); #endif - const auto perfDataFileCompressed = QFINDTESTDATA(dataFile + ".zlib"); + const auto perfDataFileCompressed = QFINDTESTDATA(dataFile + QLatin1String(".zlib")); QVERIFY(!perfDataFileCompressed.isEmpty() && QFile::exists(perfDataFileCompressed)); uncompressFile(perfDataFileCompressed); const auto perfDataFile = QFINDTESTDATA(dataFile); QVERIFY(!perfDataFile.isEmpty() && QFile::exists(perfDataFile)); - const auto expectedOutputFileCompressed = QString(perfDataFile + ".expected.txt.zlib"); - const auto expectedOutputFileUncompressed = QString(perfDataFile + ".expected.txt"); - const auto actualOutputFile = QString(perfDataFile + ".actual.txt"); + const auto expectedOutputFileCompressed = QString(perfDataFile + QLatin1String(".expected.txt.zlib")); + const auto expectedOutputFileUncompressed = QString(perfDataFile + QLatin1String(".expected.txt")); + const auto actualOutputFile = QString(perfDataFile + QLatin1String(".actual.txt")); QBuffer output; QVERIFY(output.open(QIODevice::WriteOnly)); // Don't try to load any system files. They are not the same as the ones we use to report. - PerfUnwind unwind(&output, ":/", QString(), QString(), QFileInfo(perfDataFile).absolutePath()); + PerfUnwind unwind(&output, QStringLiteral(":/"), QString(), QString(), QFileInfo(perfDataFile).absolutePath()); { QFile input(perfDataFile); QVERIFY(input.open(QIODevice::ReadOnly)); // don't try to parse kallsyms here, it's not the main point and it wouldn't be portable without the mapping file // from where we recorded the data. these files are usually large, and we don't want to bloat the repo too much - if (QTest::currentDataTag() != QLatin1String("fork_static_gcc/perf.data.zstd")) - QTest::ignoreMessage(QtWarningMsg, QRegularExpression("Failed to parse kernel symbol mapping file \".+\": Mapping is empty")); + if (QLatin1String(QTest::currentDataTag()) != QLatin1String("fork_static_gcc/perf.data.zstd")) { + QTest::ignoreMessage(QtWarningMsg, + QRegularExpression(QStringLiteral( + "Failed to parse kernel symbol mapping file \".+\": Mapping is empty"))); + } unwind.setKallsymsPath(QProcess::nullDevice()); auto version = QByteArray("0.5"); - if (dataFile == "parallel_static_gcc/perf.data.zstd") + if (dataFile == QLatin1String("parallel_static_gcc/perf.data.zstd")) version = "0.6"; process(&unwind, &input, version); } @@ -332,7 +341,7 @@ void TestPerfData::testFiles() "std::enable_if<std::__is_bitwise_relocatable<double>::value, double*>::type std::__relocate_a_1<double, " "double>(double*, double*, double*, std::allocator<double>&)"}}; for (const auto& replacement : replacements) { - actualText.replace(replacement.first, replacement.second); + actualText.replace(QLatin1String(replacement.first), QLatin1String(replacement.second)); } QFile actual(actualOutputFile); @@ -350,14 +359,14 @@ void TestPerfData::testFiles() if (actualText != expectedText) { compressFile(actualOutputFile); - const auto diff = QStandardPaths::findExecutable("diff"); + const auto diff = QStandardPaths::findExecutable(QStringLiteral("diff")); if (!diff.isEmpty()) { { QFile expectedUncompressed(expectedOutputFileUncompressed); QVERIFY(expectedUncompressed.open(QIODevice::WriteOnly | QIODevice::Text)); expectedUncompressed.write(expectedText.toUtf8()); } - QProcess::execute(diff, {"-u", expectedOutputFileUncompressed, actualOutputFile}); + QProcess::execute(diff, {QStringLiteral("-u"), expectedOutputFileUncompressed, actualOutputFile}); } } QCOMPARE(actualText, expectedText); |