diff --git a/server/src/Server.cpp b/server/src/Server.cpp index aa042099f..ca914c294 100644 --- a/server/src/Server.cpp +++ b/server/src/Server.cpp @@ -209,10 +209,6 @@ Status Server::TestsGenServiceImpl::ProcessBaseTestRequest(BaseTestGen &testGen, Synchronizer synchronizer(&testGen, &stubGen, &sizeContext); synchronizer.synchronize(typesHandler); - if(testGen.settingsContext.useStubs) { - testsWriter->writeStubs(testGen.synchronizedStubs); - } - std::shared_ptr lineInfo = nullptr; auto lineTestGen = dynamic_cast(&testGen); diff --git a/server/src/Synchronizer.cpp b/server/src/Synchronizer.cpp index c1342932d..cc979a6b6 100644 --- a/server/src/Synchronizer.cpp +++ b/server/src/Synchronizer.cpp @@ -114,8 +114,10 @@ void Synchronizer::synchronize(const types::TypesHandler &typesHandler) { return; } auto outdatedSourcePaths = getOutdatedSourcePaths(); - auto outdatedStubs = getStubSetFromSources(outdatedSourcePaths); - synchronizeStubs(outdatedStubs, typesHandler); + if (testGen->settingsContext.useStubs) { + auto outdatedStubs = getStubSetFromSources(outdatedSourcePaths); + synchronizeStubs(outdatedStubs, typesHandler); + } synchronizeWrappers(outdatedSourcePaths); } diff --git a/server/src/streams/tests/ServerTestsWriter.cpp b/server/src/streams/tests/ServerTestsWriter.cpp index 234163ba2..52f91f7c4 100644 --- a/server/src/streams/tests/ServerTestsWriter.cpp +++ b/server/src/streams/tests/ServerTestsWriter.cpp @@ -23,19 +23,6 @@ void ServerTestsWriter::writeTestsWithProgress(tests::TestsMap &testMap, writeCompleted(testMap, totalTestsCounter); } -void ServerTestsWriter::writeStubs(const std::vector &synchronizedStubs) { - testsgen::TestsResponse response; - auto stubsResponse = std::make_unique(); - for (auto const &synchronizedStub : synchronizedStubs) { - auto sData = stubsResponse->add_stubsources(); - sData->set_filepath(synchronizedStub.filePath); - if (synchronizeCode) { - sData->set_code(synchronizedStub.code); - } - } - response.set_allocated_stubs(stubsResponse.release()); -} - bool ServerTestsWriter::writeFileAndSendResponse(const tests::Tests &tests, const fs::path &testDirPath, const std::string &message, diff --git a/server/src/streams/tests/ServerTestsWriter.h b/server/src/streams/tests/ServerTestsWriter.h index dfbc55b79..8b825b6a6 100644 --- a/server/src/streams/tests/ServerTestsWriter.h +++ b/server/src/streams/tests/ServerTestsWriter.h @@ -18,8 +18,6 @@ class ServerTestsWriter : public TestsWriter { const fs::path &testDirPath, std::function &&functor) override; - void writeStubs(const std::vector &synchronizedStubs) override; - private: [[nodiscard]] virtual bool writeFileAndSendResponse(const tests::Tests &tests, const fs::path &testDirPath, diff --git a/server/src/streams/tests/TestsWriter.h b/server/src/streams/tests/TestsWriter.h index 668f4d5fd..970b931fb 100644 --- a/server/src/streams/tests/TestsWriter.h +++ b/server/src/streams/tests/TestsWriter.h @@ -20,10 +20,6 @@ class TestsWriter : public utbot::ServerWriter { const fs::path &testDirPath, std::function &&functor) = 0; - virtual void writeStubs(const std::vector &synchronizedStubs) { - // Default implementation is empty. - } - protected: void writeCompleted(tests::TestsMap const &testMap, int totalTestsCounter); diff --git a/server/test/framework/Library_Test.cpp b/server/test/framework/Library_Test.cpp index 78e9e3a9b..8f22fb2fe 100644 --- a/server/test/framework/Library_Test.cpp +++ b/server/test/framework/Library_Test.cpp @@ -20,7 +20,7 @@ namespace { std::pair createTestForFunction(const fs::path &pathToFile, int lineNum, int kleeTimeout = 60) { auto lineRequest = testUtils::createLineRequest(projectName, suitePath, buildDirRelativePath, - srcPaths, pathToFile, lineNum, false, kleeTimeout); + srcPaths, pathToFile, lineNum, true, false, kleeTimeout); auto request = GrpcUtils::createFunctionRequest(std::move(lineRequest)); auto testGen = FunctionTestGen(*request, writer.get(), TESTMODE); testGen.setTargetForSource(pathToFile); diff --git a/server/test/framework/Regression_Tests.cpp b/server/test/framework/Regression_Tests.cpp index 834a230d7..c60ac0807 100644 --- a/server/test/framework/Regression_Tests.cpp +++ b/server/test/framework/Regression_Tests.cpp @@ -28,7 +28,7 @@ namespace { std::pair createTestForFunction(const fs::path &pathToFile, int lineNum, bool verbose = true) { auto lineRequest = createLineRequest(projectName, suitePath, buildDirRelativePath, - srcPaths, pathToFile, lineNum, verbose); + srcPaths, pathToFile, lineNum, false, verbose, 0); auto request = GrpcUtils::createFunctionRequest(std::move(lineRequest)); auto testGen = FunctionTestGen(*request, writer.get(), TESTMODE); testGen.setTargetForSource(pathToFile); diff --git a/server/test/framework/Server_Tests.cpp b/server/test/framework/Server_Tests.cpp index 629057150..7173db1f6 100644 --- a/server/test/framework/Server_Tests.cpp +++ b/server/test/framework/Server_Tests.cpp @@ -1005,7 +1005,7 @@ namespace { TEST_P(Parameterized_Server_Test, Line_Test1) { auto request = createLineRequest(projectName, suitePath, buildDirRelativePath, srcPaths, - basic_functions_c, 17); + basic_functions_c, 17, false, false, 0); auto testGen = LineTestGen(*request, writer.get(), TESTMODE); testGen.setTargetForSource(basic_functions_c); Status status = Server::TestsGenServiceImpl::ProcessBaseTestRequest(testGen, writer.get()); @@ -1022,7 +1022,7 @@ namespace { TEST_P(Parameterized_Server_Test, Line_Test2) { auto request = createLineRequest(projectName, suitePath, buildDirRelativePath, srcPaths, - basic_functions_c, 17); + basic_functions_c, 17, false, false, 0); auto testGen = LineTestGen(*request, writer.get(), TESTMODE); testGen.setTargetForSource(basic_functions_c); Status status = Server::TestsGenServiceImpl::ProcessBaseTestRequest(testGen, writer.get()); @@ -1085,7 +1085,7 @@ namespace { TEST_P(Parameterized_Server_Test, Function_Test) { auto lineRequest = createLineRequest(projectName, suitePath, buildDirRelativePath, srcPaths, - basic_functions_c, 6); + basic_functions_c, 6, false, false, 0); auto request = GrpcUtils::createFunctionRequest(std::move(lineRequest)); auto testGen = FunctionTestGen(*request, writer.get(), TESTMODE); testGen.setTargetForSource(basic_functions_c); @@ -1113,7 +1113,7 @@ namespace { TEST_P(Parameterized_Server_Test, Predicate_Test_Integer) { auto lineRequest = createLineRequest(projectName, suitePath, buildDirRelativePath, srcPaths, - basic_functions_c, 17); + basic_functions_c, 17, false, false, 0); auto predicateInfo = std::make_unique(); predicateInfo->set_predicate("=="); predicateInfo->set_returnvalue("36"); @@ -1136,7 +1136,7 @@ namespace { TEST_P(Parameterized_Server_Test, Predicate_Test_Str) { auto lineRequest = createLineRequest(projectName, suitePath, buildDirRelativePath, srcPaths, - basic_functions_c, 32); + basic_functions_c, 32, false, false, 0); auto predicateInfo = std::make_unique(); predicateInfo->set_predicate("=="); predicateInfo->set_returnvalue("abacaba"); @@ -1160,7 +1160,7 @@ namespace { TEST_P(Parameterized_Server_Test, Symbolic_Stdin_Test) { auto request = std::make_unique(); auto lineRequest = createLineRequest(projectName, suitePath, buildDirRelativePath, srcPaths, - symbolic_stdin_c, 8); + symbolic_stdin_c, 8, false, false, 0); request->set_allocated_linerequest(lineRequest.release()); auto testGen = FunctionTestGen(*request, writer.get(), TESTMODE); testGen.setTargetForSource(symbolic_stdin_c); @@ -1182,7 +1182,7 @@ namespace { TEST_P(Parameterized_Server_Test, Symbolic_Stdin_Long_Read) { auto request = std::make_unique(); auto lineRequest = createLineRequest(projectName, suitePath, buildDirRelativePath, srcPaths, - symbolic_stdin_c, 19); + symbolic_stdin_c, 19, false, false, 0); request->set_allocated_linerequest(lineRequest.release()); auto testGen = FunctionTestGen(*request, writer.get(), TESTMODE); testGen.setTargetForSource(symbolic_stdin_c); diff --git a/server/test/framework/Syntax_Tests.cpp b/server/test/framework/Syntax_Tests.cpp index d5e8fe0e8..3ffd51391 100644 --- a/server/test/framework/Syntax_Tests.cpp +++ b/server/test/framework/Syntax_Tests.cpp @@ -80,7 +80,7 @@ namespace { std::pair createTestForFunction(const fs::path &pathToFile, int lineNum, int kleeTimeout = 60) { auto lineRequest = createLineRequest(projectName, suitePath, buildDirRelativePath, - srcPaths, pathToFile, lineNum, false, kleeTimeout); + srcPaths, pathToFile, lineNum, false, false, kleeTimeout); auto request = GrpcUtils::createFunctionRequest(std::move(lineRequest)); auto testGen = FunctionTestGen(*request, writer.get(), TESTMODE); testGen.setTargetForSource(pathToFile); diff --git a/server/test/framework/TestUtils.cpp b/server/test/framework/TestUtils.cpp index de489632a..5424967fb 100644 --- a/server/test/framework/TestUtils.cpp +++ b/server/test/framework/TestUtils.cpp @@ -207,16 +207,13 @@ namespace testUtils { return GrpcUtils::createFileRequest(std::move(projectRequest), filePath); } - std::unique_ptr createLineRequest(const std::string &projectName, - const fs::path &projectPath, + std::unique_ptr createLineRequest(const std::string &projectName, const fs::path &projectPath, const std::string &buildDirRelativePath, - const std::vector &srcPaths, - const fs::path &filePath, - int line, - bool verbose, - int kleeTimeout) { + const std::vector &srcPaths, const fs::path &filePath, + int line, bool useStubs, + bool verbose, int kleeTimeout) { auto projectRequest = createProjectRequest(projectName, projectPath, buildDirRelativePath, - srcPaths, false, verbose, kleeTimeout); + srcPaths, useStubs, verbose, kleeTimeout); auto lineInfo = GrpcUtils::createSourceInfo(filePath, line); return GrpcUtils::createLineRequest(std::move(projectRequest), std::move(lineInfo)); } @@ -230,7 +227,7 @@ namespace testUtils { bool verbose, int kleeTimeout) { auto lineRequest = createLineRequest(projectName, projectPath, buildDirRelativePath, - srcPaths, filePath, line, verbose, kleeTimeout); + srcPaths, filePath, line, false, verbose, kleeTimeout); return GrpcUtils::createClassRequest(std::move(lineRequest)); } diff --git a/server/test/framework/TestUtils.h b/server/test/framework/TestUtils.h index 170b046d6..438b7fd6a 100644 --- a/server/test/framework/TestUtils.h +++ b/server/test/framework/TestUtils.h @@ -74,14 +74,11 @@ namespace testUtils { bool useStubs = false, bool verbose = true); - std::unique_ptr createLineRequest(const std::string &projectName, - const fs::path &projectPath, + std::unique_ptr createLineRequest(const std::string &projectName, const fs::path &projectPath, const std::string &buildDirRelativePath, - const std::vector &srcPaths, - const fs::path &filePath, - int line, - bool verbose = true, - int kleeTimeout = 60); + const std::vector &srcPaths, const fs::path &filePath, + int line, bool useStubs, + bool verbose, int kleeTimeout); std::unique_ptr createClassRequest(const std::string &projectName, const fs::path &projectPath, diff --git a/submodules/klee b/submodules/klee index e1a2b064f..73701e2df 160000 --- a/submodules/klee +++ b/submodules/klee @@ -1 +1 @@ -Subproject commit e1a2b064fcb0fe4a891c18f6310334b4ff6a87f7 +Subproject commit 73701e2df1f2ba7a5f34a3f678887cc9d2e444f5