summaryrefslogtreecommitdiffstats
path: root/Tests/QtAutogenRerun
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2017-07-20 20:35:05 (GMT)
committerSebastian Holtermann <sebholt@xwmw.org>2017-07-21 15:03:40 (GMT)
commit0e434fcf0428f43dcc5f540ca0a61e078c9f4b4c (patch)
tree598fd1f91b2855d43064db6d5afb18687efaf155 /Tests/QtAutogenRerun
parentaf9708881f4c2d8f501ae63a4088c020edb6f070 (diff)
downloadCMake-0e434fcf0428f43dcc5f540ca0a61e078c9f4b4c.zip
CMake-0e434fcf0428f43dcc5f540ca0a61e078c9f4b4c.tar.gz
CMake-0e434fcf0428f43dcc5f540ca0a61e078c9f4b4c.tar.bz2
Autogen: Move repeated tests to new QtAutogenRerun test
By moving QtAutogen tests that run repeatedly to a new QtAutogenRerun test, the `ctest -R Qt[45]Autogen -j4` call runs approximately 25% faster.
Diffstat (limited to 'Tests/QtAutogenRerun')
-rw-r--r--Tests/QtAutogenRerun/CMakeLists.txt239
-rw-r--r--Tests/QtAutogenRerun/defines_test/CMakeLists.txt4
-rw-r--r--Tests/QtAutogenRerun/defines_test/defines_test.cpp38
-rw-r--r--Tests/QtAutogenRerun/dummy.cpp5
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/CMakeLists.txt33
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/StyleA.cpp6
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/StyleA.hpp17
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/StyleA.json1
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/StyleA_Custom.json1
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/StyleB.cpp6
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/StyleB.hpp17
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/StyleC.cpp6
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/StyleC.hpp17
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/StyleCommon.hpp7
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/StyleD.cpp6
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/StyleD.hpp17
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/StyleE.cpp6
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/StyleE.hpp17
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleB.json1
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleB_Custom.json1
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleC.json1
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleD.json1
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/main.cpp6
-rw-r--r--Tests/QtAutogenRerun/mocRerun/CMakeLists.txt35
-rw-r--r--Tests/QtAutogenRerun/mocRerun/input.txt1
-rw-r--r--Tests/QtAutogenRerun/mocRerun/main.cpp.in18
-rw-r--r--Tests/QtAutogenRerun/mocRerun/res1.qrc5
-rw-r--r--Tests/QtAutogenRerun/mocRerun/test1a.h.in8
-rw-r--r--Tests/QtAutogenRerun/mocRerun/test1b.h.in7
-rw-r--r--Tests/QtAutogenRerun/rccDepends/CMakeLists.txt35
-rw-r--r--Tests/QtAutogenRerun/rccDepends/main.cpp5
-rw-r--r--Tests/QtAutogenRerun/rccDepends/res/input1.txt.in1
-rw-r--r--Tests/QtAutogenRerun/rccDepends/res/input2.txt.in1
-rw-r--r--Tests/QtAutogenRerun/rccDepends/res1a.qrc.in5
-rw-r--r--Tests/QtAutogenRerun/rccDepends/res1b.qrc.in6
-rw-r--r--Tests/QtAutogenRerun/rccDepends/res2a.qrc.in5
-rw-r--r--Tests/QtAutogenRerun/rccDepends/res2b.qrc.in6
37 files changed, 591 insertions, 0 deletions
diff --git a/Tests/QtAutogenRerun/CMakeLists.txt b/Tests/QtAutogenRerun/CMakeLists.txt
new file mode 100644
index 0000000..088025f
--- /dev/null
+++ b/Tests/QtAutogenRerun/CMakeLists.txt
@@ -0,0 +1,239 @@
+cmake_minimum_required(VERSION 3.9)
+cmake_policy(SET CMP0071 NEW)
+project(QtAutogenRerun)
+
+# Tell find_package(Qt5) where to find Qt.
+if(QT_QMAKE_EXECUTABLE)
+ get_filename_component(Qt_BIN_DIR "${QT_QMAKE_EXECUTABLE}" PATH)
+ get_filename_component(Qt_PREFIX_DIR "${Qt_BIN_DIR}" PATH)
+ set(CMAKE_PREFIX_PATH ${Qt_PREFIX_DIR})
+endif()
+
+if (QT_TEST_VERSION STREQUAL 4)
+ find_package(Qt4 REQUIRED)
+
+ # Include this directory before using the UseQt4 file.
+ add_subdirectory(defines_test)
+
+ include(UseQt4)
+
+ set(QT_QTCORE_TARGET Qt4::QtCore)
+
+else()
+ if (NOT QT_TEST_VERSION STREQUAL 5)
+ message(SEND_ERROR "Invalid Qt version specified.")
+ endif()
+ find_package(Qt5Widgets REQUIRED)
+
+ set(QT_QTCORE_TARGET Qt5::Core)
+
+ include_directories(${Qt5Widgets_INCLUDE_DIRS})
+ set(QT_LIBRARIES Qt5::Widgets)
+
+ if(Qt5_POSITION_INDEPENDENT_CODE AND CMAKE_CXX_COMPILE_OPTIONS_PIC)
+ add_definitions(${CMAKE_CXX_COMPILE_OPTIONS_PIC})
+ endif()
+
+endif()
+
+# -- Test
+# Dummy test to generate clean target
+add_executable(dummy dummy.cpp)
+
+# -- Test
+# When a file listed in a .qrc file changes the target must be rebuilt
+set(timeformat "%Y%j%H%M%S")
+set(RCC_DEPENDS_SRC "${CMAKE_CURRENT_SOURCE_DIR}/rccDepends")
+set(RCC_DEPENDS_BIN "${CMAKE_CURRENT_BINARY_DIR}/rccDepends")
+configure_file(${RCC_DEPENDS_SRC}/res1a.qrc.in ${RCC_DEPENDS_BIN}/res1.qrc COPYONLY)
+configure_file(${RCC_DEPENDS_SRC}/res2a.qrc.in ${RCC_DEPENDS_BIN}/res2.qrc.in COPYONLY)
+try_compile(RCC_DEPENDS
+ "${RCC_DEPENDS_BIN}"
+ "${RCC_DEPENDS_SRC}"
+ rccDepends
+ CMAKE_FLAGS "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
+ "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
+ "-DCMAKE_PREFIX_PATH=${Qt_PREFIX_DIR}"
+ OUTPUT_VARIABLE output
+)
+if (NOT RCC_DEPENDS)
+ message(SEND_ERROR "Initial build of rccDepends failed. Output: ${output}")
+endif()
+# Get name and timestamp of the output binary
+file(STRINGS "${RCC_DEPENDS_BIN}/target.txt" targetList ENCODING UTF-8)
+list(GET targetList 0 rccDependsBin)
+file(TIMESTAMP "${rccDependsBin}" timeBegin "${timeformat}")
+# Sleep, touch regular qrc input file, rebuild and compare timestamp
+execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change.
+execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${RCC_DEPENDS_BIN}/res1/input.txt")
+execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${RCC_DEPENDS_BIN}" RESULT_VARIABLE result)
+if (result)
+ message(SEND_ERROR "Second build of rccDepends failed.")
+endif()
+file(TIMESTAMP "${rccDependsBin}" timeStep1 "${timeformat}")
+if (NOT timeStep1 GREATER timeBegin)
+ message(SEND_ERROR "File (${rccDependsBin}) should have changed in the first step!")
+endif()
+# Sleep, update regular qrc file, rebuild and compare timestamp
+execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change.
+configure_file(${RCC_DEPENDS_SRC}/res1b.qrc.in ${RCC_DEPENDS_BIN}/res1.qrc COPYONLY)
+execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${RCC_DEPENDS_BIN}" RESULT_VARIABLE result)
+if (result)
+ message(SEND_ERROR "Third build of rccDepends failed.")
+endif()
+file(TIMESTAMP "${rccDependsBin}" timeStep2 "${timeformat}")
+if (NOT timeStep2 GREATER timeStep1)
+ message(SEND_ERROR "File (${rccDependsBin}) should have changed in the second step!")
+endif()
+# Sleep, touch regular qrc newly added input file, rebuild and compare timestamp
+execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change.
+execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${RCC_DEPENDS_BIN}/res1/inputAdded.txt")
+execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${RCC_DEPENDS_BIN}" RESULT_VARIABLE result)
+if (result)
+ message(SEND_ERROR "Fourth build of rccDepends failed.")
+endif()
+file(TIMESTAMP "${rccDependsBin}" timeStep3 "${timeformat}")
+if (NOT timeStep3 GREATER timeStep2)
+ message(SEND_ERROR "File (${rccDependsBin}) should have changed in the third step!")
+endif()
+# Sleep, touch generated qrc input file, rebuild and compare timestamp
+execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change.
+execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${RCC_DEPENDS_BIN}/res2/input.txt")
+execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${RCC_DEPENDS_BIN}" RESULT_VARIABLE result)
+if (result)
+ message(SEND_ERROR "Fifth build of rccDepends failed.")
+endif()
+file(TIMESTAMP "${rccDependsBin}" timeStep4 "${timeformat}")
+if (NOT timeStep4 GREATER timeStep3)
+ message(SEND_ERROR "File (${rccDependsBin}) should have changed in the fourth step!")
+endif()
+# Sleep, update generated qrc file, rebuild and compare timestamp
+execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change.
+configure_file(${RCC_DEPENDS_SRC}/res2b.qrc.in ${RCC_DEPENDS_BIN}/res2.qrc.in COPYONLY)
+execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${RCC_DEPENDS_BIN}" RESULT_VARIABLE result)
+if (result)
+ message(SEND_ERROR "Sixth build of rccDepends failed.")
+endif()
+file(TIMESTAMP "${rccDependsBin}" timeStep5 "${timeformat}")
+if (NOT timeStep5 GREATER timeStep4)
+ message(SEND_ERROR "File (${rccDependsBin}) should have changed in the fitfh step!")
+endif()
+# Sleep, touch generated qrc newly added input file, rebuild and compare timestamp
+execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change.
+execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${RCC_DEPENDS_BIN}/res2/inputAdded.txt")
+execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${RCC_DEPENDS_BIN}" RESULT_VARIABLE result)
+if (result)
+ message(SEND_ERROR "Seventh build of rccDepends failed.")
+endif()
+file(TIMESTAMP "${rccDependsBin}" timeStep6 "${timeformat}")
+if (NOT timeStep6 GREATER timeStep5)
+ message(SEND_ERROR "File (${rccDependsBin}) should have changed in the sixth step!")
+endif()
+
+
+# -- Test
+# Ensure a repeated build succeeds when a header containing a QObject changes
+set(timeformat "%Y%j%H%M%S")
+configure_file(mocRerun/test1a.h.in mocRerun/test1.h COPYONLY)
+try_compile(MOC_RERUN
+ "${CMAKE_CURRENT_BINARY_DIR}/mocRerun"
+ "${CMAKE_CURRENT_SOURCE_DIR}/mocRerun"
+ mocRerun
+ CMAKE_FLAGS "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
+ "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
+ "-DCMAKE_PREFIX_PATH=${Qt_PREFIX_DIR}"
+ OUTPUT_VARIABLE output
+)
+if (NOT MOC_RERUN)
+ message(SEND_ERROR "Initial build of mocRerun failed. Output: ${output}")
+endif()
+# Get name and timestamp of the output binary
+file(STRINGS "${CMAKE_CURRENT_BINARY_DIR}/mocRerun/target1.txt" target1List ENCODING UTF-8)
+list(GET target1List 0 binFile)
+file(TIMESTAMP "${binFile}" timeBegin "${timeformat}")
+# Change file content and rebuild
+execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+configure_file(mocRerun/test1b.h.in mocRerun/test1.h COPYONLY)
+execute_process(COMMAND "${CMAKE_COMMAND}" --build .
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/mocRerun"
+ RESULT_VARIABLE mocRerun_result
+ )
+if (mocRerun_result)
+ message(SEND_ERROR "Second build of mocRerun failed.")
+endif()
+# Compare timestamps
+file(TIMESTAMP "${binFile}" timeStep1 "${timeformat}")
+if (NOT timeStep1 GREATER timeBegin)
+ message(SEND_ERROR "File (${binFile}) should have changed in the first step!")
+endif()
+
+
+# -- Test
+# Tests Q_PLUGIN_METADATA json file change detection
+if (NOT QT_TEST_VERSION STREQUAL 4)
+ try_compile(MOC_PLUGIN
+ "${CMAKE_CURRENT_BINARY_DIR}/mocPlugin"
+ "${CMAKE_CURRENT_SOURCE_DIR}/mocPlugin"
+ mocPlugin
+ CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
+ "-DCMAKE_PREFIX_PATH=${Qt_PREFIX_DIR}"
+ OUTPUT_VARIABLE output
+ )
+ if (NOT MOC_PLUGIN)
+ message(SEND_ERROR "Initial build of mocPlugin failed. Output: ${output}")
+ endif()
+
+ set(timeformat "%Y%j%H%M%S")
+ set(mocPlugSrcDir "${CMAKE_CURRENT_SOURCE_DIR}/mocPlugin")
+ set(mocPlugBinDir "${CMAKE_CURRENT_BINARY_DIR}/mocPlugin")
+ find_library(plAFile "PlugA" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH)
+ find_library(plBFile "PlugB" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH)
+ find_library(plCFile "PlugC" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH)
+ find_library(plDFile "PlugD" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH)
+
+ file(TIMESTAMP "${plAFile}" plABefore "${timeformat}")
+ file(TIMESTAMP "${plBFile}" plBBefore "${timeformat}")
+ file(TIMESTAMP "${plCFile}" plCBefore "${timeformat}")
+ file(TIMESTAMP "${plDFile}" plDBefore "${timeformat}")
+
+ # Ensure that the timestamp will change and change the json files
+ execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+ configure_file("${mocPlugSrcDir}/jsonIn/StyleD.json" "${mocPlugBinDir}/jsonFiles/StyleC.json")
+ configure_file("${mocPlugSrcDir}/jsonIn/StyleC.json" "${mocPlugBinDir}/jsonFiles/sub/StyleD.json")
+ execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocPlugBinDir}")
+
+ file(TIMESTAMP "${plAFile}" plAAfter "${timeformat}")
+ file(TIMESTAMP "${plBFile}" plBAfter "${timeformat}")
+ file(TIMESTAMP "${plCFile}" plCAfter "${timeformat}")
+ file(TIMESTAMP "${plDFile}" plDAfter "${timeformat}")
+
+ if (plAAfter GREATER plABefore)
+ message(SEND_ERROR "file (${plAFile}) should not have changed!")
+ endif()
+ if (plBAfter GREATER plBBefore)
+ message(SEND_ERROR "file (${plBFile}) should not have changed!")
+ endif()
+ if (NOT plCAfter GREATER plCBefore)
+ message(SEND_ERROR "file (${plCFile}) should have changed!")
+ endif()
+ if (NOT plDAfter GREATER plDBefore)
+ message(SEND_ERROR "file (${plDFile}) should have changed!")
+ endif()
+
+ # Test custom macro
+ file(TIMESTAMP "${plCFile}" plCBefore "${timeformat}")
+ file(TIMESTAMP "${plDFile}" plDBefore "${timeformat}")
+ execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+ configure_file("${mocPlugSrcDir}/jsonIn/StyleD.json" "${mocPlugBinDir}/jsonFiles/StyleC_Custom.json")
+ configure_file("${mocPlugSrcDir}/jsonIn/StyleC.json" "${mocPlugBinDir}/jsonFiles/sub/StyleD_Custom.json")
+ execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocPlugBinDir}")
+ file(TIMESTAMP "${plCFile}" plCAfter "${timeformat}")
+ file(TIMESTAMP "${plDFile}" plDAfter "${timeformat}")
+ if (NOT plCAfter GREATER plCBefore)
+ message(SEND_ERROR "file (${plCFile}) should have changed!")
+ endif()
+ if (NOT plDAfter GREATER plDBefore)
+ message(SEND_ERROR "file (${plDFile}) should have changed!")
+ endif()
+
+endif()
diff --git a/Tests/QtAutogenRerun/defines_test/CMakeLists.txt b/Tests/QtAutogenRerun/defines_test/CMakeLists.txt
new file mode 100644
index 0000000..9ee9a22
--- /dev/null
+++ b/Tests/QtAutogenRerun/defines_test/CMakeLists.txt
@@ -0,0 +1,4 @@
+
+add_executable(defines_test defines_test.cpp)
+set_target_properties(defines_test PROPERTIES AUTOMOC TRUE)
+target_link_libraries(defines_test Qt4::QtGui)
diff --git a/Tests/QtAutogenRerun/defines_test/defines_test.cpp b/Tests/QtAutogenRerun/defines_test/defines_test.cpp
new file mode 100644
index 0000000..cf4e9cb
--- /dev/null
+++ b/Tests/QtAutogenRerun/defines_test/defines_test.cpp
@@ -0,0 +1,38 @@
+
+#include <QObject>
+
+#ifdef QT_GUI_LIB
+#include <QTextDocument>
+
+class SomeDocument : public QTextDocument
+{
+ Q_OBJECT
+
+Q_SIGNALS:
+ void someSig();
+};
+#endif
+
+#ifdef QT_CORE_LIB
+class SomeObject : public QObject
+{
+ Q_OBJECT
+
+Q_SIGNALS:
+ void someSig();
+};
+#endif
+
+int main(int argc, char** argv)
+{
+#ifdef QT_CORE_LIB
+ QMetaObject sosmo = SomeObject::staticMetaObject;
+#endif
+#ifdef QT_GUI_LIB
+ QMetaObject sdsmo = SomeDocument::staticMetaObject;
+#endif
+
+ return 0;
+}
+
+#include "defines_test.moc"
diff --git a/Tests/QtAutogenRerun/dummy.cpp b/Tests/QtAutogenRerun/dummy.cpp
new file mode 100644
index 0000000..4837a76
--- /dev/null
+++ b/Tests/QtAutogenRerun/dummy.cpp
@@ -0,0 +1,5 @@
+
+int main(int argv, char** args)
+{
+ return 0;
+}
diff --git a/Tests/QtAutogenRerun/mocPlugin/CMakeLists.txt b/Tests/QtAutogenRerun/mocPlugin/CMakeLists.txt
new file mode 100644
index 0000000..9b224fb
--- /dev/null
+++ b/Tests/QtAutogenRerun/mocPlugin/CMakeLists.txt
@@ -0,0 +1,33 @@
+cmake_minimum_required(VERSION 3.9)
+project(mocPlugin CXX)
+
+set(CMAKE_AUTOMOC_DEPEND_FILTERS
+ "A_CUSTOM_MACRO"
+ "[\n][ \t]*A_CUSTOM_MACRO[ \t\r\n]*\\([^,]+,[ \t\r\n]*\"([^\"]+)\""
+ )
+
+if (NOT QT_TEST_VERSION STREQUAL 5)
+ message(SEND_ERROR "Invalid Qt version specified.")
+endif()
+find_package(Qt5Widgets REQUIRED)
+
+if(Qt5_POSITION_INDEPENDENT_CODE AND CMAKE_CXX_COMPILE_OPTIONS_PIC)
+ add_definitions(${CMAKE_CXX_COMPILE_OPTIONS_PIC})
+endif()
+
+configure_file(jsonIn/StyleC.json jsonFiles/StyleC.json)
+configure_file(jsonIn/StyleD.json jsonFiles/sub/StyleD.json)
+configure_file(jsonIn/StyleC.json jsonFiles/StyleC_Custom.json)
+configure_file(jsonIn/StyleD.json jsonFiles/sub/StyleD_Custom.json)
+
+# Enable automoc
+set(CMAKE_AUTOMOC TRUE)
+
+include_directories("${CMAKE_CURRENT_BINARY_DIR}/jsonFiles")
+link_libraries(Qt5::Widgets)
+
+add_library(PlugA STATIC StyleA.cpp)
+add_library(PlugB STATIC StyleB.cpp)
+add_library(PlugC STATIC StyleC.cpp)
+add_library(PlugD STATIC StyleD.cpp)
+add_library(PlugE STATIC StyleE.cpp)
diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleA.cpp b/Tests/QtAutogenRerun/mocPlugin/StyleA.cpp
new file mode 100644
index 0000000..b5e8753
--- /dev/null
+++ b/Tests/QtAutogenRerun/mocPlugin/StyleA.cpp
@@ -0,0 +1,6 @@
+#include "StyleA.hpp"
+
+QStyle* StyleA::create(const QString& key)
+{
+ return 0;
+}
diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleA.hpp b/Tests/QtAutogenRerun/mocPlugin/StyleA.hpp
new file mode 100644
index 0000000..1b6154d
--- /dev/null
+++ b/Tests/QtAutogenRerun/mocPlugin/StyleA.hpp
@@ -0,0 +1,17 @@
+#ifndef STYLEA_HPP
+#define STYLEA_HPP
+
+#include "StyleCommon.hpp"
+#include <QStylePlugin>
+
+class StyleA : public QStylePlugin
+{
+ Q_OBJECT
+ // Json file in local directory
+ Q_PLUGIN_METADATA(IID "org.styles.A" FILE "StyleA.json")
+ A_CUSTOM_MACRO(SomeArg, "StyleA_Custom.json", AnotherArg)
+public:
+ QStyle* create(const QString& key);
+};
+
+#endif
diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleA.json b/Tests/QtAutogenRerun/mocPlugin/StyleA.json
new file mode 100644
index 0000000..cc33953
--- /dev/null
+++ b/Tests/QtAutogenRerun/mocPlugin/StyleA.json
@@ -0,0 +1 @@
+{ "Keys": [ "Rocket", "Starbuster" ] }
diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleA_Custom.json b/Tests/QtAutogenRerun/mocPlugin/StyleA_Custom.json
new file mode 100644
index 0000000..cc33953
--- /dev/null
+++ b/Tests/QtAutogenRerun/mocPlugin/StyleA_Custom.json
@@ -0,0 +1 @@
+{ "Keys": [ "Rocket", "Starbuster" ] }
diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleB.cpp b/Tests/QtAutogenRerun/mocPlugin/StyleB.cpp
new file mode 100644
index 0000000..17d4400
--- /dev/null
+++ b/Tests/QtAutogenRerun/mocPlugin/StyleB.cpp
@@ -0,0 +1,6 @@
+#include "StyleB.hpp"
+
+QStyle* StyleB::create(const QString& key)
+{
+ return 0;
+}
diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleB.hpp b/Tests/QtAutogenRerun/mocPlugin/StyleB.hpp
new file mode 100644
index 0000000..163c9b2
--- /dev/null
+++ b/Tests/QtAutogenRerun/mocPlugin/StyleB.hpp
@@ -0,0 +1,17 @@
+#ifndef STYLEB_HPP
+#define STYLEB_HPP
+
+#include "StyleCommon.hpp"
+#include <QStylePlugin>
+
+class StyleB : public QStylePlugin
+{
+ Q_OBJECT
+ // Json file in local subdirectory
+ Q_PLUGIN_METADATA(IID "org.styles.B" FILE "jsonIn/StyleB.json")
+ A_CUSTOM_MACRO(SomeArg, "jsonIn/StyleB_Custom.json", AnotherArg)
+public:
+ QStyle* create(const QString& key);
+};
+
+#endif
diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleC.cpp b/Tests/QtAutogenRerun/mocPlugin/StyleC.cpp
new file mode 100644
index 0000000..37e7564
--- /dev/null
+++ b/Tests/QtAutogenRerun/mocPlugin/StyleC.cpp
@@ -0,0 +1,6 @@
+#include "StyleC.hpp"
+
+QStyle* StyleC::create(const QString& key)
+{
+ return 0;
+}
diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleC.hpp b/Tests/QtAutogenRerun/mocPlugin/StyleC.hpp
new file mode 100644
index 0000000..52a887a
--- /dev/null
+++ b/Tests/QtAutogenRerun/mocPlugin/StyleC.hpp
@@ -0,0 +1,17 @@
+#ifndef STYLEC_HPP
+#define STYLEC_HPP
+
+#include "StyleCommon.hpp"
+#include <QStylePlugin>
+
+class StyleC : public QStylePlugin
+{
+ Q_OBJECT
+ // Json file in global root directory
+ Q_PLUGIN_METADATA(IID "org.styles.C" FILE "StyleC.json")
+ A_CUSTOM_MACRO(SomeArg, "StyleC_Custom.json", AnotherArg)
+public:
+ QStyle* create(const QString& key);
+};
+
+#endif
diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleCommon.hpp b/Tests/QtAutogenRerun/mocPlugin/StyleCommon.hpp
new file mode 100644
index 0000000..f1a7ec6
--- /dev/null
+++ b/Tests/QtAutogenRerun/mocPlugin/StyleCommon.hpp
@@ -0,0 +1,7 @@
+#ifndef STYLECOMMON_HPP
+#define STYLECOMMON_HPP
+
+// Empty test macro definition
+#define A_CUSTOM_MACRO(name, jsonFile, pluginRegistrations)
+
+#endif
diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleD.cpp b/Tests/QtAutogenRerun/mocPlugin/StyleD.cpp
new file mode 100644
index 0000000..7e4b121
--- /dev/null
+++ b/Tests/QtAutogenRerun/mocPlugin/StyleD.cpp
@@ -0,0 +1,6 @@
+#include "StyleD.hpp"
+
+QStyle* StyleD::create(const QString& key)
+{
+ return 0;
+}
diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleD.hpp b/Tests/QtAutogenRerun/mocPlugin/StyleD.hpp
new file mode 100644
index 0000000..df8a439
--- /dev/null
+++ b/Tests/QtAutogenRerun/mocPlugin/StyleD.hpp
@@ -0,0 +1,17 @@
+#ifndef STYLED_HPP
+#define STYLED_HPP
+
+#include "StyleCommon.hpp"
+#include <QStylePlugin>
+
+class StyleD : public QStylePlugin
+{
+ Q_OBJECT
+ // Json file in global sub director
+ Q_PLUGIN_METADATA(IID "org.styles.D" FILE "sub/StyleD.json")
+ A_CUSTOM_MACRO(SomeArg, "sub/StyleD_Custom.json", AnotherArg)
+public:
+ QStyle* create(const QString& key);
+};
+
+#endif
diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleE.cpp b/Tests/QtAutogenRerun/mocPlugin/StyleE.cpp
new file mode 100644
index 0000000..8fc9a7f
--- /dev/null
+++ b/Tests/QtAutogenRerun/mocPlugin/StyleE.cpp
@@ -0,0 +1,6 @@
+#include "StyleE.hpp"
+
+QStyle* StyleE::create(const QString& key)
+{
+ return 0;
+}
diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleE.hpp b/Tests/QtAutogenRerun/mocPlugin/StyleE.hpp
new file mode 100644
index 0000000..e7915a8
--- /dev/null
+++ b/Tests/QtAutogenRerun/mocPlugin/StyleE.hpp
@@ -0,0 +1,17 @@
+#ifndef STYLEE_HPP
+#define STYLEE_HPP
+
+#include "StyleCommon.hpp"
+#include <QStylePlugin>
+
+class StyleE : public QStylePlugin
+{
+ Q_OBJECT
+ // No Json file
+ Q_PLUGIN_METADATA(IID "org.styles.E")
+ A_CUSTOM_MACRO(SomeArg, InvalidFileArg, AnotherArg)
+public:
+ QStyle* create(const QString& key);
+};
+
+#endif
diff --git a/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleB.json b/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleB.json
new file mode 100644
index 0000000..129cac4
--- /dev/null
+++ b/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleB.json
@@ -0,0 +1 @@
+{ "Keys": [ "Rocket", "StarbusterB" ] }
diff --git a/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleB_Custom.json b/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleB_Custom.json
new file mode 100644
index 0000000..129cac4
--- /dev/null
+++ b/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleB_Custom.json
@@ -0,0 +1 @@
+{ "Keys": [ "Rocket", "StarbusterB" ] }
diff --git a/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleC.json b/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleC.json
new file mode 100644
index 0000000..119aaa4
--- /dev/null
+++ b/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleC.json
@@ -0,0 +1 @@
+{ "Keys": [ "Boat", "Ship" ] }
diff --git a/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleD.json b/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleD.json
new file mode 100644
index 0000000..732c547
--- /dev/null
+++ b/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleD.json
@@ -0,0 +1 @@
+{ "Keys": [ "Bike", "Car" ] }
diff --git a/Tests/QtAutogenRerun/mocPlugin/main.cpp b/Tests/QtAutogenRerun/mocPlugin/main.cpp
new file mode 100644
index 0000000..3ba2ddc
--- /dev/null
+++ b/Tests/QtAutogenRerun/mocPlugin/main.cpp
@@ -0,0 +1,6 @@
+#include "StyleA.hpp"
+
+int main(int argv, char** args)
+{
+ return 0;
+}
diff --git a/Tests/QtAutogenRerun/mocRerun/CMakeLists.txt b/Tests/QtAutogenRerun/mocRerun/CMakeLists.txt
new file mode 100644
index 0000000..7380bdd
--- /dev/null
+++ b/Tests/QtAutogenRerun/mocRerun/CMakeLists.txt
@@ -0,0 +1,35 @@
+cmake_minimum_required(VERSION 3.9)
+cmake_policy(SET CMP0071 NEW)
+project(mocRerun CXX)
+
+if (QT_TEST_VERSION STREQUAL 4)
+ find_package(Qt4 REQUIRED)
+ set(QT_CORE_TARGET Qt4::QtCore)
+else()
+ if (NOT QT_TEST_VERSION STREQUAL 5)
+ message(SEND_ERROR "Invalid Qt version specified.")
+ endif()
+
+ find_package(Qt5Core REQUIRED)
+ set(QT_CORE_TARGET Qt5::Core)
+endif()
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+
+# Generated source file
+add_custom_command(OUTPUT main.cpp
+ COMMAND ${CMAKE_COMMAND} -E sleep 2
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/main.cpp
+ )
+
+add_executable(mocRerun
+ ${CMAKE_CURRENT_BINARY_DIR}/test1.h
+ ${CMAKE_CURRENT_BINARY_DIR}/main.cpp
+ res1.qrc
+ )
+target_include_directories(mocRerun PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
+target_link_libraries(mocRerun ${QT_CORE_TARGET})
+# Write target name to text file
+add_custom_command(TARGET mocRerun POST_BUILD COMMAND
+ ${CMAKE_COMMAND} -E echo "$<TARGET_FILE:mocRerun>" > target1.txt)
diff --git a/Tests/QtAutogenRerun/mocRerun/input.txt b/Tests/QtAutogenRerun/mocRerun/input.txt
new file mode 100644
index 0000000..da62762
--- /dev/null
+++ b/Tests/QtAutogenRerun/mocRerun/input.txt
@@ -0,0 +1 @@
+Res1 input.
diff --git a/Tests/QtAutogenRerun/mocRerun/main.cpp.in b/Tests/QtAutogenRerun/mocRerun/main.cpp.in
new file mode 100644
index 0000000..b37ff61
--- /dev/null
+++ b/Tests/QtAutogenRerun/mocRerun/main.cpp.in
@@ -0,0 +1,18 @@
+#include "test1.h"
+
+class Test2 : public QObject
+{
+ Q_OBJECT
+public slots:
+ void onTst1() {}
+};
+
+int main()
+{
+ Test1 test1;
+ Test2 test2;
+
+ return 0;
+}
+
+#include "main.moc"
diff --git a/Tests/QtAutogenRerun/mocRerun/res1.qrc b/Tests/QtAutogenRerun/mocRerun/res1.qrc
new file mode 100644
index 0000000..fb804b5
--- /dev/null
+++ b/Tests/QtAutogenRerun/mocRerun/res1.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>input.txt</file>
+ </qresource>
+</RCC>
diff --git a/Tests/QtAutogenRerun/mocRerun/test1a.h.in b/Tests/QtAutogenRerun/mocRerun/test1a.h.in
new file mode 100644
index 0000000..a335046
--- /dev/null
+++ b/Tests/QtAutogenRerun/mocRerun/test1a.h.in
@@ -0,0 +1,8 @@
+#include <QObject>
+class Test1 : public QObject
+{
+ Q_OBJECT
+public slots:
+ void onTst1() {}
+ void onTst2() {}
+};
diff --git a/Tests/QtAutogenRerun/mocRerun/test1b.h.in b/Tests/QtAutogenRerun/mocRerun/test1b.h.in
new file mode 100644
index 0000000..6128eeb
--- /dev/null
+++ b/Tests/QtAutogenRerun/mocRerun/test1b.h.in
@@ -0,0 +1,7 @@
+#include <QObject>
+class Test1 : public QObject
+{
+ Q_OBJECT
+public slots:
+ void onTst1() {}
+};
diff --git a/Tests/QtAutogenRerun/rccDepends/CMakeLists.txt b/Tests/QtAutogenRerun/rccDepends/CMakeLists.txt
new file mode 100644
index 0000000..edc0ac3
--- /dev/null
+++ b/Tests/QtAutogenRerun/rccDepends/CMakeLists.txt
@@ -0,0 +1,35 @@
+cmake_minimum_required(VERSION 3.9)
+project(rccDepends CXX)
+
+set(CMAKE_AUTORCC ON)
+
+if (QT_TEST_VERSION STREQUAL 4)
+ find_package(Qt4 REQUIRED)
+ set(QT_CORE_TARGET Qt4::QtCore)
+else()
+ if (NOT QT_TEST_VERSION STREQUAL 5)
+ message(SEND_ERROR "Invalid Qt version specified.")
+ endif()
+
+ find_package(Qt5Core REQUIRED)
+ set(QT_CORE_TARGET Qt5::Core)
+endif()
+
+configure_file(res/input1.txt.in res1/input.txt COPYONLY)
+configure_file(res/input1.txt.in res1/inputAdded.txt COPYONLY)
+configure_file(res/input2.txt.in res2/input.txt COPYONLY)
+configure_file(res/input2.txt.in res2/inputAdded.txt COPYONLY)
+# Dependency generated qrc file
+add_custom_command(OUTPUT res2.qrc
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/res2.qrc.in
+ COMMAND ${CMAKE_COMMAND} -E sleep 2
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/res2.qrc.in ${CMAKE_CURRENT_BINARY_DIR}/res2.qrc
+ )
+
+add_executable(rccDepends
+ main.cpp
+ ${CMAKE_CURRENT_BINARY_DIR}/res1.qrc
+ ${CMAKE_CURRENT_BINARY_DIR}/res2.qrc )
+target_link_libraries(rccDepends ${QT_CORE_TARGET})
+add_custom_command(TARGET rccDepends POST_BUILD COMMAND
+ ${CMAKE_COMMAND} -E echo "$<TARGET_FILE:rccDepends>" > target.txt)
diff --git a/Tests/QtAutogenRerun/rccDepends/main.cpp b/Tests/QtAutogenRerun/rccDepends/main.cpp
new file mode 100644
index 0000000..766b775
--- /dev/null
+++ b/Tests/QtAutogenRerun/rccDepends/main.cpp
@@ -0,0 +1,5 @@
+
+int main()
+{
+ return 0;
+}
diff --git a/Tests/QtAutogenRerun/rccDepends/res/input1.txt.in b/Tests/QtAutogenRerun/rccDepends/res/input1.txt.in
new file mode 100644
index 0000000..da62762
--- /dev/null
+++ b/Tests/QtAutogenRerun/rccDepends/res/input1.txt.in
@@ -0,0 +1 @@
+Res1 input.
diff --git a/Tests/QtAutogenRerun/rccDepends/res/input2.txt.in b/Tests/QtAutogenRerun/rccDepends/res/input2.txt.in
new file mode 100644
index 0000000..08e14b7
--- /dev/null
+++ b/Tests/QtAutogenRerun/rccDepends/res/input2.txt.in
@@ -0,0 +1 @@
+Res2 input.
diff --git a/Tests/QtAutogenRerun/rccDepends/res1a.qrc.in b/Tests/QtAutogenRerun/rccDepends/res1a.qrc.in
new file mode 100644
index 0000000..d111ffb
--- /dev/null
+++ b/Tests/QtAutogenRerun/rccDepends/res1a.qrc.in
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/Texts1">
+ <file>res1/input.txt</file>
+ </qresource>
+</RCC>
diff --git a/Tests/QtAutogenRerun/rccDepends/res1b.qrc.in b/Tests/QtAutogenRerun/rccDepends/res1b.qrc.in
new file mode 100644
index 0000000..4cb3f04
--- /dev/null
+++ b/Tests/QtAutogenRerun/rccDepends/res1b.qrc.in
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/Texts1">
+ <file>res1/input.txt</file>
+ <file alias="Added">res1/inputAdded.txt</file>
+ </qresource>
+</RCC>
diff --git a/Tests/QtAutogenRerun/rccDepends/res2a.qrc.in b/Tests/QtAutogenRerun/rccDepends/res2a.qrc.in
new file mode 100644
index 0000000..19f34ac
--- /dev/null
+++ b/Tests/QtAutogenRerun/rccDepends/res2a.qrc.in
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/Texts2">
+ <file>res2/input.txt</file>
+ </qresource>
+</RCC>
diff --git a/Tests/QtAutogenRerun/rccDepends/res2b.qrc.in b/Tests/QtAutogenRerun/rccDepends/res2b.qrc.in
new file mode 100644
index 0000000..19e8ba1
--- /dev/null
+++ b/Tests/QtAutogenRerun/rccDepends/res2b.qrc.in
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/Texts2">
+ <file>res2/input.txt</file>
+ <file alias="Added">res2/inputAdded.txt</file>
+ </qresource>
+</RCC>