more autotests for spaces, destdirs and library linking

Change-Id: Ie106d1151e61a50081bccea0a6d0d70728451a5b
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
Oswald Buddenhagen 2014-11-18 14:57:21 +01:00
parent 70f8567429
commit 1cacf1e70d
12 changed files with 56 additions and 37 deletions

View File

@ -0,0 +1 @@
/* a random header file */

View File

@ -31,7 +31,7 @@
** **
****************************************************************************/ ****************************************************************************/
#include <header.h>
#include <qguiapplication.h> #include <qguiapplication.h>

View File

@ -2,8 +2,12 @@ TEMPLATE = app
TARGET = quotedfilenames TARGET = quotedfilenames
SOURCES = main.cpp SOURCES = main.cpp
CONFIG += no_batch
INCLUDEPATH += "include folder"
RCCINPUT = "rc folder/test.qrc" RCCINPUT = "rc folder/test.qrc"
RCCOUTPUT = test.cpp RCCOUTPUT = "cpp folder/test.cpp"
qtPrepareTool(QMAKE_RCC, rcc) qtPrepareTool(QMAKE_RCC, rcc)

View File

@ -3,5 +3,5 @@ HEADERS = test_file.h
SOURCES = test_file.cpp \ SOURCES = test_file.cpp \
main.cpp main.cpp
RESOURCES = test.qrc RESOURCES = test.qrc
TARGET = simple_app TARGET = "simple app"
DESTDIR = ./ DESTDIR = "dest dir"

View File

@ -10,5 +10,5 @@ VERSION = 1.0.0
INCLUDEPATH += . tmp INCLUDEPATH += . tmp
MOC_DIR = tmp MOC_DIR = tmp
OBJECTS_DIR = tmp OBJECTS_DIR = tmp
TARGET = simple_dll TARGET = "simple dll"
DESTDIR = ./ DESTDIR = "dest dir"

View File

@ -9,5 +9,5 @@ VERSION = 1.0.0
INCLUDEPATH += . tmp INCLUDEPATH += . tmp
MOC_DIR = tmp MOC_DIR = tmp
OBJECTS_DIR = tmp OBJECTS_DIR = tmp
TARGET = simple_lib TARGET = "simple lib"
DESTDIR = ./ DESTDIR = "dest dir"

View File

@ -31,7 +31,7 @@
** **
****************************************************************************/ ****************************************************************************/
#include <simple.h>
#include "test_file.h" #include "test_file.h"
#include <qguiapplication.h> #include <qguiapplication.h>
@ -39,6 +39,7 @@
int main( int argc, char **argv ) int main( int argc, char **argv )
{ {
QGuiApplication a( argc, argv ); QGuiApplication a( argc, argv );
Simple s;
SomeObject sc; SomeObject sc;
return a.exec(); return a.exec();
} }

View File

@ -2,5 +2,8 @@ TEMPLATE = app
HEADERS = test_file.h HEADERS = test_file.h
SOURCES = test_file.cpp \ SOURCES = test_file.cpp \
main.cpp main.cpp
TARGET = simple_app TARGET = "simple app"
DESTDIR = ./ DESTDIR = "dest dir"
INCLUDEPATH += ../simple_dll
LIBS += -L"../simple_dll/dest dir" -l"simple dll"

View File

