diff options
author | João Abecasis <joao@abecasis.name> | 2009-04-02 15:47:54 +0200 |
---|---|---|
committer | João Abecasis <joao@abecasis.name> | 2009-04-02 16:29:49 +0200 |
commit | 0d026b267badbf7890b02256826f0ff3821fcec7 (patch) | |
tree | 4f0cc8d6371f08f113beee5f4002dad214fc5a6c /tests/auto/qmake | |
parent | d9e3fd083217f3b03f211d64e7d78b36da90bf51 (diff) | |
download | qt4-tools-0d026b267badbf7890b02256826f0ff3821fcec7.tar.gz |
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
Diffstat (limited to 'tests/auto/qmake')
-rw-r--r-- | tests/auto/qmake/testcompiler.cpp | 109 | ||||
-rw-r--r-- | tests/auto/qmake/testcompiler.h | 17 | ||||
-rw-r--r-- | tests/auto/qmake/testdata/shadow_files_build/README | 2 | ||||
-rw-r--r-- | tests/auto/qmake/tst_qmake.cpp | 18 |
4 files changed, 44 insertions, 102 deletions
diff --git a/tests/auto/qmake/testcompiler.cpp b/tests/auto/qmake/testcompiler.cpp index c25b851847..b518da808e 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 12d8878ad5..90f7fea155 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 46017fc43e..15e48c043e 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 884a2c4abf..07389e9531 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() |