summaryrefslogtreecommitdiffstats
path: root/tests/auto/qmake
diff options
context:
space:
mode:
authorAlexis Menard <alexis.menard@nokia.com>2009-04-17 12:01:04 (GMT)
committerAlexis Menard <alexis.menard@nokia.com>2009-04-17 12:01:04 (GMT)
commit198efeb27e5c2a87d0a2bb6859446cb1faf45ed8 (patch)
treee4c99e89cbecd2084a87a8c7a5d4877385fcec1c /tests/auto/qmake
parentbb2e4df9bee3148e819c98410aa36e22dad95d7a (diff)
parente85867003ca1741f378b1f58f4dd9d48577a5d9b (diff)
downloadQt-198efeb27e5c2a87d0a2bb6859446cb1faf45ed8.zip
Qt-198efeb27e5c2a87d0a2bb6859446cb1faf45ed8.tar.gz
Qt-198efeb27e5c2a87d0a2bb6859446cb1faf45ed8.tar.bz2
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt into kinetic-animations
Conflicts: src/gui/graphicsview/qgraphicsitem.cpp
Diffstat (limited to 'tests/auto/qmake')
-rw-r--r--tests/auto/qmake/qmake.pro2
-rw-r--r--tests/auto/qmake/testcompiler.cpp311
-rw-r--r--tests/auto/qmake/testcompiler.h49
-rw-r--r--tests/auto/qmake/testdata/bundle-spaces/bundle-spaces.pro13
-rw-r--r--tests/auto/qmake/testdata/bundle-spaces/existing file0
-rw-r--r--tests/auto/qmake/testdata/bundle-spaces/main.cpp0
-rw-r--r--tests/auto/qmake/testdata/bundle-spaces/some-file6
-rw-r--r--tests/auto/qmake/testdata/functions/functions.pro14
-rw-r--r--tests/auto/qmake/testdata/shadow_files_build/README2
-rw-r--r--tests/auto/qmake/tst_qmake.cpp84
10 files changed, 191 insertions, 290 deletions
diff --git a/tests/auto/qmake/qmake.pro b/tests/auto/qmake/qmake.pro
index 59cc2be..8cae6be 100644
--- a/tests/auto/qmake/qmake.pro
+++ b/tests/auto/qmake/qmake.pro
@@ -2,8 +2,6 @@ load(qttest_p4)
HEADERS += testcompiler.h
SOURCES += tst_qmake.cpp testcompiler.cpp
-contains(QT_CONFIG, qt3support): QT += qt3support
-
cross_compile: DEFINES += QMAKE_CROSS_COMPILED
diff --git a/tests/auto/qmake/testcompiler.cpp b/tests/auto/qmake/testcompiler.cpp
index b1f9955..122a2b8 100644
--- a/tests/auto/qmake/testcompiler.cpp
+++ b/tests/auto/qmake/testcompiler.cpp
@@ -39,49 +39,37 @@
**
****************************************************************************/
-
#include "testcompiler.h"
-#include <stdlib.h>
-#include <qapplication.h>
-
-#ifdef QT3_SUPPORT
-
-#include <q3process.h>
-#include <qtimer.h>
-#ifdef Q_OS_WIN32
-# include <windows.h>
-#endif
-#include <QtTest/QtTest>
+#include <QProcess>
+#include <QDir>
-#undef SHOW_QDEBUG
-#undef SHOW_COMPLETENESS
-
-QString targetName( BuildType buildMode, const QString& target, const QString& version )
+static QString targetName( BuildType buildMode, const QString& target, const QString& version )
{
+ Q_UNUSED(version);
QString targetName = target;
#if defined (Q_OS_WIN32)
switch (buildMode)
{
case Exe: // app
- targetName.append(".exe");
- break;
+ targetName.append(".exe");
+ break;
case Dll: // dll
- if (version != "") {
- QStringList ver = QStringList::split(".", version);
- targetName.append(ver.first());
- }
+ if (version != "") {
+ QStringList ver = QStringList::split(".", version);
+ targetName.append(ver.first());
+ }
targetName.append(".dll");
- break;
+ break;
case Lib: // lib
#ifdef Q_CC_GNU
targetName.prepend("lib");
targetName.append(".a");
#else
- targetName.append(".lib");
+ targetName.append(".lib");
#endif
- break;
+ break;
case Plain:
// no conversion
break;
@@ -90,16 +78,16 @@ QString targetName( BuildType buildMode, const QString& target, const QString& v
switch (buildMode)
{
case Exe: // app
- targetName += ".app/Contents/MacOS/" + target.section('/', -1);
- break;
+ targetName += ".app/Contents/MacOS/" + target.section('/', -1);
+ break;
case Dll: // dll
- targetName.prepend("lib");
+ targetName.prepend("lib");
targetName.append("." + version + ".dylib");
- break;
+ break;
case Lib: // lib
- targetName.prepend("lib");
- targetName.append(".a");
- break;
+ targetName.prepend("lib");
+ targetName.append(".a");
+ break;
case Plain:
// no conversion
break;
@@ -108,9 +96,9 @@ QString targetName( BuildType buildMode, const QString& target, const QString& v
switch (buildMode)
{
case Exe: // app
- break;
+ break;
case Dll: // dll
- targetName.prepend("lib");
+ targetName.prepend("lib");
#if defined (Q_OS_HPUX) && !defined (__ia64)
targetName.append(".sl");
#elif defined (Q_OS_AIX)
@@ -118,11 +106,11 @@ QString targetName( BuildType buildMode, const QString& target, const QString& v
#else
targetName.append(".so");
#endif
- break;
+ break;
case Lib: // lib
- targetName.prepend("lib");
- targetName.append(".a");
- break;
+ targetName.prepend("lib");
+ targetName.append(".a");
+ break;
case Plain:
// no conversion
break;
@@ -131,223 +119,119 @@ QString targetName( BuildType buildMode, const QString& target, const QString& v
return targetName;
}
-
-
TestCompiler::TestCompiler()
{
- exit_ok = FALSE;
- childProc = 0;
- setBaseCommands( "", "", FALSE );
+ setBaseCommands( "", "" );
}
TestCompiler::~TestCompiler()
{
- if (childProc)
- delete childProc;
}
-bool TestCompiler::runChild( bool showOutput, QStringList argList, QStringList *envList )
+bool TestCompiler::runCommand( QString cmdline )
{
- //qDebug() << "executing" << argList;
- exit_ok = FALSE;
- if (childProc)
- delete childProc;
+ testOutput_.append("Running command: " + cmdline);
- child_show = showOutput;
- if ( showOutput ) {
+ QProcess child;
+ if (!environment_.empty())
+ child.setEnvironment(QProcess::systemEnvironment() + environment_);
- QString S = argList.join(" ");
- addMakeResult( S );
+ child.start(cmdline);
+ if (!child.waitForStarted(-1)) {
+ testOutput_.append( "Unable to start child process." );
+ return false;
}
- childProc = new Q3Process(argList, this, argList.join(" ").latin1());
- Q_ASSERT(childProc);
-
- connect(childProc,SIGNAL(readyReadStdout()),this,SLOT(childHasData()));
- connect(childProc,SIGNAL(processExited()),this,SLOT(childReady()));
-
- if (!childProc->start( envList )) {
-
- addMakeResult( "Error executing '" + argList[0] + "'." );
- childReady();
- return FALSE;
- }
-
- while (childProc != 0 && childProc->isRunning()) {
- qApp->processEvents();
+ bool failed = false;
+ child.setReadChannel(QProcess::StandardError);
+ while (QProcess::Running == child.state()) {
+ if (child.waitForReadyRead(1000)) {
+ QString output = child.readAllStandardError();
+ testOutput_.append(output);
+
+ output.prepend('\n');
+ if (output.contains("\nProject MESSAGE: FAILED"))
+ failed = true;
+ }
}
- childReady();
+ child.waitForFinished(-1);
- return exit_ok;
+ return failed
+ ? false
+ : (child.exitStatus() == QProcess::NormalExit)
+ && (child.exitCode() == 0);
}
-void TestCompiler::childReady()
+void TestCompiler::setBaseCommands( QString makeCmd, QString qmakeCmd )
{
- if (childProc != 0) {
- childHasData();
-
- QString S;
- int pos;
- while (childProc->canReadLineStderr()) {
- S = childProc->readLineStderr();
- do {
- pos = S.find("\t");
- if (pos >= 0) {
- S.remove(pos,1);
- S.insert(pos," ");
- }
- } while (pos >= 0);
-
- if (child_show)
- addMakeResult( S );
- }
-
- exit_ok = childProc->normalExit() && childProc->exitStatus() == 0;
- delete childProc;
- }
- childProc = 0;
+ makeCmd_ = makeCmd;
+ qmakeCmd_ = qmakeCmd;
}
-void TestCompiler::childHasData()
+void TestCompiler::resetEnvironment()
{
- QString S;
- int pos;
- while (childProc->canReadLineStderr()) {
-
- S = childProc->readLineStderr();
- do {
- pos = S.find("\t");
- if (pos >= 0) {
- S.remove(pos,1);
- S.insert(pos," ");
- }
-
- } while (pos >= 0);
-
- if ( S.startsWith("Project MESSAGE: FAILED") )
- QTest::qFail( S, __FILE__, __LINE__ );
- else if ( S.startsWith("Project MESSAGE: SKIPPED") )
- QTest::qSkip( S, QTest::SkipSingle, __FILE__, __LINE__ );
- else if (child_show)
- addMakeResult( S );
- }
+ environment_.clear();
}
-void TestCompiler::setBaseCommands( QString makeCmd, QString qmakeCmd, bool qwsMode )
+void TestCompiler::addToEnvironment( QString varAssignment )
{
- qws_mode = qwsMode;
- make_cmd = makeCmd;
-
- // not sure if i need this, but it doesn't hurt
- if (make_cmd.startsWith("\""))
- make_cmd = make_cmd.remove(0,1);
- if (make_cmd.endsWith("\""))
- make_cmd = make_cmd.remove(make_cmd.length()-1,1);
-
- qmake_cmd = qmakeCmd;
- // also not sure if i need this, but it doesn't hurt...
- if(qmake_cmd.length() >= 2 && (qmake_cmd.at(0) == '"' || qmake_cmd.at(0) == '\'') && qmake_cmd.at(qmake_cmd.length()-1) == qmake_cmd.at(0))
- qmake_cmd = qmake_cmd.mid(1, qmake_cmd.length()-2);
-}
-
-bool TestCompiler::cleanAll( const QString &workPath, const QString &destPath, const QString &exeName, const QString &exeExt )
-{
- QDir D(workPath);
- if (!D.exists()) {
-
- addMakeResult( "Directory '" + workPath + "' doesn't exist" );
- return FALSE;
- }
-
- D.setCurrent(workPath);
- // must delete at least the executable file to be able to easily and safely
- // verify that the compilation was a success.
- D.remove( destPath + "/" + exeName + exeExt );
- D.remove( workPath + "/Makefile");
- QFileInfo Fi( workPath + "/Makefile");
- if (Fi.exists()) {
-
- // Run make clean
- QStringList args;
- args = QStringList::split( " ", make_cmd );
- args.append("clean");
-
- return runChild( FALSE, args, 0 );
- }
-
- return TRUE;
+ environment_.push_back(varAssignment);
}
bool TestCompiler::makeClean( const QString &workPath )
{
QDir D;
if (!D.exists(workPath)) {
-
- addMakeResult( "Directory '" + workPath + "' doesn't exist" );
- return FALSE;
+ testOutput_.append( "Directory '" + workPath + "' doesn't exist" );
+ return false;
}
D.setCurrent(workPath);
QFileInfo Fi( workPath + "/Makefile");
- if (Fi.exists()) {
-
- // Run make clean
- QStringList args;
- args = QStringList::split( " ", make_cmd );
- args.append("clean");
+ if (Fi.exists())
+ // Run make clean
+ return runCommand( makeCmd_ + " clean" );
- return runChild( FALSE, args, 0 );
- }
-
- return TRUE;
+ return true;
}
bool TestCompiler::makeDistClean( const QString &workPath )
{
QDir D;
if (!D.exists(workPath)) {
- addMakeResult( "Directory '" + workPath + "' doesn't exist" );
- return FALSE;
+ testOutput_.append( "Directory '" + workPath + "' doesn't exist" );
+ return false;
}
D.setCurrent(workPath);
QFileInfo Fi( workPath + "/Makefile");
- if (Fi.exists()) {
- // Run make distclean
- QStringList args;
- args = QStringList::split( " ", make_cmd );
- args.append("distclean");
-
- return runChild( FALSE, args, 0 );
- }
+ if (Fi.exists())
+ // Run make distclean
+ return runCommand( makeCmd_ + " distclean" );
- return TRUE;
+ return true;
}
bool TestCompiler::qmake( const QString &workDir, const QString &proName, const QString &buildDir )
{
- // Now start qmake and generate the makefile
-
- QDir D( workDir );
- // Make sure we start in the right directory
+ QDir D;
D.setCurrent( workDir );
if (D.exists("Makefile"))
- D.remove("Makefile");
+ D.remove("Makefile");
- QStringList args;
- args = QStringList::split( " ", qmake_cmd );
+ QString projectFile = proName;
+ QString makeFile = buildDir;
+ if (!projectFile.endsWith(".pro"))
+ projectFile += ".pro";
+ if (!makeFile.isEmpty() && !makeFile.endsWith('/'))
+ makeFile += '/';
+ makeFile += "Makefile";
- QString project_fname = workDir + "/" + proName + ".pro";
- QString makefile_fname = (buildDir.isNull()?QString():(buildDir + "/")) + "Makefile";
-
- args.append( project_fname );
- args.append( "-o" );
- args.append( makefile_fname );
-
- return runChild( TRUE, args, 0 );
+ // Now start qmake and generate the makefile
+ return runCommand( qmakeCmd_ + " " + projectFile + " -o " + makeFile );
}
bool TestCompiler::make( const QString &workPath, const QString &target )
@@ -355,20 +239,13 @@ bool TestCompiler::make( const QString &workPath, const QString &target )
QDir D;
D.setCurrent( workPath );
- QStringList args;
- args = QStringList::split( " ", make_cmd );
- if ( make_cmd.lower().find("nmake") >= 0)
- args.append("/NOLOGO");
- if ( !target.isNull() )
- args.append(target);
-
- bool ok = runChild( TRUE, args, 0 );
+ QString cmdline = makeCmd_;
+ if ( cmdline.contains("nmake", Qt::CaseInsensitive) )
+ cmdline.append(" /NOLOGO");
+ if ( !target.isEmpty() )
+ cmdline += " " + target;
- if (!ok) {
- QTest::qFail( COMPILE_ERROR, __FILE__, __LINE__ );
- }
-
- return ok;
+ return runCommand( cmdline );
}
bool TestCompiler::exists( const QString &destDir, const QString &exeName, BuildType buildType, const QString &version )
@@ -377,20 +254,12 @@ bool TestCompiler::exists( const QString &destDir, const QString &exeName, Build
return f.exists();
}
-void TestCompiler::addMakeResult( const QString &result )
-{
- make_result.append( result );
-}
-
bool TestCompiler::removeMakefile( const QString &workPath )
{
QDir D;
D.setCurrent( workPath );
if ( D.exists( "Makefile" ) )
- return D.remove( "Makefile" );
+ return D.remove( "Makefile" );
else
- return TRUE;
+ return true;
}
-
-#endif //QT3_SUPPORT
-
diff --git a/tests/auto/qmake/testcompiler.h b/tests/auto/qmake/testcompiler.h
index 597d440..41e5177 100644
--- a/tests/auto/qmake/testcompiler.h
+++ b/tests/auto/qmake/testcompiler.h
@@ -41,33 +41,22 @@
#ifndef TESTCOMPILER_H
#define TESTCOMPILER_H
-
-#ifdef QT3_SUPPORT
-
-#include <qobject.h>
-#include <qstringlist.h>
-
-QT_FORWARD_DECLARE_CLASS(Q3Process)
-
-#define COMPILE_ERROR "Compile error"
-#define COMPILE_SUCCESS "Compile successfull"
-#define COMPILE_NOT_AVAIL "Binary not available for testing"
-#define SELF_TEST "self-test"
+#include <QObject>
+#include <QStringList>
enum BuildType { Exe, Dll, Lib, Plain };
class TestCompiler : public QObject
{
-Q_OBJECT
+ Q_OBJECT
public:
TestCompiler();
virtual ~TestCompiler();
- void setBaseCommands( QString makeCmd, QString qmakeCmd, bool qwsMode );
-
- // builds a complete project, e.g. qmake, make clean, make and exists.
- bool buildProject( const QString &project, BuildType buildType, const QString &targetName, const QString &destPath, const QString &version );
+ void setBaseCommands( QString makeCmd, QString qmakeCmd );
+ void resetEnvironment();
+ void addToEnvironment( QString varAssignment );
// executes a make clean in the specified workPath
bool makeClean( const QString &workPath );
@@ -77,34 +66,20 @@ public:
bool qmake( const QString &workDir, const QString &proName, const QString &buildDir = QString() );
// executes a make in the specified workPath, with an optional target (eg. install)
bool make( const QString &workPath, const QString &target = QString() );
- // executes a make clean and then deletes the makefile in workpath + deletes the executable
- // in destPath.
- bool cleanAll( const QString &workPath, const QString &destPath, const QString &exeName, const QString &exeExt );
// checks if the executable exists in destDir
bool exists( const QString &destDir, const QString &exeName, BuildType buildType, const QString &version );
// removes the makefile
bool removeMakefile( const QString &workPath );
private:
- QString make_cmd;
- QString qmake_cmd;
-
- Q3Process *childProc;
- QStringList env_list;
+ bool runCommand( QString cmdLine );
- bool child_show;
- bool qws_mode;
- bool exit_ok;
-
-private:
- bool runChild( bool showOutput, QStringList argList, QStringList *envList );
- void addMakeResult( const QString &result );
- QStringList make_result;
+ QString makeCmd_;
+ QString qmakeCmd_;
+ QStringList environment_;
-private slots:
- void childReady();
- void childHasData();
+ // need to make this available somewhere
+ QStringList testOutput_;
};
-#endif // QT3_SUPPORT
#endif // TESTCOMPILER_H
diff --git a/tests/auto/qmake/testdata/bundle-spaces/bundle-spaces.pro b/tests/auto/qmake/testdata/bundle-spaces/bundle-spaces.pro
new file mode 100644
index 0000000..644a817
--- /dev/null
+++ b/tests/auto/qmake/testdata/bundle-spaces/bundle-spaces.pro
@@ -0,0 +1,13 @@
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+
+# Input
+SOURCES += main.cpp
+
+QWERTY_BUNDLE.version = Bogus.78
+QWERTY_BUNDLE.files = some-file "existing file" "non-existing file"
+QWERTY_BUNDLE.path = QwertyData
+
+QMAKE_BUNDLE_DATA = QWERTY_BUNDLE
diff --git a/tests/auto/qmake/testdata/bundle-spaces/existing file b/tests/auto/qmake/testdata/bundle-spaces/existing file
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/auto/qmake/testdata/bundle-spaces/existing file
diff --git a/tests/auto/qmake/testdata/bundle-spaces/main.cpp b/tests/auto/qmake/testdata/bundle-spaces/main.cpp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/auto/qmake/testdata/bundle-spaces/main.cpp
diff --git a/tests/auto/qmake/testdata/bundle-spaces/some-file b/tests/auto/qmake/testdata/bundle-spaces/some-file
new file mode 100644
index 0000000..9975dba
--- /dev/null
+++ b/tests/auto/qmake/testdata/bundle-spaces/some-file
@@ -0,0 +1,6 @@
+all:
+ C:\git\qt-kinetic-animations\bin\qmake qdir.pro -o Makefile -spec win32-msvc2008
+ nmake -f Makefile
+first: all
+qmake:
+ C:\git\qt-kinetic-animations\bin\qmake qdir.pro -o Makefile -spec win32-msvc2008
diff --git a/tests/auto/qmake/testdata/functions/functions.pro b/tests/auto/qmake/testdata/functions/functions.pro
index 5ee5f51..9ed92f96 100644
--- a/tests/auto/qmake/testdata/functions/functions.pro
+++ b/tests/auto/qmake/testdata/functions/functions.pro
@@ -51,15 +51,11 @@ include( infiletest.pro )
message( "FAILED: include function: $$DEFINES" )
}
-lessThan(QT_VERSION, 40200) {
- message( "SKIPPED: replace function only in 4.2" )
-} else {
- #replace
- VERSION=1.0.0
- VERSION_replaced=$$replace(VERSION,\.,_)
- !isEqual(VERSION_replaced, 1_0_0) {
- message( "FAILED: replace function: $$VERSION_replaced" )
- }
+#replace
+VERSION=1.0.0
+VERSION_replaced=$$replace(VERSION,\.,_)
+!isEqual(VERSION_replaced, 1_0_0) {
+ message( "FAILED: replace function: $$VERSION_replaced" )
}
#test functions
diff --git a/tests/auto/qmake/testdata/shadow_files_build/README b/tests/auto/qmake/testdata/shadow_files_build/README
index 46017fc..15e48c0 100644
--- a/tests/auto/qmake/testdata/shadow_files_build/README
+++ b/tests/auto/qmake/testdata/shadow_files_build/README
@@ -1 +1 @@
-Here to ensure include_dir_build exists
+Here to ensure shadow_files_build exists, used by the shadow_files test.
diff --git a/tests/auto/qmake/tst_qmake.cpp b/tests/auto/qmake/tst_qmake.cpp
index 4840b42..70f1f3c 100644
--- a/tests/auto/qmake/tst_qmake.cpp
+++ b/tests/auto/qmake/tst_qmake.cpp
@@ -39,21 +39,13 @@
**
****************************************************************************/
-
-#include <QtTest/QtTest>
-
-#if !defined(QMAKE_CROSS_COMPILED) && defined(QT3_SUPPORT)
-
-#include <qdir.h>
-#include <qprocess.h>
-
+#if !defined(QMAKE_CROSS_COMPILED)
#include "testcompiler.h"
-#include <stdlib.h>
-
-//TESTED_CLASS=
-//TESTED_FILES=corelib/tools/qlocale.h corelib/tools/qlocale.cpp
+#include <QObject>
+#include <QDir>
+#include <QtTest/QtTest>
class tst_qmake : public QObject
{
@@ -63,12 +55,12 @@ public:
tst_qmake();
virtual ~tst_qmake();
-
public slots:
void initTestCase();
void cleanupTestCase();
void init();
void cleanup();
+
private slots:
void simple_app();
void simple_lib();
@@ -90,6 +82,10 @@ private slots:
void one_space();
void findMocs();
void findDeps();
+#ifndef Q_OS_WIN
+ // Test requires make
+ void bundle_spaces();
+#endif
private:
TestCompiler test_compiler;
@@ -100,16 +96,16 @@ tst_qmake::tst_qmake()
{
QString cmd = QString("qmake \"QT_VERSION=%1\"").arg(QT_VERSION);
#ifdef Q_CC_MSVC
- test_compiler.setBaseCommands( "nmake", cmd, FALSE );
+ test_compiler.setBaseCommands( "nmake", cmd );
#elif defined(Q_CC_MINGW)
- test_compiler.setBaseCommands( "mingw32-make", cmd, FALSE );
+ test_compiler.setBaseCommands( "mingw32-make", cmd );
#elif defined(Q_OS_WIN) && defined(Q_CC_GNU)
- test_compiler.setBaseCommands( "mmmake", cmd, FALSE );
+ test_compiler.setBaseCommands( "mmmake", cmd );
#else
- test_compiler.setBaseCommands( "make", cmd, FALSE );
+ test_compiler.setBaseCommands( "make", cmd );
#endif
QDir dir;
- base_path = dir.currentDirPath();
+ base_path = dir.currentPath();
}
tst_qmake::~tst_qmake()
@@ -251,10 +247,10 @@ void tst_qmake::duplicateLibraryEntries()
void tst_qmake::export_across_file_boundaries()
{
// This relies on features so we need to set the QMAKEFEATURES environment variable
- putenv("QMAKEFEATURES=.");
+ test_compiler.addToEnvironment("QMAKEFEATURES=.");
QString workDir = base_path + "/testdata/export_across_file_boundaries";
QVERIFY( test_compiler.qmake( workDir, "foo" ));
- putenv("QMAKEFEATURES=");
+ test_compiler.resetEnvironment();
}
void tst_qmake::include_dir()
@@ -377,6 +373,54 @@ void tst_qmake::findDeps()
QVERIFY( test_compiler.removeMakefile(workDir) );
}
+struct TempFile
+ : QFile
+{
+ TempFile(QString filename)
+ : QFile(filename)
+ {
+ }
+
+ ~TempFile()
+ {
+ if (this->exists())
+ this->remove();
+ }
+};
+
+#ifndef Q_OS_WIN
+void tst_qmake::bundle_spaces()
+{
+ QString workDir = base_path + "/testdata/bundle-spaces";
+
+ // We set up alternate commands here, to make sure we're testing Mac
+ // Bundles and since this might be the wrong output we rely on dry-running
+ // make (-n).
+
+ TestCompiler local_tc;
+ local_tc.setBaseCommands("make -n", "qmake -macx -spec macx-g++");
+
+ QVERIFY( local_tc.qmake(workDir, "bundle-spaces") );
+
+ TempFile non_existing_file(workDir + "/non-existing file");
+ QVERIFY( !non_existing_file.exists() );
+
+ // Make fails: no rule to make "non-existing file"
+ QVERIFY( !local_tc.make(workDir) );
+
+ QVERIFY( non_existing_file.open(QIODevice::WriteOnly) );
+ QVERIFY( non_existing_file.exists() );
+
+ // Aha!
+ QVERIFY( local_tc.make(workDir) );
+
+ // Cleanup
+ QVERIFY( non_existing_file.remove() );
+ QVERIFY( !non_existing_file.exists() );
+ QVERIFY( local_tc.removeMakefile(workDir) );
+}
+#endif // Q_OS_WIN
+
QTEST_MAIN(tst_qmake)
#include "tst_qmake.moc"