2004-09-06 20:45:14 +04:00
|
|
|
/*=========================================================================
|
|
|
|
|
|
|
|
Program: CMake - Cross-Platform Makefile Generator
|
|
|
|
Module: $RCSfile$
|
|
|
|
Language: C++
|
|
|
|
Date: $Date$
|
|
|
|
Version: $Revision$
|
|
|
|
|
|
|
|
Copyright (c) 2002 Kitware, Inc. All rights reserved.
|
|
|
|
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
|
|
|
|
|
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even
|
|
|
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
PURPOSE. See the above copyright notices for more information.
|
|
|
|
|
|
|
|
=========================================================================*/
|
|
|
|
|
|
|
|
#ifndef cmCTestScriptHandler_h
|
|
|
|
#define cmCTestScriptHandler_h
|
|
|
|
|
|
|
|
|
2005-01-27 19:43:22 +03:00
|
|
|
#include "cmCTestGenericHandler.h"
|
2004-09-06 20:45:14 +04:00
|
|
|
#include "cmListFileCache.h"
|
|
|
|
|
|
|
|
class cmMakefile;
|
|
|
|
class cmLocalGenerator;
|
2004-09-07 17:17:15 +04:00
|
|
|
class cmGlobalGenerator;
|
|
|
|
class cmake;
|
2004-09-06 20:45:14 +04:00
|
|
|
|
|
|
|
/** \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_DASHBOARD_ROOT
|
|
|
|
* CTEST_ENVIRONMENT
|
|
|
|
* CTEST_INITIAL_CACHE
|
|
|
|
* CTEST_START_WITH_EMPTY_BINARY_DIRECTORY
|
|
|
|
* CTEST_START_WITH_EMPTY_BINARY_DIRECTORY_ONCE
|
|
|
|
*
|
|
|
|
* In addition the follwing variables can be used. The number can be 1-10.
|
|
|
|
* 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
|
|
|
|
*
|
2004-09-06 20:45:14 +04:00
|
|
|
*/
|
2005-01-27 19:43:22 +03:00
|
|
|
class cmCTestScriptHandler : public cmCTestGenericHandler
|
2004-09-06 20:45:14 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a script to run
|
|
|
|
*/
|
|
|
|
void AddConfigurationScript(const char *);
|
2005-01-27 23:54:47 +03:00
|
|
|
|
2004-09-06 20:45:14 +04:00
|
|
|
/**
|
|
|
|
* Run a dashboard using a specified confiuration script
|
|
|
|
*/
|
2005-01-27 23:54:47 +03:00
|
|
|
int ProcessHandler();
|
2005-01-27 18:11:04 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Run a script
|
|
|
|
*/
|
|
|
|
static bool RunScript(cmCTest* ctest, const char *script);
|
2005-01-27 19:01:56 +03:00
|
|
|
int RunCurrentScript();
|
2005-01-27 18:11:04 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Empty Binary Directory
|
|
|
|
*/
|
|
|
|
static bool EmptyBinaryDirectory(const char *dir);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Some elapsed time handling functions
|
|
|
|
*/
|
|
|
|
static void SleepInSeconds(unsigned int secondsToWait);
|
|
|
|
void UpdateElapsedTime();
|
|
|
|
|
2004-09-06 20:45:14 +04:00
|
|
|
cmCTestScriptHandler();
|
2004-09-06 22:17:20 +04:00
|
|
|
~cmCTestScriptHandler();
|
2004-09-06 20:45:14 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
// reads in a script
|
2005-01-27 19:43:22 +03:00
|
|
|
int ReadInScript(const std::string& total_script_arg);
|
2004-09-06 20:45:14 +04:00
|
|
|
|
|
|
|
// 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();
|
|
|
|
|
|
|
|
// backup and restore dirs
|
|
|
|
int BackupDirectories();
|
|
|
|
void RestoreBackupDirectories();
|
|
|
|
|
2005-01-27 19:43:22 +03:00
|
|
|
int RunConfigurationScript(const std::string& script);
|
2004-09-06 20:45:14 +04:00
|
|
|
int RunConfigurationDashboard();
|
|
|
|
|
|
|
|
std::vector<cmStdString> m_ConfigurationScripts;
|
|
|
|
|
|
|
|
bool m_Backup;
|
2004-09-29 01:51:29 +04:00
|
|
|
bool m_EmptyBinDir;
|
|
|
|
bool m_EmptyBinDirOnce;
|
2005-01-27 18:11:04 +03:00
|
|
|
|
2004-09-06 20:45:14 +04:00
|
|
|
cmStdString m_SourceDir;
|
|
|
|
cmStdString m_BinaryDir;
|
|
|
|
cmStdString m_BackupSourceDir;
|
|
|
|
cmStdString m_BackupBinaryDir;
|
|
|
|
cmStdString m_CTestRoot;
|
|
|
|
cmStdString m_CVSCheckOut;
|
|
|
|
cmStdString m_CTestCmd;
|
|
|
|
cmStdString m_CVSCmd;
|
2004-09-29 01:51:29 +04:00
|
|
|
cmStdString m_CTestEnv;
|
|
|
|
cmStdString m_InitCache;
|
|
|
|
cmStdString m_CMakeCmd;
|
|
|
|
cmStdString m_CMOutFile;
|
|
|
|
std::vector<cmStdString> m_ExtraUpdates;
|
2004-09-06 20:45:14 +04:00
|
|
|
|
|
|
|
double m_MinimumInterval;
|
2004-09-29 01:51:29 +04:00
|
|
|
double m_ContinuousDuration;
|
2005-01-27 18:11:04 +03:00
|
|
|
|
|
|
|
// what time in seconds did this script start running
|
|
|
|
double m_ScriptStartTime;
|
2004-09-06 20:45:14 +04:00
|
|
|
|
|
|
|
cmMakefile *m_Makefile;
|
|
|
|
cmLocalGenerator *m_LocalGenerator;
|
2004-09-07 17:17:15 +04:00
|
|
|
cmGlobalGenerator *m_GlobalGenerator;
|
|
|
|
cmake *m_CMake;
|
2004-09-06 20:45:14 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|