OpenASIP  2.0
TestApplication.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2012 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file TestApplication.hh
26  *
27  * Declaration of TestApplication class.
28  *
29  * @author Jari Mäntyneva 2007 (jari.mantyneva-no.spam-tut.fi)
30  * @author Pekka Jääskeläinen 2012
31  * @note rating: red
32  */
33 
34 #ifndef TTA_TEST_APPLICATION_HH
35 #define TTA_TEST_APPLICATION_HH
36 
37 #include <string>
38 #include <vector>
39 #include <sstream>
40 #include "Exception.hh"
41 
42 
43 /**
44  * Class for handling files in test application directory.
45  */
47 public:
48  typedef double Runtime;
49  typedef int ClockCycles;
50 
51  TestApplication(const std::string& testApplicationPath);
52  virtual ~TestApplication();
53 
54  std::vector<std::string> description() const;
55 
56  bool hasApplication() const;
57  bool hasSetupSimulation() const;
58  bool hasSimulateTTASim() const;
59  bool hasCorrectOutput() const;
60  bool hasVerifySimulation() const;
61  bool hasCleanupSimulation() const;
62  bool isValid() const {
63  return hasApplication() &&
65  }
66 
67  const std::string applicationPath() const;
68  void setupSimulation() const;
69  std::istream* simulateTTASim() const;
70  const std::string correctOutput() const;
71  bool verifySimulation() const;
72  void cleanupSimulation() const;
73  ClockCycles cycleCount() const;
74  Runtime maxRuntime() const;
75 
76 private:
77  /// Path of the test application directory.
78  const std::string testApplicationPath_;
79  /// Maximum runtime of the test appication in nano seconds
81 
82  /// File name of the description text for the application.
83  static const std::string DESCRIPTION_FILE_NAME_;
84  /// Name of the sequential program file.
85  /// Base name of the file that contains the fully linked program.
86  /// The actual file name will be formed by appending either .bc or .ll,
87  /// whichever is found first.
88  static const std::string APPLICATION_BASE_FILE_NAME_;
89  /// Name of the file that contains setup script.
90  static const std::string SETUP_FILE_NAME_;
91  /// Name of the file that runs the simulation.
92  static const std::string SIMULATE_TTASIM_FILE_NAME_;
93  /// Name of the correct simulation output file.
94  static const std::string CORRECT_OUTPUT_FILE_NAME_;
95  /// Name of the verify script file.
96  static const std::string VERIFY_FILE_NAME_;
97  /// Name of the clean up file.
98  static const std::string CLEANUP_FILE_NAME_;
99  /// Name of the file that contains maximum runtime.
100  static const std::string MAX_RUNTIME_;
101  /// Maximum line length in a file.
102  static const int MAX_LINE_LENGTH_;
103 };
104 
105 
106 
107 
108 #endif
TestApplication::simulateTTASim
std::istream * simulateTTASim() const
Definition: TestApplication.cc:186
TestApplication::setupSimulation
void setupSimulation() const
Definition: TestApplication.cc:168
TestApplication::applicationPath
const std::string applicationPath() const
Definition: TestApplication.cc:312
TestApplication::maxRuntime_
Runtime maxRuntime_
Maximum runtime of the test appication in nano seconds.
Definition: TestApplication.hh:80
Exception.hh
TestApplication::correctOutput
const std::string correctOutput() const
Definition: TestApplication.cc:140
TestApplication::hasCleanupSimulation
bool hasCleanupSimulation() const
Definition: TestApplication.cc:296
TestApplication::CLEANUP_FILE_NAME_
static const std::string CLEANUP_FILE_NAME_
Name of the clean up file.
Definition: TestApplication.hh:98
TestApplication::DESCRIPTION_FILE_NAME_
static const std::string DESCRIPTION_FILE_NAME_
File name of the description text for the application.
Definition: TestApplication.hh:83
TestApplication::hasSimulateTTASim
bool hasSimulateTTASim() const
Definition: TestApplication.cc:259
TestApplication::maxRuntime
Runtime maxRuntime() const
Definition: TestApplication.cc:221
TestApplication::cycleCount
ClockCycles cycleCount() const
TestApplication::isValid
bool isValid() const
Definition: TestApplication.hh:62
TestApplication::ClockCycles
int ClockCycles
Definition: TestApplication.hh:49
TestApplication::hasApplication
bool hasApplication() const
Definition: TestApplication.cc:230
TestApplication::TestApplication
TestApplication(const std::string &testApplicationPath)
Definition: TestApplication.cc:60
TestApplication::hasVerifySimulation
bool hasVerifySimulation() const
Definition: TestApplication.cc:284
TestApplication::verifySimulation
bool verifySimulation() const
Definition: TestApplication.cc:122
TestApplication::CORRECT_OUTPUT_FILE_NAME_
static const std::string CORRECT_OUTPUT_FILE_NAME_
Name of the correct simulation output file.
Definition: TestApplication.hh:94
TestApplication::MAX_LINE_LENGTH_
static const int MAX_LINE_LENGTH_
Maximum line length in a file.
Definition: TestApplication.hh:102
TestApplication::SETUP_FILE_NAME_
static const std::string SETUP_FILE_NAME_
Name of the file that contains setup script.
Definition: TestApplication.hh:90
TestApplication::hasSetupSimulation
bool hasSetupSimulation() const
Definition: TestApplication.cc:247
TestApplication::cleanupSimulation
void cleanupSimulation() const
Definition: TestApplication.cc:208
TestApplication::description
std::vector< std::string > description() const
Definition: TestApplication.cc:97
TestApplication::Runtime
double Runtime
Definition: TestApplication.hh:48
TestApplication::SIMULATE_TTASIM_FILE_NAME_
static const std::string SIMULATE_TTASIM_FILE_NAME_
Name of the file that runs the simulation.
Definition: TestApplication.hh:92
TestApplication::MAX_RUNTIME_
static const std::string MAX_RUNTIME_
Name of the file that contains maximum runtime.
Definition: TestApplication.hh:100
TestApplication::APPLICATION_BASE_FILE_NAME_
static const std::string APPLICATION_BASE_FILE_NAME_
Name of the sequential program file. Base name of the file that contains the fully linked program....
Definition: TestApplication.hh:88
TestApplication::testApplicationPath_
const std::string testApplicationPath_
Path of the test application directory.
Definition: TestApplication.hh:78
TestApplication::VERIFY_FILE_NAME_
static const std::string VERIFY_FILE_NAME_
Name of the verify script file.
Definition: TestApplication.hh:96
TestApplication::~TestApplication
virtual ~TestApplication()
Definition: TestApplication.cc:84
TestApplication::hasCorrectOutput
bool hasCorrectOutput() const
Definition: TestApplication.cc:272
TestApplication
Definition: TestApplication.hh:46