From 61c433785eb918d81b927f17bcad4687f2269afe Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 18 Apr 2012 16:46:26 +0200 Subject: [PATCH] Move the CMake unit tests to auto/ This will allow the CI system to run the tests. The tests are only run if cmake is found. Change-Id: Ie73a56114c151871160bafcbf0b90b2d54620855 Reviewed-by: Oswald Buddenhagen Reviewed-by: Stephen Kelly Reviewed-by: Sergio Ahumada --- tests/auto/auto.pro | 1 + tests/{manual => auto}/cmake/CMakeLists.txt | 0 tests/auto/cmake/cmake.pro | 50 +++++++++++++++++++ .../cmake/fail4/CMakeLists.txt | 0 .../{manual => auto}/cmake/fail4/myobject.cpp | 0 tests/{manual => auto}/cmake/fail4/myobject.h | 0 tests/{manual => auto}/cmake/fail4/pass4.qrc | 0 .../cmake/fail4/resource_file.txt | 0 .../cmake/fail5/CMakeLists.txt | 0 .../{manual => auto}/cmake/fail5/myobject.cpp | 0 tests/{manual => auto}/cmake/fail5/myobject.h | 0 .../cmake/pass(needsquoting)6/CMakeLists.txt | 0 .../cmake/pass(needsquoting)6/mywidget.cpp | 0 .../cmake/pass(needsquoting)6/mywidget.h | 0 .../cmake/pass(needsquoting)6/mywidget.ui | 0 .../cmake/pass1/CMakeLists.txt | 0 tests/{manual => auto}/cmake/pass1/three.cpp | 0 tests/{manual => auto}/cmake/pass1/two.cpp | 0 .../cmake/pass2/CMakeLists.txt | 0 .../{manual => auto}/cmake/pass2/myobject.cpp | 0 tests/{manual => auto}/cmake/pass2/myobject.h | 0 tests/{manual => auto}/cmake/pass2/pass2.qrc | 0 .../cmake/pass2/resource_file.txt | 0 .../cmake/pass3/CMakeLists.txt | 0 .../{manual => auto}/cmake/pass3/mywidget.cpp | 0 tests/{manual => auto}/cmake/pass3/mywidget.h | 0 .../{manual => auto}/cmake/pass3/mywidget.ui | 0 .../cmake/pass7/CMakeLists.txt | 0 tests/{manual => auto}/cmake/pass7/main.cpp | 0 .../cmake/pass8/CMakeLists.txt | 0 .../{manual => auto}/cmake/pass8/myobject.cpp | 0 tests/{manual => auto}/cmake/pass8/myobject.h | 0 .../cmake/pass9/CMakeLists.txt | 0 .../cmake/pass9/mydbusobject.cpp | 0 .../cmake/pass9/mydbusobject.h | 0 35 files changed, 51 insertions(+) rename tests/{manual => auto}/cmake/CMakeLists.txt (100%) create mode 100644 tests/auto/cmake/cmake.pro rename tests/{manual => auto}/cmake/fail4/CMakeLists.txt (100%) rename tests/{manual => auto}/cmake/fail4/myobject.cpp (100%) rename tests/{manual => auto}/cmake/fail4/myobject.h (100%) rename tests/{manual => auto}/cmake/fail4/pass4.qrc (100%) rename tests/{manual => auto}/cmake/fail4/resource_file.txt (100%) rename tests/{manual => auto}/cmake/fail5/CMakeLists.txt (100%) rename tests/{manual => auto}/cmake/fail5/myobject.cpp (100%) rename tests/{manual => auto}/cmake/fail5/myobject.h (100%) rename tests/{manual => auto}/cmake/pass(needsquoting)6/CMakeLists.txt (100%) rename tests/{manual => auto}/cmake/pass(needsquoting)6/mywidget.cpp (100%) rename tests/{manual => auto}/cmake/pass(needsquoting)6/mywidget.h (100%) rename tests/{manual => auto}/cmake/pass(needsquoting)6/mywidget.ui (100%) rename tests/{manual => auto}/cmake/pass1/CMakeLists.txt (100%) rename tests/{manual => auto}/cmake/pass1/three.cpp (100%) rename tests/{manual => auto}/cmake/pass1/two.cpp (100%) rename tests/{manual => auto}/cmake/pass2/CMakeLists.txt (100%) rename tests/{manual => auto}/cmake/pass2/myobject.cpp (100%) rename tests/{manual => auto}/cmake/pass2/myobject.h (100%) rename tests/{manual => auto}/cmake/pass2/pass2.qrc (100%) rename tests/{manual => auto}/cmake/pass2/resource_file.txt (100%) rename tests/{manual => auto}/cmake/pass3/CMakeLists.txt (100%) rename tests/{manual => auto}/cmake/pass3/mywidget.cpp (100%) rename tests/{manual => auto}/cmake/pass3/mywidget.h (100%) rename tests/{manual => auto}/cmake/pass3/mywidget.ui (100%) rename tests/{manual => auto}/cmake/pass7/CMakeLists.txt (100%) rename tests/{manual => auto}/cmake/pass7/main.cpp (100%) rename tests/{manual => auto}/cmake/pass8/CMakeLists.txt (100%) rename tests/{manual => auto}/cmake/pass8/myobject.cpp (100%) rename tests/{manual => auto}/cmake/pass8/myobject.h (100%) rename tests/{manual => auto}/cmake/pass9/CMakeLists.txt (100%) rename tests/{manual => auto}/cmake/pass9/mydbusobject.cpp (100%) rename tests/{manual => auto}/cmake/pass9/mydbusobject.h (100%) diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 23221122d9..bd69fa17fa 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -14,6 +14,7 @@ SUBDIRS += \ other \ widgets \ printsupport \ + cmake cross_compile: SUBDIRS -= tools !contains(QT_CONFIG, opengl): SUBDIRS -= opengl diff --git a/tests/manual/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt similarity index 100% rename from tests/manual/cmake/CMakeLists.txt rename to tests/auto/cmake/CMakeLists.txt diff --git a/tests/auto/cmake/cmake.pro b/tests/auto/cmake/cmake.pro new file mode 100644 index 0000000000..9767914140 --- /dev/null +++ b/tests/auto/cmake/cmake.pro @@ -0,0 +1,50 @@ + +CMAKE_VERSION = $$system(cmake --version) + +# Cause make to do nothing. +TEMPLATE = subdirs + +check.commands = +isEmpty(CMAKE_VERSION) { + message("cmake executable not found. Not running CMake unit tests") +} else { + CTEST_VERSION = $$system(ctest --version) + isEmpty(CTEST_VERSION) { + message("ctest executable not found. Not running CMake unit tests") + } else { + CMAKE_VERSION = $$last(CMAKE_VERSION) + CMAKE_VERSION_MAJOR = $$section(CMAKE_VERSION, ., 0, 0) + CMAKE_VERSION_MINOR = $$section(CMAKE_VERSION, ., 1, 1) + CMAKE_VERSION_PATCH = $$section(CMAKE_VERSION, ., 2, 2) + + VERSION_OK = + greaterThan(CMAKE_VERSION_MAJOR, 2) { + VERSION_OK = 1 + } else:greaterThan(CMAKE_VERSION_MAJOR, 1):greaterThan(CMAKE_VERSION_MINOR, 8) { + VERSION_OK = 1 + } else:greaterThan(CMAKE_VERSION_MAJOR, 1):greaterThan(CMAKE_VERSION_MINOR, 7):greaterThan(CMAKE_VERSION_PATCH, 2) { + VERSION_OK = 1 + } + + isEmpty(VERSION_OK) { + message("cmake $$CMAKE_VERSION is too old for this test.") + } else { + SET = set + equals(QMAKE_DIR_SEP, "/"):SET = export + + CMAKE_BUILD_TYPE = Debug + CONFIG(release, debug|release):CMAKE_BUILD_TYPE = Release + + BUILD_DIR = $$replace($$list($$OUT_PWD/build), /, $$QMAKE_DIR_SEP) + + check.commands = \ + cd . && $$SET CMAKE_PREFIX_PATH=$$[QT_INSTALL_PREFIX] && \ + $(MKDIR) $$BUILD_DIR && cd $$BUILD_DIR && \ + cmake $$_PRO_FILE_PWD_ -DCMAKE_BUILD_TYPE=$${CMAKE_BUILD_TYPE} && \ + $(TESTRUNNER) ctest --output-on-failure + + } + } +} + +QMAKE_EXTRA_TARGETS *= check diff --git a/tests/manual/cmake/fail4/CMakeLists.txt b/tests/auto/cmake/fail4/CMakeLists.txt similarity index 100% rename from tests/manual/cmake/fail4/CMakeLists.txt rename to tests/auto/cmake/fail4/CMakeLists.txt diff --git a/tests/manual/cmake/fail4/myobject.cpp b/tests/auto/cmake/fail4/myobject.cpp similarity index 100% rename from tests/manual/cmake/fail4/myobject.cpp rename to tests/auto/cmake/fail4/myobject.cpp diff --git a/tests/manual/cmake/fail4/myobject.h b/tests/auto/cmake/fail4/myobject.h similarity index 100% rename from tests/manual/cmake/fail4/myobject.h rename to tests/auto/cmake/fail4/myobject.h diff --git a/tests/manual/cmake/fail4/pass4.qrc b/tests/auto/cmake/fail4/pass4.qrc similarity index 100% rename from tests/manual/cmake/fail4/pass4.qrc rename to tests/auto/cmake/fail4/pass4.qrc diff --git a/tests/manual/cmake/fail4/resource_file.txt b/tests/auto/cmake/fail4/resource_file.txt similarity index 100% rename from tests/manual/cmake/fail4/resource_file.txt rename to tests/auto/cmake/fail4/resource_file.txt diff --git a/tests/manual/cmake/fail5/CMakeLists.txt b/tests/auto/cmake/fail5/CMakeLists.txt similarity index 100% rename from tests/manual/cmake/fail5/CMakeLists.txt rename to tests/auto/cmake/fail5/CMakeLists.txt diff --git a/tests/manual/cmake/fail5/myobject.cpp b/tests/auto/cmake/fail5/myobject.cpp similarity index 100% rename from tests/manual/cmake/fail5/myobject.cpp rename to tests/auto/cmake/fail5/myobject.cpp diff --git a/tests/manual/cmake/fail5/myobject.h b/tests/auto/cmake/fail5/myobject.h similarity index 100% rename from tests/manual/cmake/fail5/myobject.h rename to tests/auto/cmake/fail5/myobject.h diff --git a/tests/manual/cmake/pass(needsquoting)6/CMakeLists.txt b/tests/auto/cmake/pass(needsquoting)6/CMakeLists.txt similarity index 100% rename from tests/manual/cmake/pass(needsquoting)6/CMakeLists.txt rename to tests/auto/cmake/pass(needsquoting)6/CMakeLists.txt diff --git a/tests/manual/cmake/pass(needsquoting)6/mywidget.cpp b/tests/auto/cmake/pass(needsquoting)6/mywidget.cpp similarity index 100% rename from tests/manual/cmake/pass(needsquoting)6/mywidget.cpp rename to tests/auto/cmake/pass(needsquoting)6/mywidget.cpp diff --git a/tests/manual/cmake/pass(needsquoting)6/mywidget.h b/tests/auto/cmake/pass(needsquoting)6/mywidget.h similarity index 100% rename from tests/manual/cmake/pass(needsquoting)6/mywidget.h rename to tests/auto/cmake/pass(needsquoting)6/mywidget.h diff --git a/tests/manual/cmake/pass(needsquoting)6/mywidget.ui b/tests/auto/cmake/pass(needsquoting)6/mywidget.ui similarity index 100% rename from tests/manual/cmake/pass(needsquoting)6/mywidget.ui rename to tests/auto/cmake/pass(needsquoting)6/mywidget.ui diff --git a/tests/manual/cmake/pass1/CMakeLists.txt b/tests/auto/cmake/pass1/CMakeLists.txt similarity index 100% rename from tests/manual/cmake/pass1/CMakeLists.txt rename to tests/auto/cmake/pass1/CMakeLists.txt diff --git a/tests/manual/cmake/pass1/three.cpp b/tests/auto/cmake/pass1/three.cpp similarity index 100% rename from tests/manual/cmake/pass1/three.cpp rename to tests/auto/cmake/pass1/three.cpp diff --git a/tests/manual/cmake/pass1/two.cpp b/tests/auto/cmake/pass1/two.cpp similarity index 100% rename from tests/manual/cmake/pass1/two.cpp rename to tests/auto/cmake/pass1/two.cpp diff --git a/tests/manual/cmake/pass2/CMakeLists.txt b/tests/auto/cmake/pass2/CMakeLists.txt similarity index 100% rename from tests/manual/cmake/pass2/CMakeLists.txt rename to tests/auto/cmake/pass2/CMakeLists.txt diff --git a/tests/manual/cmake/pass2/myobject.cpp b/tests/auto/cmake/pass2/myobject.cpp similarity index 100% rename from tests/manual/cmake/pass2/myobject.cpp rename to tests/auto/cmake/pass2/myobject.cpp diff --git a/tests/manual/cmake/pass2/myobject.h b/tests/auto/cmake/pass2/myobject.h similarity index 100% rename from tests/manual/cmake/pass2/myobject.h rename to tests/auto/cmake/pass2/myobject.h diff --git a/tests/manual/cmake/pass2/pass2.qrc b/tests/auto/cmake/pass2/pass2.qrc similarity index 100% rename from tests/manual/cmake/pass2/pass2.qrc rename to tests/auto/cmake/pass2/pass2.qrc diff --git a/tests/manual/cmake/pass2/resource_file.txt b/tests/auto/cmake/pass2/resource_file.txt similarity index 100% rename from tests/manual/cmake/pass2/resource_file.txt rename to tests/auto/cmake/pass2/resource_file.txt diff --git a/tests/manual/cmake/pass3/CMakeLists.txt b/tests/auto/cmake/pass3/CMakeLists.txt similarity index 100% rename from tests/manual/cmake/pass3/CMakeLists.txt rename to tests/auto/cmake/pass3/CMakeLists.txt diff --git a/tests/manual/cmake/pass3/mywidget.cpp b/tests/auto/cmake/pass3/mywidget.cpp similarity index 100% rename from tests/manual/cmake/pass3/mywidget.cpp rename to tests/auto/cmake/pass3/mywidget.cpp diff --git a/tests/manual/cmake/pass3/mywidget.h b/tests/auto/cmake/pass3/mywidget.h similarity index 100% rename from tests/manual/cmake/pass3/mywidget.h rename to tests/auto/cmake/pass3/mywidget.h diff --git a/tests/manual/cmake/pass3/mywidget.ui b/tests/auto/cmake/pass3/mywidget.ui similarity index 100% rename from tests/manual/cmake/pass3/mywidget.ui rename to tests/auto/cmake/pass3/mywidget.ui diff --git a/tests/manual/cmake/pass7/CMakeLists.txt b/tests/auto/cmake/pass7/CMakeLists.txt similarity index 100% rename from tests/manual/cmake/pass7/CMakeLists.txt rename to tests/auto/cmake/pass7/CMakeLists.txt diff --git a/tests/manual/cmake/pass7/main.cpp b/tests/auto/cmake/pass7/main.cpp similarity index 100% rename from tests/manual/cmake/pass7/main.cpp rename to tests/auto/cmake/pass7/main.cpp diff --git a/tests/manual/cmake/pass8/CMakeLists.txt b/tests/auto/cmake/pass8/CMakeLists.txt similarity index 100% rename from tests/manual/cmake/pass8/CMakeLists.txt rename to tests/auto/cmake/pass8/CMakeLists.txt diff --git a/tests/manual/cmake/pass8/myobject.cpp b/tests/auto/cmake/pass8/myobject.cpp similarity index 100% rename from tests/manual/cmake/pass8/myobject.cpp rename to tests/auto/cmake/pass8/myobject.cpp diff --git a/tests/manual/cmake/pass8/myobject.h b/tests/auto/cmake/pass8/myobject.h similarity index 100% rename from tests/manual/cmake/pass8/myobject.h rename to tests/auto/cmake/pass8/myobject.h diff --git a/tests/manual/cmake/pass9/CMakeLists.txt b/tests/auto/cmake/pass9/CMakeLists.txt similarity index 100% rename from tests/manual/cmake/pass9/CMakeLists.txt rename to tests/auto/cmake/pass9/CMakeLists.txt diff --git a/tests/manual/cmake/pass9/mydbusobject.cpp b/tests/auto/cmake/pass9/mydbusobject.cpp similarity index 100% rename from tests/manual/cmake/pass9/mydbusobject.cpp rename to tests/auto/cmake/pass9/mydbusobject.cpp diff --git a/tests/manual/cmake/pass9/mydbusobject.h b/tests/auto/cmake/pass9/mydbusobject.h similarity index 100% rename from tests/manual/cmake/pass9/mydbusobject.h rename to tests/auto/cmake/pass9/mydbusobject.h