15
15
#include " streams/tests/TestsWriter.h"
16
16
#include " types/Types.h"
17
17
#include " utils/ExecUtils.h"
18
-
19
18
#include " utils/path/FileSystemPath.h"
19
+ #include " testgens/BaseTestGen.h"
20
+
20
21
#include < optional>
21
22
#include < sstream>
22
23
#include < string>
23
24
25
+
24
26
using json = nlohmann::json;
25
27
26
28
/* *
@@ -33,28 +35,16 @@ class KleeGenerator {
33
35
public:
34
36
/* *
35
37
* @brief Also creates tmp directories for build files.
36
- * @param projectContext contains context about current project.
37
- * @param settingsContext contains context about settings applied for current request.
38
- * @param serverBuildDir Path to folder on server machine where project build dirs are located.
39
- * @param sourcesFilePaths Paths to project files. Files which are listed in
40
- * [compile_commands.json](https://clang.llvm.org/docs/JSONCompilationDatabase.html), filtered
41
- * by them.
42
- * @param compilationDatabase Pointer to compile_commands.json object.
38
+ * @param testGen contains request and build information.
43
39
* @param typesHandler provides additional information about types.
44
40
* @param filePathsSubstitution Mapping from source file path to modified file. Required for
45
41
* line test generation requests.
46
42
* @param buildDatabase Instance of BuildDatabase which handles link and compile commands
47
43
* @throws fs::filesystem_error Thrown if it can't create tmp folder for some
48
44
* reasons.
49
45
*/
50
- KleeGenerator (utbot::ProjectContext projectContext,
51
- utbot::SettingsContext settingsContext,
52
- fs::path serverBuildDir,
53
- std::shared_ptr<CompilationDatabase> compilationDatabase,
54
- types::TypesHandler &typesHandler,
55
- PathSubstitution filePathsSubstitution,
56
- std::shared_ptr<BuildDatabase> buildDatabase = nullptr ,
57
- const ProgressWriter *progressWriter = DummyStreamWriter::getInstance());
46
+ KleeGenerator (BaseTestGen *testGen, types::TypesHandler &typesHandler,
47
+ PathSubstitution filePathsSubstitution);
58
48
59
49
struct BuildFileInfo {
60
50
fs::path outFilePath;
@@ -128,7 +118,7 @@ class KleeGenerator {
128
118
const std::shared_ptr<LineInfo> &lineInfo = nullptr ,
129
119
bool verbose = false );
130
120
131
- [[nodiscard]] std::shared_ptr<BuildDatabase> getBuildDatabase ( ) const ;
121
+ [[nodiscard]] fs::path getBitcodeFile ( const fs::path &sourcePath ) const ;
132
122
133
123
void handleFailedFunctions (tests::TestsMap &testsMap);
134
124
@@ -146,29 +136,25 @@ class KleeGenerator {
146
136
std::optional<utbot::CompileCommand>
147
137
getCompileCommandForKlee (const fs::path &hintPath,
148
138
const CollectionUtils::FileSet &stubSources,
149
- const std::vector<std::string> &flags) const ;
139
+ const std::vector<std::string> &flags,
140
+ bool forStub) const ;
150
141
151
142
std::vector<utbot::CompileCommand>
152
143
getCompileCommandsForKlee (const CollectionUtils::MapFileTo<fs::path> &filesToBuild,
153
144
const CollectionUtils::FileSet &stubSources) const ;
154
145
155
146
private:
156
- const utbot::ProjectContext projectContext;
157
- const utbot::SettingsContext settingsContext;
158
- fs::path projectTmpPath;
159
- std::shared_ptr<CompilationDatabase> compilationDatabase;
147
+ BaseTestGen *testGen;
160
148
types::TypesHandler typesHandler;
161
149
PathSubstitution pathSubstitution;
162
- std::shared_ptr<BuildDatabase> buildDatabase;
163
- const ProgressWriter *progressWriter;
164
150
165
151
CollectionUtils::MapFileTo<std::vector<std::string>> failedFunctions;
166
152
167
153
fs::path writeKleeFile (
168
- printer::KleePrinter &kleePrinter,
169
- Tests const &tests,
170
- const std::shared_ptr<LineInfo> &lineInfo,
171
- const std::function<bool (tests::Tests::MethodDescription const &)> &methodFilter =
154
+ printer::KleePrinter &kleePrinter,
155
+ Tests const &tests,
156
+ const std::shared_ptr<LineInfo> &lineInfo,
157
+ const std::function<bool (tests::Tests::MethodDescription const &)> &methodFilter =
172
158
[](tests::Tests::MethodDescription const &) { return true ; });
173
159
};
174
160
0 commit comments