From 5720a12ffb1ede3b9bac039f737fe868387221b3 Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Tue, 6 Apr 2021 10:04:00 +0300 Subject: baremetal: Improve 'compiler-listing' test We do not need multiple test data instances (*.qbs) for each property, because we can pass the required properties from the C++ code directly. Also now we can know about the compiler listing file suffix directly, through the cpp.compilerListingSuffix property. Change-Id: I644277458e3ae460cbfb6bba4a24583d9e6ba3e1 Reviewed-by: Ivan Komissarov --- tests/auto/blackbox/tst_blackboxbaremetal.cpp | 36 +++++++++++++++++++-------- 1 file changed, 25 insertions(+), 11 deletions(-) (limited to 'tests/auto/blackbox/tst_blackboxbaremetal.cpp') diff --git a/tests/auto/blackbox/tst_blackboxbaremetal.cpp b/tests/auto/blackbox/tst_blackboxbaremetal.cpp index 1e300e246..b027a4e70 100644 --- a/tests/auto/blackbox/tst_blackboxbaremetal.cpp +++ b/tests/auto/blackbox/tst_blackboxbaremetal.cpp @@ -186,28 +186,42 @@ void TestBlackboxBareMetal::defines() void TestBlackboxBareMetal::compilerListingFiles_data() { - QTest::addColumn("testPath"); QTest::addColumn("generateListing"); - QTest::newRow("do-not-generate-compiler-listing") << "/do-not-generate-compiler-listing" << false; - QTest::newRow("generate-compiler-listing") << "/generate-compiler-listing" << true; + QTest::newRow("do-not-generate-compiler-listing") << false; + QTest::newRow("generate-compiler-listing") << true; } void TestBlackboxBareMetal::compilerListingFiles() { - QFETCH(QString, testPath); QFETCH(bool, generateListing); - QDir::setCurrent(testDataDir + testPath); - QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("-n"))), 0); + QDir::setCurrent(testDataDir + "/compiler-listing"); + + rmDirR(relativeBuildDir()); + QStringList args = {QStringLiteral("modules.cpp.generateCompilerListingFiles:%1") + .arg(generateListing ? "true" : "false")}; + + QCOMPARE(runQbs(QbsRunParameters("resolve", args)), 0); if (m_qbsStdout.contains("unsupported toolset:")) QSKIP(unsupportedToolsetMessage(m_qbsStdout)); - QCOMPARE(runQbs(), 0); + if (!m_qbsStdout.contains("compiler listing suffix:")) + QFAIL("No current compiler listing suffix pattern exists"); + + QString compilerListingSuffix; + if (!extractQuitedValue(m_qbsStdout, compilerListingSuffix)) + QFAIL("Unable to extract current compiler listing suffix"); + const bool isShortListingNames = m_qbsStdout.contains("using short listing file names"); - const QString productName = testPath.mid(1); - const QString productBuildDir = relativeProductBuildDir(productName); + + QCOMPARE(runQbs(QbsRunParameters(args)), 0); + const QString productBuildDir = relativeProductBuildDir("compiler-listing"); const QString hash = inputDirHash("."); - const QString mainListing = productBuildDir + "/" + hash + (isShortListingNames ? "/main.lst" : "/main.c.lst"); + const QString mainListing = productBuildDir + "/" + hash + + (isShortListingNames ? "/main" : "/main.c") + + compilerListingSuffix; QCOMPARE(regularFileExists(mainListing), generateListing); - const QString funListing = productBuildDir + "/" + hash + (isShortListingNames ? "/fun.lst" : "/fun.c.lst"); + const QString funListing = productBuildDir + "/" + hash + + (isShortListingNames ? "/fun" : "/fun.c") + + compilerListingSuffix; QCOMPARE(regularFileExists(funListing), generateListing); } -- cgit v1.2.3