summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoão Abecasis <joao@abecasis.name>2009-04-02 13:47:54 (GMT)
committerJoão Abecasis <joao@abecasis.name>2009-04-02 14:29:49 (GMT)
commit0d026b267badbf7890b02256826f0ff3821fcec7 (patch)
tree4f0cc8d6371f08f113beee5f4002dad214fc5a6c
parentd9e3fd083217f3b03f211d64e7d78b36da90bf51 (diff)
downloadQt-0d026b267badbf7890b02256826f0ff3821fcec7.zip
Qt-0d026b267badbf7890b02256826f0ff3821fcec7.tar.gz
Qt-0d026b267badbf7890b02256826f0ff3821fcec7.tar.bz2
Spring cleaning in qmake tests
And some indentation fixes in qmake itself. Fixes indentation; TRUE => true; FALSE => false; #includes and #defines cleanup; removes dead code; comments... and somewhere along the way marked a function static. Reviewed-by: mariusSO
-rw-r--r--qmake/generators/makefile.h6
-rw-r--r--qmake/generators/metamakefile.cpp2
-rw-r--r--qmake/project.cpp2
-rw-r--r--tests/auto/qmake/testcompiler.cpp109
-rw-r--r--tests/auto/qmake/testcompiler.h17
-rw-r--r--tests/auto/qmake/testdata/shadow_files_build/README2
-rw-r--r--tests/auto/qmake/tst_qmake.cpp18
7 files changed, 49 insertions, 107 deletions
diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h
index a26a247..cf09a6a 100644
--- a/qmake/generators/makefile.h
+++ b/qmake/generators/makefile.h
@@ -109,7 +109,7 @@ protected:
struct SubTarget
{
QString name;
- QString in_directory, out_directory;
+ QString in_directory, out_directory;
QString profile, target, makefile;
QStringList depends;
};
@@ -183,8 +183,8 @@ protected:
void filterIncludedFiles(const QString &);
virtual void processSources() {
- filterIncludedFiles("SOURCES");
- filterIncludedFiles("GENERATED_SOURCES");
+ filterIncludedFiles("SOURCES");
+ filterIncludedFiles("GENERATED_SOURCES");
}
//for cross-platform dependent directories
diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp
index f0683a7..3f60791 100644
--- a/qmake/generators/metamakefile.cpp
+++ b/qmake/generators/metamakefile.cpp
@@ -360,7 +360,7 @@ SubdirsMetaMakefileGenerator::init()
}
--recurseDepth;
- Option::output.setFileName(old_output);
+ Option::output.setFileName(old_output);
Option::output_dir = old_output_dir;
qmake_setpwd(oldpwd);
}
diff --git a/qmake/project.cpp b/qmake/project.cpp
index 8d49788..eef32db 100644
--- a/qmake/project.cpp
+++ b/qmake/project.cpp
@@ -1105,7 +1105,7 @@ QMakeProject::parse(const QString &t, QMap<QString, QStringList> &place, int num
}
}
}
- } else if(!parens && *(d+d_off) == QLatin1Char('}')) {
+ } else if(!parens && *(d+d_off) == QLatin1Char('}')) {
if(start_block) {
--start_block;
} else if(!scope_blocks.count()) {
diff --git a/tests/auto/qmake/testcompiler.cpp b/tests/auto/qmake/testcompiler.cpp
index c25b851..b518da8 100644
--- a/tests/auto/qmake/testcompiler.cpp
+++ b/tests/auto/qmake/testcompiler.cpp
@@ -39,23 +39,12 @@
**
****************************************************************************/
-
#include "testcompiler.h"
-#include <stdlib.h>
-#include <qapplication.h>
-
-#include <qprocess.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;
@@ -64,23 +53,23 @@ QString targetName( BuildType buildMode, const QString& target, const QString& v
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;
@@ -89,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;
@@ -107,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)
@@ -117,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;
@@ -130,8 +119,6 @@ QString targetName( BuildType buildMode, const QString& target, const QString& v
return targetName;
}
-
-
TestCompiler::TestCompiler()
{
setBaseCommands( "", "" );
@@ -179,48 +166,21 @@ void TestCompiler::setBaseCommands( QString makeCmd, QString qmakeCmd )
qmakeCmd_ = qmakeCmd;
}
-bool TestCompiler::cleanAll( const QString &workPath, const QString &destPath, const QString &exeName, const QString &exeExt )
-{
- QDir D(workPath);
- if (!D.exists()) {
-
- testOutput_.append( "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
- return runCommand( makeCmd_ + " clean" );
- }
-
- return TRUE;
-}
-
bool TestCompiler::makeClean( const QString &workPath )
{
QDir D;
if (!D.exists(workPath)) {
-
testOutput_.append( "Directory '" + workPath + "' doesn't exist" );
- return FALSE;
+ return false;
}
D.setCurrent(workPath);
QFileInfo Fi( workPath + "/Makefile");
- if (Fi.exists()) {
-
- // Run make clean
- return runCommand( makeCmd_ + " clean" );
- }
+ if (Fi.exists())
+ // Run make clean
+ return runCommand( makeCmd_ + " clean" );
- return TRUE;
+ return true;
}
bool TestCompiler::makeDistClean( const QString &workPath )
@@ -228,7 +188,7 @@ bool TestCompiler::makeDistClean( const QString &workPath )
QDir D;
if (!D.exists(workPath)) {
testOutput_.append( "Directory '" + workPath + "' doesn't exist" );
- return FALSE;
+ return false;
}
D.setCurrent(workPath);
@@ -237,7 +197,7 @@ bool TestCompiler::makeDistClean( const QString &workPath )
// Run make distclean
return runCommand( makeCmd_ + " distclean" );
- return TRUE;
+ return true;
}
@@ -281,13 +241,12 @@ bool TestCompiler::exists( const QString &destDir, const QString &exeName, Build
return f.exists();
}
-
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;
}
diff --git a/tests/auto/qmake/testcompiler.h b/tests/auto/qmake/testcompiler.h
index 12d8878..90f7fea 100644
--- a/tests/auto/qmake/testcompiler.h
+++ b/tests/auto/qmake/testcompiler.h
@@ -41,19 +41,14 @@
#ifndef TESTCOMPILER_H
#define TESTCOMPILER_H
-#include <qobject.h>
-#include <qstringlist.h>
-
-#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();
@@ -61,9 +56,6 @@ public:
void setBaseCommands( QString makeCmd, QString qmakeCmd );
- // 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 );
-
// executes a make clean in the specified workPath
bool makeClean( const QString &workPath );
// executes a make dist clean in the specified workPath
@@ -72,9 +64,6 @@ 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
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 884a2c4..07389e9 100644
--- a/tests/auto/qmake/tst_qmake.cpp
+++ b/tests/auto/qmake/tst_qmake.cpp
@@ -39,19 +39,13 @@
**
****************************************************************************/
-
-#include <QtTest/QtTest>
-
#if !defined(QMAKE_CROSS_COMPILED)
-#include <qdir.h>
-
#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
{
@@ -61,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();
@@ -253,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=.");
+ putenv("QMAKEFEATURES=.");
QString workDir = base_path + "/testdata/export_across_file_boundaries";
QVERIFY( test_compiler.qmake( workDir, "foo" ));
- putenv("QMAKEFEATURES=");
+ putenv("QMAKEFEATURES=");
}
void tst_qmake::include_dir()