diff options
-rw-r--r-- | Help/manual/cmake-properties.7.rst | 1 | ||||
-rw-r--r-- | Help/prop_test/SKIP_RETURN_CODE.rst | 9 | ||||
-rw-r--r-- | Modules/FindQt4.cmake | 20 | ||||
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestRunTest.cxx | 8 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 9 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.h | 2 | ||||
-rw-r--r-- | Source/QtDialog/AddCacheEntry.cxx | 38 | ||||
-rw-r--r-- | Source/QtDialog/AddCacheEntry.h | 11 | ||||
-rw-r--r-- | Source/QtDialog/CMakeSetupDialog.cxx | 26 | ||||
-rw-r--r-- | Source/QtDialog/CMakeSetupDialog.h | 3 | ||||
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 30 | ||||
-rw-r--r-- | Tests/CMakeLists.txt | 12 | ||||
-rw-r--r-- | Tests/CTestTestSkipReturnCode/CMakeLists.txt | 8 | ||||
-rw-r--r-- | Tests/CTestTestSkipReturnCode/CTestConfig.cmake | 7 | ||||
-rw-r--r-- | Tests/CTestTestSkipReturnCode/test.cmake.in | 22 | ||||
-rwxr-xr-x | bootstrap | 5 |
17 files changed, 158 insertions, 55 deletions
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index d569e31..c0ec0fe 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -247,6 +247,7 @@ Properties on Tests /prop_test/REQUIRED_FILES /prop_test/RESOURCE_LOCK /prop_test/RUN_SERIAL + /prop_test/SKIP_RETURN_CODE /prop_test/TIMEOUT /prop_test/WILL_FAIL /prop_test/WORKING_DIRECTORY diff --git a/Help/prop_test/SKIP_RETURN_CODE.rst b/Help/prop_test/SKIP_RETURN_CODE.rst new file mode 100644 index 0000000..c61273c --- /dev/null +++ b/Help/prop_test/SKIP_RETURN_CODE.rst @@ -0,0 +1,9 @@ +SKIP_RETURN_CODE +---------------- + +Return code to mark a test as skipped. + +Sometimes only a test itself can determine if all requirements for the +test are met. If such a situation should not be considered a hard failure +a return code of the process can be specified that will mark the test as +"Not Run" if it is encountered. diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index 46a893d..9be4270 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -107,11 +107,13 @@ # # :: # -# macro QT4_WRAP_CPP(outfiles inputfile ... OPTIONS ...) +# macro QT4_WRAP_CPP(outfiles inputfile ... [TARGET tgt] OPTIONS ...) # create moc code from a list of files containing Qt class with # the Q_OBJECT declaration. Per-directory preprocessor definitions -# are also added. Options may be given to moc, such as those found -# when executing "moc -help". +# are also added. If the <tgt> is specified, the +# INTERFACE_INCLUDE_DIRECTORIES and INTERFACE_COMPILE_DEFINITIONS from +# the <tgt> are passed to moc. Options may be given to moc, such as +# those found when executing "moc -help". # # # @@ -135,16 +137,19 @@ # # :: # -# macro QT4_GENERATE_MOC(inputfile outputfile ) +# macro QT4_GENERATE_MOC(inputfile outputfile [TARGET tgt]) # creates a rule to run moc on infile and create outfile. # Use this if for some reason QT4_WRAP_CPP() isn't appropriate, e.g. -# because you need a custom filename for the moc file or something similar. +# because you need a custom filename for the moc file or something +# similar. If the <tgt> is specified, the +# INTERFACE_INCLUDE_DIRECTORIES and INTERFACE_COMPILE_DEFINITIONS from +# the <tgt> are passed to moc. # # # # :: # -# macro QT4_AUTOMOC(sourcefile1 sourcefile2 ... ) +# macro QT4_AUTOMOC(sourcefile1 sourcefile2 ... [TARGET tgt]) # The qt4_automoc macro is obsolete. Use the CMAKE_AUTOMOC feature instead. # This macro is still experimental. # It can be used to have moc automatically handled. @@ -157,7 +162,8 @@ # them cause a rule to be generated to run moc at build time on the # accompanying header file foo.h. # If a source file has the SKIP_AUTOMOC property set it will be ignored by this macro. -# +# If the <tgt> is specified, the INTERFACE_INCLUDE_DIRECTORIES and +# INTERFACE_COMPILE_DEFINITIONS from the <tgt> are passed to moc. # # # :: diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index d79ac73..14b0789 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,5 +2,5 @@ set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MINOR 8) set(CMake_VERSION_PATCH 12) -set(CMake_VERSION_TWEAK 20140115) +set(CMake_VERSION_TWEAK 20140116) #set(CMake_VERSION_RC 1) diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 0e2fa41..cdf90b9 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -206,7 +206,13 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) bool success = !forceFail && (retVal == 0 || this->TestProperties->RequiredRegularExpressions.size()); - if((success && !this->TestProperties->WillFail) + if(this->TestProperties->SkipReturnCode >= 0 + && this->TestProperties->SkipReturnCode == retVal) + { + this->TestResult.Status = cmCTestTestHandler::NOT_RUN; + cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Skipped "); + } + else if((success && !this->TestProperties->WillFail) || (!success && this->TestProperties->WillFail)) { this->TestResult.Status = cmCTestTestHandler::COMPLETED; diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 26f8014..3a04b33 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -2229,6 +2229,14 @@ bool cmCTestTestHandler::SetTestsProperties( rtit->Processors = 1; } } + if ( key == "SKIP_RETURN_CODE" ) + { + rtit->SkipReturnCode = atoi(val.c_str()); + if(rtit->SkipReturnCode < 0 || rtit->SkipReturnCode > 255) + { + rtit->SkipReturnCode = -1; + } + } if ( key == "DEPENDS" ) { std::vector<std::string> lval; @@ -2364,6 +2372,7 @@ bool cmCTestTestHandler::AddTest(const std::vector<std::string>& args) test.ExplicitTimeout = false; test.Cost = 0; test.Processors = 1; + test.SkipReturnCode = -1; test.PreviousRuns = 0; if (this->UseIncludeRegExpFlag && !this->IncludeTestsRegularExpression.find(testname.c_str())) diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index 6dda300..63f9c93 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -109,6 +109,8 @@ public: int Index; //Requested number of process slots int Processors; + // return code of test which will mark test as "not run" + int SkipReturnCode; std::vector<std::string> Environment; std::vector<std::string> Labels; std::set<std::string> LockedResources; diff --git a/Source/QtDialog/AddCacheEntry.cxx b/Source/QtDialog/AddCacheEntry.cxx index e7fedc5..3881045 100644 --- a/Source/QtDialog/AddCacheEntry.cxx +++ b/Source/QtDialog/AddCacheEntry.cxx @@ -15,14 +15,16 @@ #include <QCompleter> static const int NumTypes = 4; +static const int DefaultTypeIndex = 0; static const QByteArray TypeStrings[NumTypes] = { "BOOL", "PATH", "FILEPATH", "STRING" }; static const QCMakeProperty::PropertyType Types[NumTypes] = { QCMakeProperty::BOOL, QCMakeProperty::PATH, QCMakeProperty::FILEPATH, QCMakeProperty::STRING}; -AddCacheEntry::AddCacheEntry(QWidget* p, const QStringList& completions) - : QWidget(p) +AddCacheEntry::AddCacheEntry(QWidget* p, const QStringList& varNames, + const QStringList& varTypes) + : QWidget(p), VarNames(varNames), VarTypes(varTypes) { this->setupUi(this); for(int i=0; i<NumTypes; i++) @@ -43,7 +45,10 @@ AddCacheEntry::AddCacheEntry(QWidget* p, const QStringList& completions) this->setTabOrder(path, filepath); this->setTabOrder(filepath, string); this->setTabOrder(string, this->Description); - this->Name->setCompleter(new QCompleter(completions, this)); + QCompleter *completer = new QCompleter(this->VarNames, this); + this->Name->setCompleter(completer); + connect(completer, SIGNAL(activated(const QString&)), + this, SLOT(onCompletionActivated(const QString&))); } QString AddCacheEntry::name() const @@ -77,7 +82,32 @@ QCMakeProperty::PropertyType AddCacheEntry::type() const { return Types[idx]; } - return QCMakeProperty::BOOL; + return Types[DefaultTypeIndex]; } +QString AddCacheEntry::typeString() const +{ + int idx = this->Type->currentIndex(); + if(idx >= 0 && idx < NumTypes) + { + return TypeStrings[idx]; + } + return TypeStrings[DefaultTypeIndex]; +} +void AddCacheEntry::onCompletionActivated(const QString &text) +{ + int idx = this->VarNames.indexOf(text); + if (idx != -1) + { + QString vartype = this->VarTypes[idx]; + for (int i = 0; i < NumTypes; i++) + { + if (TypeStrings[i] == vartype) + { + this->Type->setCurrentIndex(i); + break; + } + } + } +} diff --git a/Source/QtDialog/AddCacheEntry.h b/Source/QtDialog/AddCacheEntry.h index e219d4e..38c3a74 100644 --- a/Source/QtDialog/AddCacheEntry.h +++ b/Source/QtDialog/AddCacheEntry.h @@ -24,12 +24,21 @@ class AddCacheEntry : public QWidget, public Ui::AddCacheEntry { Q_OBJECT public: - AddCacheEntry(QWidget* p, const QStringList& completions); + AddCacheEntry(QWidget* p, const QStringList& varNames, + const QStringList& varTypes); QString name() const; QVariant value() const; QString description() const; QCMakeProperty::PropertyType type() const; + QString typeString() const; + +private slots: + void onCompletionActivated(const QString &text); + +private: + const QStringList& VarNames; + const QStringList& VarTypes; }; #endif diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index 1903c02..f62afd6 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -70,8 +70,10 @@ CMakeSetupDialog::CMakeSetupDialog() restoreGeometry(settings.value("geometry").toByteArray()); restoreState(settings.value("windowState").toByteArray()); - this->AddVariableCompletions = settings.value("AddVariableCompletionEntries", + this->AddVariableNames = settings.value("AddVariableNames", QStringList("CMAKE_INSTALL_PREFIX")).toStringList(); + this->AddVariableTypes = settings.value("AddVariableTypes", + QStringList("PATH")).toStringList(); QWidget* cont = new QWidget(this); this->setupUi(cont); @@ -1049,7 +1051,8 @@ void CMakeSetupDialog::addCacheEntry() dialog.resize(400, 200); dialog.setWindowTitle(tr("Add Cache Entry")); QVBoxLayout* l = new QVBoxLayout(&dialog); - AddCacheEntry* w = new AddCacheEntry(&dialog, this->AddVariableCompletions); + AddCacheEntry* w = new AddCacheEntry(&dialog, this->AddVariableNames, + this->AddVariableTypes); QDialogButtonBox* btns = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, &dialog); @@ -1064,23 +1067,26 @@ void CMakeSetupDialog::addCacheEntry() m->insertProperty(w->type(), w->name(), w->description(), w->value(), false); // only add variable names to the completion which are new - if (!this->AddVariableCompletions.contains(w->name())) + if (!this->AddVariableNames.contains(w->name())) { - this->AddVariableCompletions << w->name(); + this->AddVariableNames << w->name(); + this->AddVariableTypes << w->typeString(); // limit to at most 100 completion items - if (this->AddVariableCompletions.size() > 100) + if (this->AddVariableNames.size() > 100) { - this->AddVariableCompletions.removeFirst(); + this->AddVariableNames.removeFirst(); + this->AddVariableTypes.removeFirst(); } // make sure CMAKE_INSTALL_PREFIX is always there - if (!this->AddVariableCompletions.contains("CMAKE_INSTALL_PREFIX")) + if (!this->AddVariableNames.contains("CMAKE_INSTALL_PREFIX")) { - this->AddVariableCompletions << QString("CMAKE_INSTALL_PREFIX"); + this->AddVariableNames << "CMAKE_INSTALL_PREFIX"; + this->AddVariableTypes << "PATH"; } QSettings settings; settings.beginGroup("Settings/StartPath"); - settings.setValue("AddVariableCompletionEntries", - this->AddVariableCompletions); + settings.setValue("AddVariableNames", this->AddVariableNames); + settings.setValue("AddVariableTypes", this->AddVariableTypes); } } } diff --git a/Source/QtDialog/CMakeSetupDialog.h b/Source/QtDialog/CMakeSetupDialog.h index 963c7d1..1b26c64 100644 --- a/Source/QtDialog/CMakeSetupDialog.h +++ b/Source/QtDialog/CMakeSetupDialog.h @@ -110,7 +110,8 @@ protected: QTextCharFormat ErrorFormat; QTextCharFormat MessageFormat; - QStringList AddVariableCompletions; + QStringList AddVariableNames; + QStringList AddVariableTypes; QStringList FindHistory; QEventLoop LocalLoop; diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 65b01db..5e1f1ed 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -1107,46 +1107,24 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os) /*deptype=*/ "", /*rspfile=*/ "", /*rspcontent*/ "", - /*restat=*/ true, + /*restat=*/ false, /*generator=*/ true); - cmNinjaDeps implicitDeps, outputs, temp; - outputs.push_back(NINJA_BUILD_FILE); + cmNinjaDeps implicitDeps; for (std::vector<cmLocalGenerator *>::const_iterator i = this->LocalGenerators.begin(); i != this->LocalGenerators.end(); ++i) { const std::vector<std::string>& lf = (*i)->GetMakefile()->GetListFiles(); implicitDeps.insert(implicitDeps.end(), lf.begin(), lf.end()); - - const std::vector<std::string>& of = (*i)->GetMakefile()->GetOutputFiles(); - temp.insert(temp.end(), of.begin(), of.end()); } - - //Add the CMakeCache.txt file to the implicit depends so that we catch - //when somebody manually modifies the file. - implicitDeps.push_back("CMakeCache.txt"); - - //make sure nothing is in implicit depends twice std::sort(implicitDeps.begin(), implicitDeps.end()); implicitDeps.erase(std::unique(implicitDeps.begin(), implicitDeps.end()), implicitDeps.end()); - - - //make sure nothing is in outputs depends twice - std::sort(temp.begin(), temp.end()); - temp.erase(std::unique(temp.begin(), temp.end()), - temp.end()); - - //make sure that anything that is in implicitDeps is also NOT in outputs - std::set_difference(temp.begin(), - temp.end(), - implicitDeps.begin(), - implicitDeps.end(), - std::back_inserter(outputs)); + implicitDeps.push_back("CMakeCache.txt"); this->WriteBuild(os, "Re-run CMake if any of its inputs changed.", "RERUN_CMAKE", - outputs, + /*outputs=*/ cmNinjaDeps(1, NINJA_BUILD_FILE), /*explicitDeps=*/ cmNinjaDeps(), implicitDeps, /*orderOnlyDeps=*/ cmNinjaDeps(), diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 7969078..a79111a 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2230,6 +2230,18 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --output-log "${CMake_BINARY_DIR}/Tests/CTestTestParallel/testOutput.log" ) + configure_file( + "${CMake_SOURCE_DIR}/Tests/CTestTestSkipReturnCode/test.cmake.in" + "${CMake_BINARY_DIR}/Tests/CTestTestSkipReturnCode/test.cmake" + @ONLY ESCAPE_QUOTES) + add_test(CTestTestSkipReturnCode ${CMAKE_CTEST_COMMAND} + -S "${CMake_BINARY_DIR}/Tests/CTestTestSkipReturnCode/test.cmake" -V + --output-log "${CMake_BINARY_DIR}/Tests/CTestTestSkipReturnCode/testOutput.log" + -C \${CTEST_CONFIGURATION_TYPE} + ) + set_tests_properties(CTestTestSkipReturnCode PROPERTIES + PASS_REGULAR_EXPRESSION "CMakeV1 \\.* +Passed.*CMakeV2 \\.+\\*+Skipped") + ADD_TEST_MACRO(CTestTestSerialInDepends ${CMAKE_CTEST_COMMAND} -j 4 --output-on-failure -C "\${CTestTest_CONFIG}") diff --git a/Tests/CTestTestSkipReturnCode/CMakeLists.txt b/Tests/CTestTestSkipReturnCode/CMakeLists.txt new file mode 100644 index 0000000..26c4178 --- /dev/null +++ b/Tests/CTestTestSkipReturnCode/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 2.8.12) +project(CTestTestSkipReturnCode) +include(CTest) + +add_test (NAME CMakeV1 COMMAND ${CMAKE_COMMAND} "--version") +add_test (NAME CMakeV2 COMMAND ${CMAKE_COMMAND} "--version") + +set_tests_properties(CMakeV2 PROPERTIES SKIP_RETURN_CODE 0) diff --git a/Tests/CTestTestSkipReturnCode/CTestConfig.cmake b/Tests/CTestTestSkipReturnCode/CTestConfig.cmake new file mode 100644 index 0000000..ad8e00e --- /dev/null +++ b/Tests/CTestTestSkipReturnCode/CTestConfig.cmake @@ -0,0 +1,7 @@ +set (CTEST_PROJECT_NAME "CTestTestSkipReturnCode") +set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") +set (CTEST_DART_SERVER_VERSION "2") +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "www.cdash.org") +set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestSkipReturnCode/test.cmake.in b/Tests/CTestTestSkipReturnCode/test.cmake.in new file mode 100644 index 0000000..ebee01b --- /dev/null +++ b/Tests/CTestTestSkipReturnCode/test.cmake.in @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 2.4) + +# Settings: +set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-SkipReturnCode") + +set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestSkipReturnCode") +set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestSkipReturnCode") +set(CTEST_CVS_COMMAND "@CVSCOMMAND@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") + +#CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY}) + +CTEST_START(Experimental) +CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) @@ -739,10 +739,7 @@ if ${cmake_system_linux}; then # avoid binutils problem with large binaries, e.g. when building CMake in debug mode # See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50230 if ${cmake_machine_parisc}; then - # if -O[s23] is given the effect is inverted, so do not use the flag then - if [ "`echo "${CXXFLAGS}" | sed -r '/^(.* )?(-O[s234])( .*)?$/s/.*/-Os/'`" != "-Os" ]; then - cmake_ld_flags="${LDFLAGS} -Wl,--unique=.text.*" - fi + cmake_ld_flags="${LDFLAGS} -Wl,--unique=.text._*" fi fi |