1515#include  " streams/tests/TestsWriter.h" 
1616#include  " types/Types.h" 
1717#include  " utils/ExecUtils.h" 
18- 
1918#include  " utils/path/FileSystemPath.h" 
19+ #include  " testgens/BaseTestGen.h" 
20+ 
2021#include  < optional> 
2122#include  < sstream> 
2223#include  < string> 
2324
25+ 
2426using  json = nlohmann::json;
2527
2628/* *
@@ -33,28 +35,16 @@ class KleeGenerator {
3335public: 
3436    /* *
3537     * @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. 
4339     * @param typesHandler provides additional information about types. 
4440     * @param filePathsSubstitution Mapping from source file path to modified file. Required for 
4541     * line test generation requests. 
4642     * @param buildDatabase Instance of BuildDatabase which handles link and compile commands 
4743     * @throws fs::filesystem_error Thrown if it can't create tmp folder for some 
4844     * reasons. 
4945     */  
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);
5848
5949    struct  BuildFileInfo  {
6050        fs::path outFilePath;
@@ -128,7 +118,7 @@ class KleeGenerator {
128118                           const  std::shared_ptr<LineInfo> &lineInfo = nullptr ,
129119                           bool  verbose = false );
130120
131-     [[nodiscard]] std::shared_ptr<BuildDatabase>  getBuildDatabase ( ) const ;
121+     [[nodiscard]] fs::path  getBitcodeFile ( const  fs::path &sourcePath ) const ;
132122
133123    void  handleFailedFunctions (tests::TestsMap &testsMap);
134124
@@ -146,29 +136,25 @@ class KleeGenerator {
146136    std::optional<utbot::CompileCommand>
147137    getCompileCommandForKlee (const  fs::path &hintPath,
148138                             const  CollectionUtils::FileSet &stubSources,
149-                              const  std::vector<std::string> &flags) const ;
139+                              const  std::vector<std::string> &flags,
140+                              bool  forStub) const ;
150141
151142    std::vector<utbot::CompileCommand>
152143    getCompileCommandsForKlee (const  CollectionUtils::MapFileTo<fs::path> &filesToBuild,
153144                              const  CollectionUtils::FileSet &stubSources) const ;
154145
155146private: 
156-     const  utbot::ProjectContext projectContext;
157-     const  utbot::SettingsContext settingsContext;
158-     fs::path projectTmpPath;
159-     std::shared_ptr<CompilationDatabase> compilationDatabase;
147+     BaseTestGen *testGen;
160148    types::TypesHandler typesHandler;
161149    PathSubstitution pathSubstitution;
162-     std::shared_ptr<BuildDatabase> buildDatabase;
163-     const  ProgressWriter *progressWriter;
164150
165151    CollectionUtils::MapFileTo<std::vector<std::string>> failedFunctions;
166152
167153    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 =
172158            [](tests::Tests::MethodDescription const  &) { return  true ; });
173159};
174160
0 commit comments