ENH: Added documentation for ctest.

This commit is contained in:
Brad King 2003-08-06 15:03:56 -04:00
parent b78888fe38
commit 1471a1a6f1
2 changed files with 102 additions and 21 deletions

View File

@ -17,10 +17,92 @@
#include "cmCTest.h"
#include "cmSystemTools.h"
// Need these for documentation support.
#include "cmake.h"
#include "cmDocumentation.h"
//----------------------------------------------------------------------------
static const cmDocumentationEntry cmDocumentationName[] =
{
{0,
" ctest - Testing driver provided by CMake.", 0},
{0,0,0}
};
//----------------------------------------------------------------------------
static const cmDocumentationEntry cmDocumentationUsage[] =
{
{0,
" ctest [options]", 0},
{0,0,0}
};
//----------------------------------------------------------------------------
static const cmDocumentationEntry cmDocumentationDescription[] =
{
{0,
"The \"ctest\" executable is the CMake test driver program. "
"CMake-generated build trees created for projects that use "
"the ENABLE_TESTING and ADD_TEST commands have testing support. "
"This program will run the tests and report results.", 0},
CMAKE_STANDARD_INTRODUCTION,
{0,0,0}
};
//----------------------------------------------------------------------------
static const cmDocumentationEntry cmDocumentationOptions[] =
{
{"-C <config>", "Choose configuration to test.",
"Some CMake-generated build trees can have multiple build configurations "
"in the same tree. This option can be used to specify which one should "
"be tested. Example configurations are \"Debug\" and \"Release\"."},
{"-V,--verbose", "Enable verbose output from tests.",
"Test output is normally suppressed and only summary information is "
"displayed. This option will show all test output."},
{"-N,--show-only", "Disable actual execution of tests.",
"This option tells ctest to list the tests that would be run but not "
"actually run them. Useful in conjunction with the -R and -E options."},
{"-R <regex>", "Run tests matching regular expression.",
"This option tells ctest to run only the tests whose names match the "
"given regular expression."},
{"-E <regex>", "Exclude tests matching regular expression.",
"This option tells ctest to NOT run the tests whose names match the "
"given regular expression."},
{0,0,0}
};
//----------------------------------------------------------------------------
static const cmDocumentationEntry cmDocumentationSeeAlso[] =
{
{0, "cmake", 0},
{0, "ccmake", 0},
{0, 0, 0}
};
// this is a test driver program for cmCTest.
int main (int argc, char *argv[])
{
cmSystemTools::EnableMSVCDebugHook();
// If there is a testing input file, check for documentation options
// only if there are actually arguments. We want running without
// arguments to run tests.
if(argc > 1 || !cmSystemTools::FileExists("DartTestfile.txt"))
{
cmDocumentation doc;
if(doc.CheckOptions(argc, argv))
{
// Construct and print requested documentation.
doc.SetName("ctest");
doc.SetNameSection(cmDocumentationName);
doc.SetUsageSection(cmDocumentationUsage);
doc.SetDescriptionSection(cmDocumentationDescription);
doc.SetOptionsSection(cmDocumentationOptions);
doc.SetSeeAlsoList(cmDocumentationSeeAlso);
return doc.PrintRequestedDocumentation(std::cout)? 0:1;
}
}
cmCTest inst;
// look at the args
@ -151,27 +233,6 @@ int main (int argc, char *argv[])
inst.m_ExcludeRegExp = args[i+1];
inst.m_UseExcludeRegExpFirst = inst.m_UseIncludeRegExp ? false : true;
}
if(arg.find("-h") == 0 ||
arg.find("-help") == 0 ||
arg.find("-H") == 0 ||
arg.find("--help") == 0 ||
arg.find("/H") == 0 ||
arg.find("/HELP") == 0 ||
arg.find("/?") == 0)
{
std::cerr << "Usage: " << argv[0] << " <options>" << std::endl
<< "\t -C type Specify config type" << std::endl
<< "\t -E test Specify regular expression for tests to exclude"
<< std::endl
<< "\t -R test Specify regular expression for tests to include"
<< std::endl
<< "\t -V Verbose testing" << std::endl
<< "\t -N Only show what would be done without this option"
<< std::endl
<< "\t -H Help page" << std::endl;
return 1;
}
}
// call process directory

View File

@ -35,6 +35,26 @@ INSTALL_FILES(${CMAKE_DOC_DIR} FILES
)
SET(DOC_FILES ${DOC_FILES} ${CMake_BINARY_DIR}/Docs/cmake.txt)
# Generate documentation for "ctest" executable.
SET(CMD ${CMD_DIR}/ctest${CMD_EXT})
ADD_CUSTOM_COMMAND(
TARGET documentation
COMMAND ${CMD}
ARGS --help-full ${CMake_BINARY_DIR}/Docs/ctest.txt
--help-html ${CMake_BINARY_DIR}/Docs/ctest.html
--help-man ${CMake_BINARY_DIR}/Docs/ctest.1
DEPENDS ${CMD}
SOURCE ${CMake_SOURCE_DIR}/Utilities/Doxygen/authors.txt
OUTPUTS ${CMake_BINARY_DIR}/Docs/ctest.txt
)
ADD_DEPENDENCIES(documentation ctest)
INSTALL_FILES(${CMAKE_MAN_DIR}/man1 FILES ${CMake_BINARY_DIR}/Docs/ctest.1)
INSTALL_FILES(${CMAKE_DOC_DIR} FILES
${CMake_BINARY_DIR}/Docs/ctest.txt
${CMake_BINARY_DIR}/Docs/ctest.html
)
SET(DOC_FILES ${DOC_FILES} ${CMake_BINARY_DIR}/Docs/ctest.txt)
# Generate documentation for "ccmake" executable.
IF(UNIX)
IF(CURSES_LIBRARY)