OpenASIP
2.0
|
#include <TestApplication.hh>
Public Types | |
typedef double | Runtime |
typedef int | ClockCycles |
Public Member Functions | |
TestApplication (const std::string &testApplicationPath) | |
virtual | ~TestApplication () |
std::vector< std::string > | description () const |
bool | hasApplication () const |
bool | hasSetupSimulation () const |
bool | hasSimulateTTASim () const |
bool | hasCorrectOutput () const |
bool | hasVerifySimulation () const |
bool | hasCleanupSimulation () const |
bool | isValid () const |
const std::string | applicationPath () const |
void | setupSimulation () const |
std::istream * | simulateTTASim () const |
const std::string | correctOutput () const |
bool | verifySimulation () const |
void | cleanupSimulation () const |
ClockCycles | cycleCount () const |
Runtime | maxRuntime () const |
Private Attributes | |
const std::string | testApplicationPath_ |
Path of the test application directory. More... | |
Runtime | maxRuntime_ |
Maximum runtime of the test appication in nano seconds. More... | |
Static Private Attributes | |
static const std::string | DESCRIPTION_FILE_NAME_ = "description.txt" |
File name of the description text for the application. More... | |
static const std::string | APPLICATION_BASE_FILE_NAME_ = "program" |
Name of the sequential program file. Base name of the file that contains the fully linked program. The actual file name will be formed by appending either .bc or .ll, whichever is found first. More... | |
static const std::string | SETUP_FILE_NAME_ = "setup.sh" |
Name of the file that contains setup script. More... | |
static const std::string | SIMULATE_TTASIM_FILE_NAME_ = "simulate.ttasim" |
Name of the file that runs the simulation. More... | |
static const std::string | CORRECT_OUTPUT_FILE_NAME_ = "correct_simulation_output" |
Name of the correct simulation output file. More... | |
static const std::string | VERIFY_FILE_NAME_ = "verify.sh" |
Name of the verify script file. More... | |
static const std::string | CLEANUP_FILE_NAME_ = "cleanup.sh" |
Name of the clean up file. More... | |
static const std::string | MAX_RUNTIME_ = "max_runtime" |
Name of the file that contains maximum runtime. More... | |
static const int | MAX_LINE_LENGTH_ = 512 |
Maximum line length in a file. More... | |
Class for handling files in test application directory.
Definition at line 46 of file TestApplication.hh.
typedef int TestApplication::ClockCycles |
Definition at line 49 of file TestApplication.hh.
typedef double TestApplication::Runtime |
Definition at line 48 of file TestApplication.hh.
TestApplication::TestApplication | ( | const std::string & | testApplicationPath | ) |
Constructor.
testApplicationPath | Path of the test application directory. |
Definition at line 60 of file TestApplication.cc.
References __func__, FileSystem::DIRECTORY_SEPARATOR, Exception::errorMessage(), FileSystem::fileExists(), MAX_LINE_LENGTH_, MAX_RUNTIME_, maxRuntime_, testApplicationPath_, and Conversion::toDouble().
|
virtual |
const std::string TestApplication::applicationPath | ( | ) | const |
Returns the application path in the test application directory.
If the file 'sequential_program' does not exists returns an empty string.
Definition at line 312 of file TestApplication.cc.
References APPLICATION_BASE_FILE_NAME_, FileSystem::DIRECTORY_SEPARATOR, FileSystem::fileExists(), hasApplication(), and testApplicationPath_.
Referenced by DesignSpaceExplorer::evaluate(), and SimpleICOptimizer::explore().
void TestApplication::cleanupSimulation | ( | ) | const |
Cleans up the previous simulation run.
Uses 'cleanup.sh' script if it exists.
Definition at line 208 of file TestApplication.cc.
References CLEANUP_FILE_NAME_, FileSystem::DIRECTORY_SEPARATOR, FileSystem::fileExists(), FileSystem::runShellCommand(), and testApplicationPath_.
const std::string TestApplication::correctOutput | ( | ) | const |
Returns the correct output from file 'correct_simulation_output' as string.
Definition at line 140 of file TestApplication.cc.
References CORRECT_OUTPUT_FILE_NAME_, FileSystem::DIRECTORY_SEPARATOR, FileSystem::fileExists(), and testApplicationPath_.
Referenced by DesignSpaceExplorer::evaluate().
ClockCycles TestApplication::cycleCount | ( | ) | const |
std::vector< std::string > TestApplication::description | ( | ) | const |
Returns the test application description.
The description is given in the description.txt file of the test application directory.
Definition at line 97 of file TestApplication.cc.
References DESCRIPTION_FILE_NAME_, FileSystem::DIRECTORY_SEPARATOR, FileSystem::fileExists(), MAX_LINE_LENGTH_, and testApplicationPath_.
bool TestApplication::hasApplication | ( | ) | const |
Returns true if 'sequential_program' file is in the test application directory.
Definition at line 230 of file TestApplication.cc.
References APPLICATION_BASE_FILE_NAME_, FileSystem::DIRECTORY_SEPARATOR, FileSystem::fileExists(), and testApplicationPath_.
Referenced by applicationPath(), and isValid().
bool TestApplication::hasCleanupSimulation | ( | ) | const |
Returns true if 'cleanup.sh' file is in the test application directory.
Definition at line 296 of file TestApplication.cc.
References CLEANUP_FILE_NAME_, FileSystem::DIRECTORY_SEPARATOR, FileSystem::fileExists(), and testApplicationPath_.
bool TestApplication::hasCorrectOutput | ( | ) | const |
Returns true if 'correct_simulation_output' file is in the test application directory.
Definition at line 272 of file TestApplication.cc.
References CORRECT_OUTPUT_FILE_NAME_, FileSystem::DIRECTORY_SEPARATOR, FileSystem::fileExists(), and testApplicationPath_.
Referenced by DesignSpaceExplorer::evaluate(), and isValid().
bool TestApplication::hasSetupSimulation | ( | ) | const |
Returns true if 'setup.sh' file is in the test application directory.
Definition at line 247 of file TestApplication.cc.
References FileSystem::DIRECTORY_SEPARATOR, FileSystem::fileExists(), SETUP_FILE_NAME_, and testApplicationPath_.
bool TestApplication::hasSimulateTTASim | ( | ) | const |
Returns true if 'simulate.ttasim' file is in the test application directory.
Definition at line 259 of file TestApplication.cc.
References FileSystem::DIRECTORY_SEPARATOR, FileSystem::fileExists(), SIMULATE_TTASIM_FILE_NAME_, and testApplicationPath_.
Referenced by DesignSpaceExplorer::simulate(), and simulateTTASim().
bool TestApplication::hasVerifySimulation | ( | ) | const |
Returns true if 'verify.sh' file is in the test application directory.
Definition at line 284 of file TestApplication.cc.
References FileSystem::DIRECTORY_SEPARATOR, FileSystem::fileExists(), testApplicationPath_, and VERIFY_FILE_NAME_.
Referenced by isValid().
|
inline |
Definition at line 62 of file TestApplication.hh.
References hasApplication(), hasCorrectOutput(), and hasVerifySimulation().
Referenced by main().
TestApplication::Runtime TestApplication::maxRuntime | ( | ) | const |
Returns the maximum runtime that is set in file "max_runtime".
Definition at line 221 of file TestApplication.cc.
References maxRuntime_.
Referenced by FrequencySweepExplorer::fastEnough(), and MinimizeMachine::minimizeMachine().
void TestApplication::setupSimulation | ( | ) | const |
Set up the simulation run.
Uses 'setup.sh' to set up the simulation run.
Definition at line 168 of file TestApplication.cc.
References FileSystem::DIRECTORY_SEPARATOR, FileSystem::fileExists(), FileSystem::runShellCommand(), SETUP_FILE_NAME_, and testApplicationPath_.
Referenced by DesignSpaceExplorer::simulate().
std::istream * TestApplication::simulateTTASim | ( | ) | const |
Returns a istream to 'simulate.ttasim' file.
Client takes responsibility of destroying the stream.
Definition at line 186 of file TestApplication.cc.
References FileSystem::DIRECTORY_SEPARATOR, hasSimulateTTASim(), SIMULATE_TTASIM_FILE_NAME_, and testApplicationPath_.
Referenced by DesignSpaceExplorer::simulate().
bool TestApplication::verifySimulation | ( | ) | const |
Verifies the previous simulation run.
Uses 'verify.sh' to verify the previous simulation run.
Definition at line 122 of file TestApplication.cc.
References FileSystem::DIRECTORY_SEPARATOR, FileSystem::fileExists(), FileSystem::runShellCommand(), testApplicationPath_, and VERIFY_FILE_NAME_.
|
staticprivate |
Name of the sequential program file. Base name of the file that contains the fully linked program. The actual file name will be formed by appending either .bc or .ll, whichever is found first.
Definition at line 88 of file TestApplication.hh.
Referenced by applicationPath(), and hasApplication().
|
staticprivate |
Name of the clean up file.
Definition at line 98 of file TestApplication.hh.
Referenced by cleanupSimulation(), and hasCleanupSimulation().
|
staticprivate |
Name of the correct simulation output file.
Definition at line 94 of file TestApplication.hh.
Referenced by correctOutput(), and hasCorrectOutput().
|
staticprivate |
File name of the description text for the application.
Definition at line 83 of file TestApplication.hh.
Referenced by description().
|
staticprivate |
Maximum line length in a file.
Definition at line 102 of file TestApplication.hh.
Referenced by description(), and TestApplication().
|
staticprivate |
Name of the file that contains maximum runtime.
Definition at line 100 of file TestApplication.hh.
Referenced by TestApplication().
|
private |
Maximum runtime of the test appication in nano seconds.
Definition at line 80 of file TestApplication.hh.
Referenced by maxRuntime(), and TestApplication().
|
staticprivate |
Name of the file that contains setup script.
Definition at line 90 of file TestApplication.hh.
Referenced by hasSetupSimulation(), and setupSimulation().
|
staticprivate |
Name of the file that runs the simulation.
Definition at line 92 of file TestApplication.hh.
Referenced by hasSimulateTTASim(), and simulateTTASim().
|
private |
Path of the test application directory.
Definition at line 78 of file TestApplication.hh.
Referenced by applicationPath(), cleanupSimulation(), correctOutput(), description(), hasApplication(), hasCleanupSimulation(), hasCorrectOutput(), hasSetupSimulation(), hasSimulateTTASim(), hasVerifySimulation(), setupSimulation(), simulateTTASim(), TestApplication(), and verifySimulation().
|
staticprivate |
Name of the verify script file.
Definition at line 96 of file TestApplication.hh.
Referenced by hasVerifySimulation(), and verifySimulation().