From 1cacf1e70d01cc989d973739ce4d5c7f00c5068c Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 18 Nov 2014 14:57:21 +0100 Subject: [PATCH] more autotests for spaces, destdirs and library linking Change-Id: Ie106d1151e61a50081bccea0a6d0d70728451a5b Reviewed-by: Joerg Bornemann --- .../quotedfilenames/include folder/header.h | 1 + .../qmake/testdata/quotedfilenames/main.cpp | 2 +- .../quotedfilenames/quotedfilenames.pro | 6 ++- .../qmake/testdata/simple_app/simple_app.pro | 4 +- .../qmake/testdata/simple_dll/simple_dll.pro | 4 +- .../qmake/testdata/simple_lib/simple_lib.pro | 4 +- .../testdata/subdirs/simple_app/main.cpp | 3 +- .../subdirs/simple_app/simple_app.pro | 7 ++- .../testdata/subdirs/simple_dll/simple.h | 9 +++- .../subdirs/simple_dll/simple_dll.pro | 6 +-- .../tools/qmake/testdata/subdirs/subdirs.pro | 4 +- tests/auto/tools/qmake/tst_qmake.cpp | 43 +++++++++++-------- 12 files changed, 56 insertions(+), 37 deletions(-) create mode 100644 tests/auto/tools/qmake/testdata/quotedfilenames/include folder/header.h diff --git a/tests/auto/tools/qmake/testdata/quotedfilenames/include folder/header.h b/tests/auto/tools/qmake/testdata/quotedfilenames/include folder/header.h new file mode 100644 index 0000000000..595c0cac3c --- /dev/null +++ b/tests/auto/tools/qmake/testdata/quotedfilenames/include folder/header.h @@ -0,0 +1 @@ +/* a random header file */ diff --git a/tests/auto/tools/qmake/testdata/quotedfilenames/main.cpp b/tests/auto/tools/qmake/testdata/quotedfilenames/main.cpp index 4cbb8f8b09..2a56d5b59b 100644 --- a/tests/auto/tools/qmake/testdata/quotedfilenames/main.cpp +++ b/tests/auto/tools/qmake/testdata/quotedfilenames/main.cpp @@ -31,7 +31,7 @@ ** ****************************************************************************/ - +#include #include diff --git a/tests/auto/tools/qmake/testdata/quotedfilenames/quotedfilenames.pro b/tests/auto/tools/qmake/testdata/quotedfilenames/quotedfilenames.pro index 61d6f38696..c4e0257769 100644 --- a/tests/auto/tools/qmake/testdata/quotedfilenames/quotedfilenames.pro +++ b/tests/auto/tools/qmake/testdata/quotedfilenames/quotedfilenames.pro @@ -2,8 +2,12 @@ TEMPLATE = app TARGET = quotedfilenames SOURCES = main.cpp +CONFIG += no_batch + +INCLUDEPATH += "include folder" + RCCINPUT = "rc folder/test.qrc" -RCCOUTPUT = test.cpp +RCCOUTPUT = "cpp folder/test.cpp" qtPrepareTool(QMAKE_RCC, rcc) diff --git a/tests/auto/tools/qmake/testdata/simple_app/simple_app.pro b/tests/auto/tools/qmake/testdata/simple_app/simple_app.pro index c57a1c877c..0e78a91f46 100644 --- a/tests/auto/tools/qmake/testdata/simple_app/simple_app.pro +++ b/tests/auto/tools/qmake/testdata/simple_app/simple_app.pro @@ -3,5 +3,5 @@ HEADERS = test_file.h SOURCES = test_file.cpp \ main.cpp RESOURCES = test.qrc -TARGET = simple_app -DESTDIR = ./ +TARGET = "simple app" +DESTDIR = "dest dir" diff --git a/tests/auto/tools/qmake/testdata/simple_dll/simple_dll.pro b/tests/auto/tools/qmake/testdata/simple_dll/simple_dll.pro index f589d2b3d4..c427309b2a 100644 --- a/tests/auto/tools/qmake/testdata/simple_dll/simple_dll.pro +++ b/tests/auto/tools/qmake/testdata/simple_dll/simple_dll.pro @@ -10,5 +10,5 @@ VERSION = 1.0.0 INCLUDEPATH += . tmp MOC_DIR = tmp OBJECTS_DIR = tmp -TARGET = simple_dll -DESTDIR = ./ +TARGET = "simple dll" +DESTDIR = "dest dir" diff --git a/tests/auto/tools/qmake/testdata/simple_lib/simple_lib.pro b/tests/auto/tools/qmake/testdata/simple_lib/simple_lib.pro index 9abc3e9f26..cd6c7dd7f9 100644 --- a/tests/auto/tools/qmake/testdata/simple_lib/simple_lib.pro +++ b/tests/auto/tools/qmake/testdata/simple_lib/simple_lib.pro @@ -9,5 +9,5 @@ VERSION = 1.0.0 INCLUDEPATH += . tmp MOC_DIR = tmp OBJECTS_DIR = tmp -TARGET = simple_lib -DESTDIR = ./ +TARGET = "simple lib" +DESTDIR = "dest dir" diff --git a/tests/auto/tools/qmake/testdata/subdirs/simple_app/main.cpp b/tests/auto/tools/qmake/testdata/subdirs/simple_app/main.cpp index 332dde7e2f..3bc36acdb0 100644 --- a/tests/auto/tools/qmake/testdata/subdirs/simple_app/main.cpp +++ b/tests/auto/tools/qmake/testdata/subdirs/simple_app/main.cpp @@ -31,7 +31,7 @@ ** ****************************************************************************/ - +#include #include "test_file.h" #include @@ -39,6 +39,7 @@ int main( int argc, char **argv ) { QGuiApplication a( argc, argv ); + Simple s; SomeObject sc; return a.exec(); } diff --git a/tests/auto/tools/qmake/testdata/subdirs/simple_app/simple_app.pro b/tests/auto/tools/qmake/testdata/subdirs/simple_app/simple_app.pro index d63f1d4362..e882c33b3d 100644 --- a/tests/auto/tools/qmake/testdata/subdirs/simple_app/simple_app.pro +++ b/tests/auto/tools/qmake/testdata/subdirs/simple_app/simple_app.pro @@ -2,5 +2,8 @@ TEMPLATE = app HEADERS = test_file.h SOURCES = test_file.cpp \ main.cpp -TARGET = simple_app -DESTDIR = ./ +TARGET = "simple app" +DESTDIR = "dest dir" + +INCLUDEPATH += ../simple_dll +LIBS += -L"../simple_dll/dest dir" -l"simple dll" diff --git a/tests/auto/tools/qmake/testdata/subdirs/simple_dll/simple.h b/tests/auto/tools/qmake/testdata/subdirs/simple_dll/simple.h index d7e5f48730..e24df46f42 100644 --- a/tests/auto/tools/qmake/testdata/subdirs/simple_dll/simple.h +++ b/tests/auto/tools/qmake/testdata/subdirs/simple_dll/simple.h @@ -35,8 +35,13 @@ #include -//class SIMPLEDLL_EXPORT Simple -class Simple +#ifdef SIMPLEDLL_MAKEDLL +# define SIMPLEDLL_EXPORT Q_DECL_EXPORT +#else +# define SIMPLEDLL_EXPORT Q_DECL_IMPORT +#endif + +class SIMPLEDLL_EXPORT Simple { public: Simple(); diff --git a/tests/auto/tools/qmake/testdata/subdirs/simple_dll/simple_dll.pro b/tests/auto/tools/qmake/testdata/subdirs/simple_dll/simple_dll.pro index f589d2b3d4..4e362bb918 100644 --- a/tests/auto/tools/qmake/testdata/subdirs/simple_dll/simple_dll.pro +++ b/tests/auto/tools/qmake/testdata/subdirs/simple_dll/simple_dll.pro @@ -1,7 +1,7 @@ TEMPLATE = lib CONFIG += dll -win32:DEFINES += SIMPLEDLL_MAKEDLL +DEFINES += SIMPLEDLL_MAKEDLL HEADERS = simple.h SOURCES = simple.cpp @@ -10,5 +10,5 @@ VERSION = 1.0.0 INCLUDEPATH += . tmp MOC_DIR = tmp OBJECTS_DIR = tmp -TARGET = simple_dll -DESTDIR = ./ +TARGET = "simple dll" +DESTDIR = "dest dir" diff --git a/tests/auto/tools/qmake/testdata/subdirs/subdirs.pro b/tests/auto/tools/qmake/testdata/subdirs/subdirs.pro index 5da200eabb..bc96812e6d 100644 --- a/tests/auto/tools/qmake/testdata/subdirs/subdirs.pro +++ b/tests/auto/tools/qmake/testdata/subdirs/subdirs.pro @@ -1,6 +1,6 @@ TEMPLATE = subdirs -SUBDIRS = simple_app \ - simple_dll +SUBDIRS = simple_dll \ + simple_app CONFIG += ordered diff --git a/tests/auto/tools/qmake/tst_qmake.cpp b/tests/auto/tools/qmake/tst_qmake.cpp index 6f52ffb9aa..8d7f7bbc68 100644 --- a/tests/auto/tools/qmake/tst_qmake.cpp +++ b/tests/auto/tools/qmake/tst_qmake.cpp @@ -141,14 +141,15 @@ void tst_qmake::cleanup() void tst_qmake::simple_app() { QString workDir = base_path + "/testdata/simple_app"; + QString destDir = workDir + "/dest dir"; QVERIFY( test_compiler.qmake( workDir, "simple_app" )); 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.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.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 ) ); } @@ -156,14 +157,15 @@ void tst_qmake::simple_app_shadowbuild() { QString workDir = base_path + "/testdata/simple_app"; QString buildDir = base_path + "/testdata/simple_app_build"; + QString destDir = buildDir + "/dest dir"; QVERIFY( test_compiler.qmake( workDir, "simple_app", 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.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.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 ) ); } @@ -171,46 +173,49 @@ void tst_qmake::simple_app_shadowbuild2() { QString workDir = base_path + "/testdata/simple_app"; QString buildDir = base_path + "/testdata/simple_app/build"; + QString destDir = buildDir + "/dest dir"; QVERIFY( test_compiler.qmake( workDir, "simple_app", 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.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.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 ) ); } void tst_qmake::simple_dll() { QString workDir = base_path + "/testdata/simple_dll"; + QString destDir = workDir + "/dest dir"; QDir D; D.remove( workDir + "/Makefile"); QVERIFY( test_compiler.qmake( workDir, "simple_dll" )); 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.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.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 ) ); } void tst_qmake::simple_lib() { QString workDir = base_path + "/testdata/simple_lib"; + QString destDir = workDir + "/dest dir"; QDir D; D.remove( workDir + "/Makefile"); QVERIFY( test_compiler.qmake( workDir, "simple_lib" )); 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.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.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 ) ); } @@ -223,12 +228,12 @@ void tst_qmake::subdirs() D.remove( workDir + "/simple_dll/Makefile"); QVERIFY( test_compiler.qmake( workDir, "subdirs" )); QVERIFY( test_compiler.make( workDir )); - QVERIFY( test_compiler.exists( workDir + "/simple_app", "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_app/dest dir", "simple app", Exe, "1.0.0" )); + QVERIFY( test_compiler.exists( workDir + "/simple_dll/dest dir", "simple dll", Dll, "1.0.0" )); QVERIFY( test_compiler.makeClean( workDir )); // 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_dll", "simple_dll", Dll, "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/dest dir", "simple dll", Dll, "1.0.0" )); // Since subdirs templates do not have a make dist clean, we should clean up ourselves // properly QVERIFY( test_compiler.makeDistClean( workDir ));