summaryrefslogtreecommitdiffstats
path: root/tests/auto/qmake
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qmake')
-rw-r--r--tests/auto/qmake/testcompiler.cpp14
-rw-r--r--tests/auto/qmake/testcompiler.h4
-rw-r--r--tests/auto/qmake/testdata/bundle-spaces/some-file6
-rw-r--r--tests/auto/qmake/testdata/findDeps/findDeps.pro7
-rw-r--r--tests/auto/qmake/testdata/findMocs/findMocs.pro7
-rw-r--r--tests/auto/qmake/testdata/functions/functions.pro2
-rw-r--r--tests/auto/qmake/testdata/include_function/existing_file.pri3
-rw-r--r--tests/auto/qmake/testdata/include_function/include_existing_file.pro7
-rw-r--r--tests/auto/qmake/testdata/include_function/include_missing_file.pro3
-rw-r--r--tests/auto/qmake/testdata/include_function/include_missing_file2.pro3
-rw-r--r--tests/auto/qmake/testdata/include_function/main.cpp45
-rw-r--r--tests/auto/qmake/tst_qmake.cpp23
12 files changed, 113 insertions, 11 deletions
diff --git a/tests/auto/qmake/testcompiler.cpp b/tests/auto/qmake/testcompiler.cpp
index aaccf2df0e..75bef9c9e0 100644
--- a/tests/auto/qmake/testcompiler.cpp
+++ b/tests/auto/qmake/testcompiler.cpp
@@ -261,3 +261,17 @@ bool TestCompiler::removeMakefile( const QString &workPath )
else
return true;
}
+
+QString TestCompiler::commandOutput() const
+{
+#ifndef Q_OS_WIN
+ return testOutput_.join("\n");
+#else
+ return testOutput_.join("\r\n");
+#endif
+}
+
+void TestCompiler::clearCommandOutput()
+{
+ testOutput_.clear();
+}
diff --git a/tests/auto/qmake/testcompiler.h b/tests/auto/qmake/testcompiler.h
index c8835a92f6..a098fb8a3e 100644
--- a/tests/auto/qmake/testcompiler.h
+++ b/tests/auto/qmake/testcompiler.h
@@ -70,6 +70,10 @@ public:
bool exists( const QString &destDir, const QString &exeName, BuildType buildType, const QString &version );
// removes the makefile
bool removeMakefile( const QString &workPath );
+ // returns each line of stdout of the last command append with a "new line" character(s) to suit the platform
+ QString commandOutput() const;
+ // clear the results of storage of stdout for running previous commands
+ void clearCommandOutput();
private:
bool runCommand( QString cmdLine );
diff --git a/tests/auto/qmake/testdata/bundle-spaces/some-file b/tests/auto/qmake/testdata/bundle-spaces/some-file
index e69de29bb2..9975dba4ba 100644
--- a/tests/auto/qmake/testdata/bundle-spaces/some-file
+++ 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/findDeps/findDeps.pro b/tests/auto/qmake/testdata/findDeps/findDeps.pro
index e0a2b86422..43577b5122 100644
--- a/tests/auto/qmake/testdata/findDeps/findDeps.pro
+++ b/tests/auto/qmake/testdata/findDeps/findDeps.pro
@@ -1,11 +1,8 @@
-######################################################################
-# Automatically generated by qmake (2.01a) Thu Mar 12 11:08:20 2009
-######################################################################
-
TEMPLATE = app
-TARGET =
+TARGET = findDeps
DEPENDPATH += .
INCLUDEPATH += .
+DESTDIR = ./
# Input
HEADERS += object1.h \
diff --git a/tests/auto/qmake/testdata/findMocs/findMocs.pro b/tests/auto/qmake/testdata/findMocs/findMocs.pro
index daa3c7f269..1469b4c5c3 100644
--- a/tests/auto/qmake/testdata/findMocs/findMocs.pro
+++ b/tests/auto/qmake/testdata/findMocs/findMocs.pro
@@ -1,11 +1,8 @@
-######################################################################
-# Automatically generated by qmake (2.01a) Wed Mar 11 16:11:09 2009
-######################################################################
-
TEMPLATE = app
-TARGET =
+TARGET = findMocs
DEPENDPATH += .
INCLUDEPATH += .
+DESTDIR = ./
# Input
HEADERS += object1.h object2.h object3.h object4.h object5.h object6.h object7.h
diff --git a/tests/auto/qmake/testdata/functions/functions.pro b/tests/auto/qmake/testdata/functions/functions.pro
index 9ed92f960f..5e089e403f 100644
--- a/tests/auto/qmake/testdata/functions/functions.pro
+++ b/tests/auto/qmake/testdata/functions/functions.pro
@@ -46,7 +46,7 @@ isEmpty( CONFIG ) {
}
#include
-include( infiletest.pro )
+include( infiletest.pro, "", true )
!contains( DEFINES, QT_DLL ) {
message( "FAILED: include function: $$DEFINES" )
}
diff --git a/tests/auto/qmake/testdata/include_function/existing_file.pri b/tests/auto/qmake/testdata/include_function/existing_file.pri
new file mode 100644
index 0000000000..8b9aaca340
--- /dev/null
+++ b/tests/auto/qmake/testdata/include_function/existing_file.pri
@@ -0,0 +1,3 @@
+QT =
+CONFIG = console
+SOURCES = main.cpp
diff --git a/tests/auto/qmake/testdata/include_function/include_existing_file.pro b/tests/auto/qmake/testdata/include_function/include_existing_file.pro
new file mode 100644
index 0000000000..424062a9ac
--- /dev/null
+++ b/tests/auto/qmake/testdata/include_function/include_existing_file.pro
@@ -0,0 +1,7 @@
+# Test to see if include(), by default, succeeds when the specific file
+# to include exists
+include(existing_file.pri)
+
+# Test to see if by specifying full set of parameters to include()
+# succeeds when the specified filed to include exists
+include(existing_file.pri, "", false)
diff --git a/tests/auto/qmake/testdata/include_function/include_missing_file.pro b/tests/auto/qmake/testdata/include_function/include_missing_file.pro
new file mode 100644
index 0000000000..0b59981240
--- /dev/null
+++ b/tests/auto/qmake/testdata/include_function/include_missing_file.pro
@@ -0,0 +1,3 @@
+# Test to see if include(), by default, fails when the specific file
+# to include does not exist
+include(missing_file.pri)
diff --git a/tests/auto/qmake/testdata/include_function/include_missing_file2.pro b/tests/auto/qmake/testdata/include_function/include_missing_file2.pro
new file mode 100644
index 0000000000..542b9ff516
--- /dev/null
+++ b/tests/auto/qmake/testdata/include_function/include_missing_file2.pro
@@ -0,0 +1,3 @@
+# Specifying full set of parameters to include() to test that a warning
+# is shown for this non-existing file.
+include(missing_file.pri, "", false)
diff --git a/tests/auto/qmake/testdata/include_function/main.cpp b/tests/auto/qmake/testdata/include_function/main.cpp
new file mode 100644
index 0000000000..8afd427192
--- /dev/null
+++ b/tests/auto/qmake/testdata/include_function/main.cpp
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+int main(int /*argc*/, char ** /*argv*/)
+{
+ return 0;
+}
diff --git a/tests/auto/qmake/tst_qmake.cpp b/tests/auto/qmake/tst_qmake.cpp
index 524ed6bf53..4da47c3baf 100644
--- a/tests/auto/qmake/tst_qmake.cpp
+++ b/tests/auto/qmake/tst_qmake.cpp
@@ -88,6 +88,7 @@ private slots:
// Test requires make
void bundle_spaces();
#endif
+ void includefunction();
private:
TestCompiler test_compiler;
@@ -125,10 +126,12 @@ void tst_qmake::cleanupTestCase()
void tst_qmake::init()
{
+ test_compiler.clearCommandOutput();
}
void tst_qmake::cleanup()
{
+ test_compiler.clearCommandOutput();
}
void tst_qmake::simple_app()
@@ -438,6 +441,26 @@ void tst_qmake::bundle_spaces()
}
#endif // Q_OS_WIN
+void tst_qmake::includefunction()
+{
+ QString workDir = base_path + "/testdata/include_function";
+ QString warningMsg("Unable to find file for inclusion");
+ QVERIFY(test_compiler.qmake( workDir, "include_existing_file"));
+ QVERIFY(!test_compiler.commandOutput().contains(warningMsg));
+
+ // test include() usage on a missing file
+ test_compiler.clearCommandOutput();
+ workDir = base_path + "/testdata/include_function";
+ QVERIFY(test_compiler.qmake( workDir, "include_missing_file" ));
+ QVERIFY(test_compiler.commandOutput().contains(warningMsg));
+
+ // test include() usage on a missing file when all function parameters are used
+ test_compiler.clearCommandOutput();
+ workDir = base_path + "/testdata/include_function";
+ QVERIFY(test_compiler.qmake( workDir, "include_missing_file2" ));
+ QVERIFY(test_compiler.commandOutput().contains(warningMsg));
+}
+
QTEST_MAIN(tst_qmake)
#include "tst_qmake.moc"