@ -35,8 +35,13 @@
#include <qstring.h> #include <qstring.h>
//class SIMPLEDLL_EXPORT Simple #ifdef SIMPLEDLL_MAKEDLL
class Simple # define SIMPLEDLL_EXPORT Q_DECL_EXPORT
#else
# define SIMPLEDLL_EXPORT Q_DECL_IMPORT
#endif
class SIMPLEDLL_EXPORT Simple
{ {
public: public:
Simple(); Simple();

View File

@ -1,7 +1,7 @@
TEMPLATE = lib TEMPLATE = lib
CONFIG += dll CONFIG += dll
win32:DEFINES += SIMPLEDLL_MAKEDLL DEFINES += SIMPLEDLL_MAKEDLL
HEADERS = simple.h HEADERS = simple.h
SOURCES = simple.cpp SOURCES = simple.cpp
@ -10,5 +10,5 @@ VERSION = 1.0.0
INCLUDEPATH += . tmp INCLUDEPATH += . tmp
MOC_DIR = tmp MOC_DIR = tmp
OBJECTS_DIR = tmp OBJECTS_DIR = tmp
TARGET = simple_dll TARGET = "simple dll"
DESTDIR = ./ DESTDIR = "dest dir"

View File

@ -1,6 +1,6 @@
TEMPLATE = subdirs TEMPLATE = subdirs
SUBDIRS = simple_app \ SUBDIRS = simple_dll \
simple_dll simple_app
CONFIG += ordered CONFIG += ordered

View File

@ -141,14 +141,15 @@ void tst_qmake::cleanup()
void tst_qmake::simple_app() void tst_qmake::simple_app()
{ {
QString workDir = base_path + "/testdata/simple_app"; QString workDir = base_path + "/testdata/simple_app";
QString destDir = workDir + "/dest dir";
QVERIFY( test_compiler.qmake( workDir, "simple_app" )); QVERIFY( test_compiler.qmake( workDir, "simple_app" ));
QVERIFY( test_compiler.make( workDir )); QVERIFY( test_compiler.make( workDir ));
QVERIFY( test_compiler.exists( workDir, "simple_app", Exe, "1.0.0" )); QVERIFY( test_compiler.exists( destDir, "simple app", Exe, "1.0.0" ));
QVERIFY( test_compiler.makeClean( workDir )); QVERIFY( test_compiler.makeClean( workDir ));
QVERIFY( test_compiler.exists( workDir, "simple_app", Exe, "1.0.0" )); // Should still exist after a make clean QVERIFY( test_compiler.exists( destDir, "simple app", Exe, "1.0.0" )); // Should still exist after a make clean
QVERIFY( test_compiler.makeDistClean( workDir )); QVERIFY( test_compiler.makeDistClean( workDir ));
QVERIFY( !test_compiler.exists( workDir, "simple_app", Exe, "1.0.0" )); // Should not exist after a make distclean QVERIFY( !test_compiler.exists( destDir, "simple app", Exe, "1.0.0" )); // Should not exist after a make distclean
QVERIFY( test_compiler.removeMakefile( workDir ) ); QVERIFY( test_compiler.removeMakefile( workDir ) );
} }
@ -156,14 +157,15 @@ void tst_qmake::simple_app_shadowbuild()
{ {
QString workDir = base_path + "/testdata/simple_app"; QString workDir = base_path + "/testdata/simple_app";
QString buildDir = base_path + "/testdata/simple_app_build"; QString buildDir = base_path + "/testdata/simple_app_build";
QString destDir = buildDir + "/dest dir";
QVERIFY( test_compiler.qmake( workDir, "simple_app", buildDir )); QVERIFY( test_compiler.qmake( workDir, "simple_app", buildDir ));
QVERIFY( test_compiler.make( buildDir )); QVERIFY( test_compiler.make( buildDir ));
QVERIFY( test_compiler.exists( buildDir, "simple_app", Exe, "1.0.0" )); QVERIFY( test_compiler.exists( destDir, "simple app", Exe, "1.0.0" ));
QVERIFY( test_compiler.makeClean( buildDir )); QVERIFY( test_compiler.makeClean( buildDir ));
QVERIFY( test_compiler.exists( buildDir, "simple_app", Exe, "1.0.0" )); // Should still exist after a make clean QVERIFY( test_compiler.exists( destDir, "simple app", Exe, "1.0.0" )); // Should still exist after a make clean
QVERIFY( test_compiler.makeDistClean( buildDir )); QVERIFY( test_compiler.makeDistClean( buildDir ));
QVERIFY( !test_compiler.exists( buildDir, "simple_app", Exe, "1.0.0" )); // Should not exist after a make distclean QVERIFY( !test_compiler.exists( destDir, "simple app", Exe, "1.0.0" )); // Should not exist after a make distclean
QVERIFY( test_compiler.removeMakefile( buildDir ) ); QVERIFY( test_compiler.removeMakefile( buildDir ) );
} }
@ -171,46 +173,49 @@ void tst_qmake::simple_app_shadowbuild2()
{ {
QString workDir = base_path + "/testdata/simple_app"; QString workDir = base_path + "/testdata/simple_app";
QString buildDir = base_path + "/testdata/simple_app/build"; QString buildDir = base_path + "/testdata/simple_app/build";
QString destDir = buildDir + "/dest dir";
QVERIFY( test_compiler.qmake( workDir, "simple_app", buildDir )); QVERIFY( test_compiler.qmake( workDir, "simple_app", buildDir ));
QVERIFY( test_compiler.make( buildDir )); QVERIFY( test_compiler.make( buildDir ));
QVERIFY( test_compiler.exists( buildDir, "simple_app", Exe, "1.0.0" )); QVERIFY( test_compiler.exists( destDir, "simple app", Exe, "1.0.0" ));
QVERIFY( test_compiler.makeClean( buildDir )); QVERIFY( test_compiler.makeClean( buildDir ));
QVERIFY( test_compiler.exists( buildDir, "simple_app", Exe, "1.0.0" )); // Should still exist after a make clean QVERIFY( test_compiler.exists( destDir, "simple app", Exe, "1.0.0" )); // Should still exist after a make clean
QVERIFY( test_compiler.makeDistClean( buildDir )); QVERIFY( test_compiler.makeDistClean( buildDir ));
QVERIFY( !test_compiler.exists( buildDir, "simple_app", Exe, "1.0.0" )); // Should not exist after a make distclean QVERIFY( !test_compiler.exists( destDir, "simple app", Exe, "1.0.0" )); // Should not exist after a make distclean
QVERIFY( test_compiler.removeMakefile( buildDir ) ); QVERIFY( test_compiler.removeMakefile( buildDir ) );
} }
void tst_qmake::simple_dll() void tst_qmake::simple_dll()
{ {
QString workDir = base_path + "/testdata/simple_dll"; QString workDir = base_path + "/testdata/simple_dll";
QString destDir = workDir + "/dest dir";
QDir D; QDir D;
D.remove( workDir + "/Makefile"); D.remove( workDir + "/Makefile");
QVERIFY( test_compiler.qmake( workDir, "simple_dll" )); QVERIFY( test_compiler.qmake( workDir, "simple_dll" ));
QVERIFY( test_compiler.make( workDir )); QVERIFY( test_compiler.make( workDir ));
QVERIFY( test_compiler.exists( workDir, "simple_dll", Dll, "1.0.0" )); QVERIFY( test_compiler.exists( destDir, "simple dll", Dll, "1.0.0" ));
QVERIFY( test_compiler.makeClean( workDir )); QVERIFY( test_compiler.makeClean( workDir ));
QVERIFY( test_compiler.exists( workDir, "simple_dll", Dll, "1.0.0" )); // Should still exist after a make clean QVERIFY( test_compiler.exists( destDir, "simple dll", Dll, "1.0.0" )); // Should still exist after a make clean
QVERIFY( test_compiler.makeDistClean( workDir )); QVERIFY( test_compiler.makeDistClean( workDir ));
QVERIFY( !test_compiler.exists( workDir, "simple_dll", Dll, "1.0.0" )); // Should not exist after a make distclean QVERIFY( !test_compiler.exists( destDir, "simple dll", Dll, "1.0.0" )); // Should not exist after a make distclean
QVERIFY( test_compiler.removeMakefile( workDir ) ); QVERIFY( test_compiler.removeMakefile( workDir ) );
} }
void tst_qmake::simple_lib() void tst_qmake::simple_lib()
{ {
QString workDir = base_path + "/testdata/simple_lib"; QString workDir = base_path + "/testdata/simple_lib";
QString destDir = workDir + "/dest dir";
QDir D; QDir D;
D.remove( workDir + "/Makefile"); D.remove( workDir + "/Makefile");
QVERIFY( test_compiler.qmake( workDir, "simple_lib" )); QVERIFY( test_compiler.qmake( workDir, "simple_lib" ));
QVERIFY( test_compiler.make( workDir )); QVERIFY( test_compiler.make( workDir ));
QVERIFY( test_compiler.exists( workDir, "simple_lib", Lib, "1.0.0" )); QVERIFY( test_compiler.exists( destDir, "simple lib", Lib, "1.0.0" ));
QVERIFY( test_compiler.makeClean( workDir )); QVERIFY( test_compiler.makeClean( workDir ));
QVERIFY( test_compiler.exists( workDir, "simple_lib", Lib, "1.0.0" )); // Should still exist after a make clean QVERIFY( test_compiler.exists( destDir, "simple lib", Lib, "1.0.0" )); // Should still exist after a make clean
QVERIFY( test_compiler.makeDistClean( workDir )); QVERIFY( test_compiler.makeDistClean( workDir ));
QVERIFY( !test_compiler.exists( workDir, "simple_lib", Lib, "1.0.0" )); // Should not exist after a make distclean QVERIFY( !test_compiler.exists( destDir, "simple lib", Lib, "1.0.0" )); // Should not exist after a make distclean
QVERIFY( test_compiler.removeMakefile( workDir ) ); QVERIFY( test_compiler.removeMakefile( workDir ) );
} }
@ -223,12 +228,12 @@ void tst_qmake::subdirs()
D.remove( workDir + "/simple_dll/Makefile"); D.remove( workDir + "/simple_dll/Makefile");
QVERIFY( test_compiler.qmake( workDir, "subdirs" )); QVERIFY( test_compiler.qmake( workDir, "subdirs" ));
QVERIFY( test_compiler.make( workDir )); QVERIFY( test_compiler.make( workDir ));
QVERIFY( test_compiler.exists( workDir + "/simple_app", "simple_app", Exe, "1.0.0" )); QVERIFY( test_compiler.exists( workDir + "/simple_app/dest dir", "simple app", Exe, "1.0.0" ));
QVERIFY( test_compiler.exists( workDir + "/simple_dll", "simple_dll", Dll, "1.0.0" )); QVERIFY( test_compiler.exists( workDir + "/simple_dll/dest dir", "simple dll", Dll, "1.0.0" ));
QVERIFY( test_compiler.makeClean( workDir )); QVERIFY( test_compiler.makeClean( workDir ));
// Should still exist after a make clean // Should still exist after a make clean
QVERIFY( test_compiler.exists( workDir + "/simple_app", "simple_app", Exe, "1.0.0" )); QVERIFY( test_compiler.exists( workDir + "/simple_app/dest dir", "simple app", Exe, "1.0.0" ));
QVERIFY( test_compiler.exists( workDir + "/simple_dll", "simple_dll", Dll, "1.0.0" )); QVERIFY( test_compiler.exists( workDir + "/simple_dll/dest dir", "simple dll", Dll, "1.0.0" ));
// Since subdirs templates do not have a make dist clean, we should clean up ourselves // Since subdirs templates do not have a make dist clean, we should clean up ourselves
// properly // properly
QVERIFY( test_compiler.makeDistClean( workDir )); QVERIFY( test_compiler.makeDistClean( workDir ));