CMake/Source/CTest/cmCTestScriptHandler.h

168 lines
4.3 KiB
C
Raw Normal View History

Simplify CMake per-source license notices Per-source copyright/license notice headers that spell out copyright holder names and years are hard to maintain and often out-of-date or plain wrong. Precise contributor information is already maintained automatically by the version control tool. Ultimately it is the receiver of a file who is responsible for determining its licensing status, and per-source notices are merely a convenience. Therefore it is simpler and more accurate for each source to have a generic notice of the license name and references to more detailed information on copyright holders and full license terms. Our `Copyright.txt` file now contains a list of Contributors whose names appeared source-level copyright notices. It also references version control history for more precise information. Therefore we no longer need to spell out the list of Contributors in each source file notice. Replace CMake per-source copyright/license notice headers with a short description of the license and links to `Copyright.txt` and online information available from "https://cmake.org/licensing". The online URL also handles cases of modules being copied out of our source into other projects, so we can drop our notices about replacing links with full license text. Run the `Utilities/Scripts/filter-notices.bash` script to perform the majority of the replacements mechanically. Manually fix up shebang lines and trailing newlines in a few files. Manually update the notices in a few files that the script does not handle.
2016-09-27 22:01:08 +03:00
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmCTestScriptHandler_h
#define cmCTestScriptHandler_h
#include <cmConfigure.h>
2005-01-27 19:43:22 +03:00
#include "cmCTestGenericHandler.h"
#include "cmTypeMacro.h"
#include <string>
#include <vector>
class cmCTest;
class cmCTestCommand;
class cmGlobalGenerator;
class cmMakefile;
class cmake;
/** \class cmCTestScriptHandler
* \brief A class that handles ctest -S invocations
*
2004-09-28 17:00:06 +04:00
* CTest script is controlled using several variables that script has to
* specify and some optional ones. Required ones are:
* CTEST_SOURCE_DIRECTORY - Source directory of the project
* CTEST_BINARY_DIRECTORY - Binary directory of the project
* CTEST_COMMAND - Testing commands
*
* Optional variables are:
* CTEST_BACKUP_AND_RESTORE
* CTEST_CMAKE_COMMAND
* CTEST_CMAKE_OUTPUT_FILE_NAME
* CTEST_CONTINUOUS_DURATION
* CTEST_CONTINUOUS_MINIMUM_INTERVAL
* CTEST_CVS_CHECKOUT
* CTEST_CVS_COMMAND
* CTEST_UPDATE_COMMAND
2004-09-28 17:00:06 +04:00
* CTEST_DASHBOARD_ROOT
* CTEST_ENVIRONMENT
* CTEST_INITIAL_CACHE
* CTEST_START_WITH_EMPTY_BINARY_DIRECTORY
* CTEST_START_WITH_EMPTY_BINARY_DIRECTORY_ONCE
2006-03-10 23:03:09 +03:00
*
2005-11-22 23:15:52 +03:00
* In addition the following variables can be used. The number can be 1-10.
2004-09-28 17:00:06 +04:00
* CTEST_EXTRA_UPDATES_1
* CTEST_EXTRA_UPDATES_2
* ...
* CTEST_EXTRA_UPDATES_10
*
* CTest script can use the following arguments CTest provides:
* CTEST_SCRIPT_ARG
* CTEST_SCRIPT_DIRECTORY
* CTEST_SCRIPT_NAME
*
*/
2005-01-27 19:43:22 +03:00
class cmCTestScriptHandler : public cmCTestGenericHandler
{
public:
cmTypeMacro(cmCTestScriptHandler, cmCTestGenericHandler);
/**
* Add a script to run, and if is should run in the current process
*/
void AddConfigurationScript(const char*, bool pscope);
2005-01-27 23:54:47 +03:00
/**
* Run a dashboard using a specified confiuration script
*/
2016-06-27 22:25:27 +03:00
int ProcessHandler() CM_OVERRIDE;
2005-01-27 18:11:04 +03:00
/*
* Run a script
*/
static bool RunScript(cmCTest* ctest, const char* script, bool InProcess,
int* returnValue);
int RunCurrentScript();
2006-03-10 23:03:09 +03:00
2005-01-27 18:11:04 +03:00
/*
* Empty Binary Directory
*/
static bool EmptyBinaryDirectory(const char* dir);
2005-01-27 18:11:04 +03:00
/*
* Write an initial CMakeCache.txt from the given contents.
*/
static bool WriteInitialCache(const char* directory, const char* text);
2005-01-27 18:11:04 +03:00
/*
* Some elapsed time handling functions
*/
static void SleepInSeconds(unsigned int secondsToWait);
void UpdateElapsedTime();
/**
* Return the time remaianing that the script is allowed to run in
* seconds if the user has set the variable CTEST_TIME_LIMIT. If that has
* not been set it returns 1e7 seconds
*/
double GetRemainingTimeAllowed();
cmCTestScriptHandler();
2016-06-27 22:25:27 +03:00
~cmCTestScriptHandler() CM_OVERRIDE;
2006-03-10 23:03:09 +03:00
2016-06-27 22:25:27 +03:00
void Initialize() CM_OVERRIDE;
void CreateCMake();
cmake* GetCMake() { return this->CMake; }
private:
// reads in a script
2005-01-27 19:43:22 +03:00
int ReadInScript(const std::string& total_script_arg);
int ExecuteScript(const std::string& total_script_arg);
// extract vars from the script to set ivars
int ExtractVariables();
// perform a CVS checkout of the source dir
int CheckOutSourceDir();
// perform any extra cvs updates that were requested
int PerformExtraUpdates();
2006-03-10 23:03:09 +03:00
// backup and restore dirs
int BackupDirectories();
void RestoreBackupDirectories();
int RunConfigurationScript(const std::string& script, bool pscope);
int RunConfigurationDashboard();
// Add ctest command
void AddCTestCommand(cmCTestCommand* command);
// Try to remove the binary directory once
static bool TryToRemoveBinaryDirectoryOnce(const std::string& directoryPath);
std::vector<std::string> ConfigurationScripts;
std::vector<bool> ScriptProcessScope;
2006-03-10 23:03:09 +03:00
bool Backup;
bool EmptyBinDir;
bool EmptyBinDirOnce;
std::string SourceDir;
std::string BinaryDir;
std::string BackupSourceDir;
std::string BackupBinaryDir;
std::string CTestRoot;
std::string CVSCheckOut;
std::string CTestCmd;
std::string UpdateCmd;
std::string CTestEnv;
std::string InitialCache;
std::string CMakeCmd;
std::string CMOutFile;
std::vector<std::string> ExtraUpdates;
2006-03-10 23:03:09 +03:00
double MinimumInterval;
double ContinuousDuration;
2005-01-27 18:11:04 +03:00
// what time in seconds did this script start running
2006-03-10 23:03:09 +03:00
double ScriptStartTime;
cmMakefile* Makefile;
cmGlobalGenerator* GlobalGenerator;
cmake* CMake;
};
#endif