35#include <boost/algorithm/string.hpp> 
   36#include <boost/core/ignore_unused.hpp> 
   37#include <boost/lexical_cast.hpp> 
   62    m_doc = 
new TiXmlDocument(pFilename.string().c_str());
 
   64    bool loadOkay = 
m_doc->LoadFile();
 
   67             "Failed to load test definition file: " + pFilename.string() +
 
   68                 "\n" + 
string(
m_doc->ErrorDesc()));
 
   75    boost::ignore_unused(pSrc);
 
   87             "Command ID '" + std::to_string(pId) + 
"' not found");
 
  103             "Missing 'type' attribute in metric " +
 
  104                 boost::lexical_cast<string>(pId) + 
").");
 
  105    return boost::to_upper_copy(
string(
m_metrics[pId]->Attribute(
"type")));
 
  126    const char *
id = 
m_metrics[pId]->Attribute(
"id");
 
  127    ASSERTL0(
id, 
"No ID found for metric!");
 
  128    return boost::lexical_cast<unsigned int>(
id);
 
  156    std::string commandType = 
"none";
 
  157    if (elmt->Attribute(
"type"))
 
  159        commandType = elmt->Attribute(
"type");
 
  161        if (commandType == 
"none")
 
  165        else if (commandType == 
"parallel")
 
  169        else if (commandType == 
"sequential")
 
  177    if (elmt->FirstChildElement(
"executable"))
 
  179        tmp              = elmt->FirstChildElement(
"executable");
 
  182        std::string needsPython;
 
  183        tmp->QueryStringAttribute(
"python", &needsPython);
 
  186#if defined(RELWITHDEBINFO) 
  188#elif !defined(NDEBUG) 
  194    tmp = elmt->FirstChildElement(
"parameters");
 
  195    ASSERTL0(tmp, 
"Cannot find 'parameters' for test.");
 
  202    tmp = elmt->FirstChildElement(
"processes");
 
  218    TiXmlHandle handle(pDoc);
 
  219    TiXmlElement *testElement, *tmp, *metrics, *files;
 
  220    testElement = handle.FirstChildElement(
"test").Element();
 
  221    ASSERTL0(testElement, 
"Cannot find 'test' root element.");
 
  224    unsigned int runs = 1;
 
  225    testElement->QueryUnsignedAttribute(
"runs", &runs);
 
  226    ASSERTL0(runs > 0, 
"Number of runs must be greater than zero.");
 
  230    tmp = testElement->FirstChildElement(
"description");
 
  231    ASSERTL0(tmp, 
"Cannot find 'description' for test.");
 
  241    else if (testElement->FirstChildElement(
"executable"))
 
  245    else if ((tmp = testElement->FirstChildElement(
"segment")))
 
  248                 "Test files defining more than one command in segment " 
  249                 "blocks cannot use --executable.");
 
  254            tmp = tmp->NextSiblingElement(
"segment");
 
  260                     "All segment commands should be of the same type.");
 
  265             "No executable / command segments specified for test.");
 
  268    metrics = testElement->FirstChildElement(
"metrics");
 
  269    ASSERTL0(metrics, 
"No metrics defined for test.");
 
  271    tmp = metrics->FirstChildElement(
"metric");
 
  275        tmp = tmp->NextSiblingElement(
"metric");
 
  279    files = testElement->FirstChildElement(
"files");
 
  282        tmp = files->FirstChildElement(
"file");
 
  287            if (tmp->Attribute(
"description"))
 
  292            tmp = tmp->NextSiblingElement(
"file");
 
#define ASSERTL0(condition, msg)
 
The TestData class is responsible for parsing a test XML file and storing the data.
 
TestData(const fs::path &pFilename, po::variables_map &pVm)
TestData constructor.
 
std::vector< TiXmlElement * > m_metrics
 
DependentFile GetDependentFile(unsigned int pId) const
 
unsigned int GetMetricId(unsigned int pId)
Returns the ID of the metric for a given metric ID.
 
void Parse(TiXmlDocument *pDoc)
Parse the test file and populate member variables for the test.
 
std::vector< Command > m_commands
 
unsigned int GetNumDependentFiles() const
Returns the number of dependent files required for the test.
 
unsigned int GetNumMetrics() const
Returns the number of metrics to be collected for the test.
 
unsigned int m_runs
The number of times to run the test.
 
Command ParseCommand(TiXmlElement *pElmt) const
 
unsigned int GetNumRuns() const
Returns the number of runs to be performed for the test.
 
TiXmlElement * GetMetric(unsigned int pId)
Returns a pointer to the TiXmlElement object representing the metric for a given metric ID.
 
unsigned int GetNumCommands() const
 
const std::string & GetDescription() const
Returns the description of a test.
 
std::string GetMetricType(unsigned int pId) const
Returns the type of metric to be collected for a given metric ID.
 
po::variables_map m_cmdoptions
 
const Command & GetCommand(unsigned int pId) const
 
std::vector< DependentFile > m_files
 
std::string m_description
 
CommandType m_commandType
 
std::string m_description