tst_qmake: Add XFAILing test

Task-number: QTBUG-74265
Change-Id: I916eaf7b64a8777bf2523ddf9da65226d7d06417
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
bb10
Joerg Bornemann 2019-03-12 10:53:35 +01:00
parent 2fedce8ed8
commit 63156e2062
4 changed files with 58 additions and 5 deletions

View File

@ -31,7 +31,7 @@
#include <QProcess>
#include <QDir>
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 )

View File

@ -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

View File

@ -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")

View File

@ -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";