CTest CDash:使用include(CTest)的站点下缺少的SubProject xml元素仅用于提交测试结果

时间:2013-07-26 15:30:06

标签: properties labels ctest subproject cdash

我使用CMake构建了一个包含多个独立项目的源代码树,以构建每个单独的项目。

重要提示:我没有全局CMakeLists.txt文件来执行整个构建,我使用通用脚本(windows(.cmd)和unix(.sh))来循环所有子项目。我希望保持项目独立,并且能够自动构建它们。

另一方面,在CDash中,我希望将所有这些独立项目视为 CDash子项目,作为更大的独特人工 CDash项目的一部分。

要使用CDash,我按照以下方法描述的方法: http://www.cmake.org/Wiki/CMake/Testing_With_CTest

我将这个方法A命名为

即,我这样做:

enable_testing()
include(CTest)

然后,进行一些我自己的测试。

之后,我尝试按照以下页面指示将我的个别项目视为子项目: http://www.kitware.com/media/html/CDashSubprojects.html

我将这个方法B命名为

问题是用于在 XML 被submited到CDASH缺乏SubProjectLabels的xml元素(标记为XML滥用者), Sites下的那些,虽然我的CMakeLists.txt(实际上是我的CTestConfig.cmake)文件具有以下全局属性设置(我试图将它放在两个文件中):

set_property(GLOBAL PROPERTY SubProject ${CMAKE_PROJECT_NAME})
set_property(GLOBAL PROPERTY Label ${CMAKE_PROJECT_NAME})

其中CMAKE_PROJECT_NAME当然是定义良好的。

  • 您是否知道在提交的xml文件的SubProject元素下缺少LabelsSites元素?
  • 方法A和B可以混合使用吗?

此外,我检查了CTest源代码,这些全局属性是由这个函数添加的(我从2.8.10中取出它,无法下载我正在使用的2.8.11的源代码,所以我希望它没有改变它对不起):

//----------------------------------------------------------------------
void cmCTest::AddSiteProperties(std::ostream& ostr)
{
  cmCTestScriptHandler* ch =
    static_cast<cmCTestScriptHandler*>(this->GetHandler("script"));
  cmake* cm =  ch->GetCMake();
  // if no CMake then this is the old style script and props like
  // this will not work anyway.
  if(!cm)
  {
    return;
  }
  // This code should go when cdash is changed to use labels only
  const char* subproject = cm->GetProperty("SubProject", cmProperty::GLOBAL);
  if(subproject)
  {
    ostr << "<Subproject name=\"" << subproject << "\">\n";
    const char* labels =
      ch->GetCMake()->GetProperty("SubProjectLabels", cmProperty::GLOBAL);
    if(labels)
    {
      ostr << "  <Labels>\n";
      std::string l = labels;
      std::vector<std::string> args;
      cmSystemTools::ExpandListArgument(l, args);
      for(std::vector<std::string>::iterator i = args.begin();
          i != args.end(); ++i)
      {
        ostr << "    <Label>" << i->c_str() << "</Label>\n";
      }
      ostr << "  </Labels>\n";
    }
    ostr << "</Subproject>\n";
  }

  // This code should stay when cdash only does label based sub-projects
  const char* label = cm->GetProperty("Label", cmProperty::GLOBAL);
  if(label)
  {
    ostr << "<Labels>\n";
    ostr << "  <Label>" << label << "</Label>\n";
    ostr << "</Labels>\n";
  }
}
  • ch->GetCMake()在我的情况下会以某种方式返回NULL吗?

提前感谢您的帮助。问候。


P.-S。:请不要问我为什么要做这个或那个(除非你有相关的要点),因为 - 一个 - 它没有帮助, - 如果我这样做,这是因为我有充分的理由认为这个地方不适合揭露它。我来这里是为了寻求你的帮助,最好是从那些知道他/她正在谈论什么的人或明确的最后一句“不可能那样做,不这样做,因为这个”(因为是强制性的 - 请不要强制性的答复)。

0 个答案:

没有答案