From 63156e20629a087a761cbe34b110681267d58a93 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 12 Mar 2019 10:53:35 +0100 Subject: tst_qmake: Add XFAILing test Task-number: QTBUG-74265 Change-Id: I916eaf7b64a8777bf2523ddf9da65226d7d06417 Reviewed-by: Oliver Wolff --- tests/auto/tools/qmake/testcompiler.cpp | 8 ++-- tests/auto/tools/qmake/testcompiler.h | 5 ++- .../tools/qmake/testdata/simple_app/simple_app.pro | 5 +++ tests/auto/tools/qmake/tst_qmake.cpp | 45 +++++++++++++++++++++- 4 files changed, 58 insertions(+), 5 deletions(-) (limited to 'tests/auto/tools') diff --git a/tests/auto/tools/qmake/testcompiler.cpp b/tests/auto/tools/qmake/testcompiler.cpp index 3276d97354..0a7ba3b40b 100644 --- a/tests/auto/tools/qmake/testcompiler.cpp +++ b/tests/auto/tools/qmake/testcompiler.cpp @@ -31,7 +31,7 @@ #include #include -static QString targetName( BuildType buildMode, const QString& target, const QString& version ) +QString TestCompiler::targetName(BuildType buildMode, const QString& target, const QString& version) { Q_UNUSED(version); QString targetName = target; @@ -257,7 +257,8 @@ bool TestCompiler::qmakeProject( const QString &workDir, const QString &proName return runCommand(qmakeCmd_, QStringList() << "-project" << "-o" << projectFile << "DESTDIR=./"); } -bool TestCompiler::qmake( const QString &workDir, const QString &proName, const QString &buildDir ) +bool TestCompiler::qmake(const QString &workDir, const QString &proName, const QString &buildDir, + const QStringList &additionalArguments) { QDir D; D.setCurrent( workDir ); @@ -274,7 +275,8 @@ bool TestCompiler::qmake( const QString &workDir, const QString &proName, const makeFile += "Makefile"; // Now start qmake and generate the makefile - return runCommand(qmakeCmd_, QStringList(qmakeArgs_) << projectFile << "-o" << makeFile); + return runCommand(qmakeCmd_, QStringList(qmakeArgs_) << projectFile << "-o" << makeFile + << additionalArguments); } bool TestCompiler::make( const QString &workPath, const QString &target, bool expectFail ) diff --git a/tests/auto/tools/qmake/testcompiler.h b/tests/auto/tools/qmake/testcompiler.h index d3fe6d88f8..50232669c0 100644 --- a/tests/auto/tools/qmake/testcompiler.h +++ b/tests/auto/tools/qmake/testcompiler.h @@ -49,6 +49,8 @@ public: void resetEnvironment(); void addToEnvironment( QString varAssignment ); + static QString targetName(BuildType buildMode, const QString& target, const QString& version); + // executes a make clean in the specified workPath bool makeClean( const QString &workPath ); // executes a make dist clean in the specified workPath @@ -56,7 +58,8 @@ public: // executes a qmake -project on the specified workDir bool qmakeProject( const QString &workDir, const QString &proName ); // executes a qmake on proName in the specified workDir, output goes to buildDir or workDir if it's null - bool qmake( const QString &workDir, const QString &proName, const QString &buildDir = QString() ); + bool qmake(const QString &workDir, const QString &proName, const QString &buildDir = QString(), + const QStringList &additionalArguments = QStringList()); // executes a make in the specified workPath, with an optional target (eg. install) bool make( const QString &workPath, const QString &target = QString(), bool expectFail = false ); // checks if the executable exists in destDir diff --git a/tests/auto/tools/qmake/testdata/simple_app/simple_app.pro b/tests/auto/tools/qmake/testdata/simple_app/simple_app.pro index 0e78a91f46..f089ac14fc 100644 --- a/tests/auto/tools/qmake/testdata/simple_app/simple_app.pro +++ b/tests/auto/tools/qmake/testdata/simple_app/simple_app.pro @@ -5,3 +5,8 @@ SOURCES = test_file.cpp \ RESOURCES = test.qrc TARGET = "simple app" DESTDIR = "dest dir" + +target.path = $$OUT_PWD/dist +INSTALLS += target + +!build_pass:msvc:CONFIG(debug, debug|release):message("check for pdb, please") diff --git a/tests/auto/tools/qmake/tst_qmake.cpp b/tests/auto/tools/qmake/tst_qmake.cpp index 2b822e682f..1eaf66311c 100644 --- a/tests/auto/tools/qmake/tst_qmake.cpp +++ b/tests/auto/tools/qmake/tst_qmake.cpp @@ -58,6 +58,7 @@ private slots: void simple_app(); void simple_app_shadowbuild(); void simple_app_shadowbuild2(); + void simple_app_versioned(); void simple_lib(); void simple_dll(); void subdirs(); @@ -173,10 +174,15 @@ void tst_qmake::simple_app() { QString workDir = base_path + "/testdata/simple_app"; QString destDir = workDir + "/dest dir"; + QString installDir = workDir + "/dist"; - QVERIFY( test_compiler.qmake( workDir, "simple_app" )); + QVERIFY( test_compiler.qmake( workDir, "simple_app", QString() )); QVERIFY( test_compiler.make( workDir )); QVERIFY( test_compiler.exists( destDir, "simple app", Exe, "1.0.0" )); + + QVERIFY(test_compiler.make(workDir, "install")); + QVERIFY(test_compiler.exists(installDir, "simple app", Exe, "1.0.0")); + QVERIFY( test_compiler.makeClean( workDir )); QVERIFY( test_compiler.exists( destDir, "simple app", Exe, "1.0.0" )); // Should still exist after a make clean QVERIFY( test_compiler.makeDistClean( workDir )); @@ -216,6 +222,43 @@ void tst_qmake::simple_app_shadowbuild2() QVERIFY( test_compiler.removeMakefile( buildDir ) ); } +void tst_qmake::simple_app_versioned() +{ + QString workDir = base_path + "/testdata/simple_app"; + QString buildDir = base_path + "/testdata/simple_app_versioned_build"; + QString destDir = buildDir + "/dest dir"; + QString installDir = buildDir + "/dist"; + + QString version = "4.5.6"; + QVERIFY(test_compiler.qmake(workDir, "simple_app", buildDir, QStringList{ "VERSION=" + version })); + QString qmakeOutput = test_compiler.commandOutput(); + QVERIFY(test_compiler.make(buildDir)); + QVERIFY(test_compiler.exists(destDir, "simple app", Exe, version)); + + QString pdbFilePath; + bool checkPdb = qmakeOutput.contains("Project MESSAGE: check for pdb, please"); + if (checkPdb) { + QString targetBase = QFileInfo(TestCompiler::targetName(Exe, "simple app", version)) + .completeBaseName(); + pdbFilePath = destDir + '/' + targetBase + ".pdb"; + QVERIFY2(QFile::exists(pdbFilePath), qPrintable(pdbFilePath)); + QVERIFY(test_compiler.make(buildDir, "install")); + QString installedPdbFilePath = installDir + '/' + targetBase + ".pdb"; + QEXPECT_FAIL("", "QTBUG-74265", Continue); + QVERIFY2(QFile::exists(installedPdbFilePath), qPrintable(installedPdbFilePath)); + } + + QVERIFY(test_compiler.makeClean(buildDir)); + QVERIFY(test_compiler.exists(destDir, "simple app", Exe, version)); + QVERIFY(test_compiler.makeDistClean(buildDir)); + QVERIFY(!test_compiler.exists(destDir, "simple app", Exe, version)); + if (checkPdb) { + QEXPECT_FAIL("", "QTBUG-74265", Continue); + QVERIFY(!QFile::exists(pdbFilePath)); + } + QVERIFY(test_compiler.removeMakefile(buildDir)); +} + void tst_qmake::simple_dll() { QString workDir = base_path + "/testdata/simple_dll"; -- cgit v1.2.3