Skip to content

Fix disable stubs #289

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions server/src/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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> lineInfo = nullptr;
auto lineTestGen = dynamic_cast<LineTestGen *>(&testGen);

Expand Down
6 changes: 4 additions & 2 deletions server/src/Synchronizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
13 changes: 0 additions & 13 deletions server/src/streams/tests/ServerTestsWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,6 @@ void ServerTestsWriter::writeTestsWithProgress(tests::TestsMap &testMap,
writeCompleted(testMap, totalTestsCounter);
}

void ServerTestsWriter::writeStubs(const std::vector<Stubs> &synchronizedStubs) {
testsgen::TestsResponse response;
auto stubsResponse = std::make_unique<testsgen::StubsResponse>();
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,
Expand Down
2 changes: 0 additions & 2 deletions server/src/streams/tests/ServerTestsWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ class ServerTestsWriter : public TestsWriter {
const fs::path &testDirPath,
std::function<void(tests::Tests &)> &&functor) override;

void writeStubs(const std::vector<Stubs> &synchronizedStubs) override;

private:
[[nodiscard]] virtual bool writeFileAndSendResponse(const tests::Tests &tests,
const fs::path &testDirPath,
Expand Down
4 changes: 0 additions & 4 deletions server/src/streams/tests/TestsWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ class TestsWriter : public utbot::ServerWriter<testsgen::TestsResponse> {
const fs::path &testDirPath,
std::function<void(tests::Tests &)> &&functor) = 0;

virtual void writeStubs(const std::vector<Stubs> &synchronizedStubs) {
// Default implementation is empty.
}

protected:
void writeCompleted(tests::TestsMap const &testMap, int totalTestsCounter);

Expand Down
2 changes: 1 addition & 1 deletion server/test/framework/Library_Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace {
std::pair<FunctionTestGen, Status>
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);
Expand Down
2 changes: 1 addition & 1 deletion server/test/framework/Regression_Tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace {
std::pair<FunctionTestGen, Status>
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);
Expand Down
14 changes: 7 additions & 7 deletions server/test/framework/Server_Tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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());
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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<testsgen::PredicateInfo>();
predicateInfo->set_predicate("==");
predicateInfo->set_returnvalue("36");
Expand All @@ -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<testsgen::PredicateInfo>();
predicateInfo->set_predicate("==");
predicateInfo->set_returnvalue("abacaba");
Expand All @@ -1160,7 +1160,7 @@ namespace {
TEST_P(Parameterized_Server_Test, Symbolic_Stdin_Test) {
auto request = std::make_unique<FunctionRequest>();
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);
Expand All @@ -1182,7 +1182,7 @@ namespace {
TEST_P(Parameterized_Server_Test, Symbolic_Stdin_Long_Read) {
auto request = std::make_unique<FunctionRequest>();
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);
Expand Down
2 changes: 1 addition & 1 deletion server/test/framework/Syntax_Tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ namespace {
std::pair<FunctionTestGen, Status> 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);
Expand Down
15 changes: 6 additions & 9 deletions server/test/framework/TestUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,16 +207,13 @@ namespace testUtils {
return GrpcUtils::createFileRequest(std::move(projectRequest), filePath);
}

std::unique_ptr<LineRequest> createLineRequest(const std::string &projectName,
const fs::path &projectPath,
std::unique_ptr<LineRequest> createLineRequest(const std::string &projectName, const fs::path &projectPath,
const std::string &buildDirRelativePath,
const std::vector<fs::path> &srcPaths,
const fs::path &filePath,
int line,
bool verbose,
int kleeTimeout) {
const std::vector<fs::path> &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));
}
Expand All @@ -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));
}

Expand Down
11 changes: 4 additions & 7 deletions server/test/framework/TestUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,11 @@ namespace testUtils {
bool useStubs = false,
bool verbose = true);

std::unique_ptr<LineRequest> createLineRequest(const std::string &projectName,
const fs::path &projectPath,
std::unique_ptr<LineRequest> createLineRequest(const std::string &projectName, const fs::path &projectPath,
const std::string &buildDirRelativePath,
const std::vector<fs::path> &srcPaths,
const fs::path &filePath,
int line,
bool verbose = true,
int kleeTimeout = 60);
const std::vector<fs::path> &srcPaths, const fs::path &filePath,
int line, bool useStubs,
bool verbose, int kleeTimeout);

std::unique_ptr<ClassRequest> createClassRequest(const std::string &projectName,
const fs::path &projectPath,
Expand Down
2 changes: 1 addition & 1 deletion submodules/klee
Submodule klee updated 92 files
+0 −3 benchmark.xml
+0 −4 build.sh
+0 −4 include/klee-test-comp.c
+0 −4 include/klee/ADT/ImmutableMap.h
+0 −4 include/klee/ADT/ImmutableTree.h
+0 −4 include/klee/Config/config.h.cmin
+0 −4 include/klee/Core/Interpreter.h
+0 −4 include/klee/Expr/Expr.h
+0 −4 include/klee/Expr/ExprVisitor.h
+0 −4 include/klee/Module/KInstruction.h
+0 −4 include/klee/Module/KModule.h
+0 −4 include/klee/Runner/run_klee.h
+0 −4 include/klee/Solver/Solver.h
+0 −4 include/klee/Support/ModuleUtil.h
+0 −4 include/klee/Support/RoundingModeUtil.h
+0 −4 include/klee/klee.h
+0 −4 include/klee/util/APFloatEval.h
+0 −2 klee
+0 −4 lib/Core/AddressSpace.cpp
+0 −4 lib/Core/AddressSpace.h
+0 −4 lib/Core/Context.cpp
+0 −4 lib/Core/Context.h
+0 −4 lib/Core/ExecutionState.cpp
+0 −4 lib/Core/ExecutionState.h
+0 −4 lib/Core/Executor.cpp
+0 −4 lib/Core/Executor.h
+0 −4 lib/Core/ExecutorUtil.cpp
+0 −4 lib/Core/ExternalDispatcher.cpp
+0 −4 lib/Core/ExternalDispatcher.h
+0 −4 lib/Core/Memory.h
+0 −4 lib/Core/MemoryManager.cpp
+0 −4 lib/Core/MemoryManager.h
+0 −4 lib/Core/Searcher.cpp
+0 −4 lib/Core/Searcher.h
+0 −4 lib/Core/SpecialFunctionHandler.cpp
+0 −4 lib/Core/SpecialFunctionHandler.h
+0 −4 lib/Core/StatsTracker.cpp
+0 −4 lib/Core/StatsTracker.h
+0 −4 lib/Core/TimingSolver.cpp
+0 −4 lib/Core/TimingSolver.h
+0 −4 lib/Expr/APFloatEval.cpp
+0 −4 lib/Expr/Expr.cpp
+0 −4 lib/Expr/ExprBuilder.cpp
+0 −4 lib/Expr/ExprEvaluator.cpp
+0 −4 lib/Expr/ExprPPrinter.cpp
+0 −4 lib/Expr/ExprVisitor.cpp
+0 −4 lib/Module/IntrinsicCleaner.cpp
+0 −4 lib/Module/KInstruction.cpp
+0 −4 lib/Module/KModule.cpp
+0 −4 lib/Module/ModuleUtil.cpp
+0 −4 lib/Module/Passes.h
+0 −4 lib/Runner/run_klee.cpp
+0 −4 lib/Solver/CoreSolver.cpp
+0 −4 lib/Solver/MetaSMTSolver.cpp
+0 −4 lib/Solver/STPBuilder.cpp
+0 −4 lib/Solver/STPSolver.h
+0 −4 lib/Solver/Solver.cpp
+0 −4 lib/Solver/Z3BitvectorBuilder.cpp
+0 −4 lib/Solver/Z3BitvectorBuilder.h
+0 −4 lib/Solver/Z3Builder.cpp
+0 −4 lib/Solver/Z3Builder.h
+0 −4 lib/Solver/Z3CoreBuilder.cpp
+0 −4 lib/Solver/Z3CoreBuilder.h
+0 −4 lib/Solver/Z3HashConfig.cpp
+0 −4 lib/Solver/Z3HashConfig.h
+0 −4 lib/Solver/Z3Solver.cpp
+0 −4 lib/Solver/Z3Solver.h
+0 −4 runtime/POSIX/fd.c
+0 −4 runtime/POSIX/fd.h
+0 −4 runtime/POSIX/fd_init.c
+0 −4 runtime/POSIX/illegal.c
+0 −4 runtime/POSIX/klee_init_env.c
+0 −4 runtime/klee-fp/ceil.c
+0 −4 runtime/klee-fp/exp.c
+0 −4 runtime/klee-fp/fabs.c
+0 −4 runtime/klee-fp/fpclassify.c
+0 −4 runtime/klee-fp/klee_copysign.c
+0 −4 runtime/klee-fp/klee_copysign.h
+0 −4 runtime/klee-fp/klee_fenv.c
+0 −4 runtime/klee-fp/klee_fenv.h
+0 −4 runtime/klee-fp/klee_floor.c
+0 −4 runtime/klee-fp/klee_floor.h
+0 −4 runtime/klee-fp/klee_rint.c
+0 −4 runtime/klee-fp/klee_rint.h
+0 −4 runtime/klee-fp/klee_set_rounding_mode.c
+0 −4 runtime/klee-fp/log.c
+0 −4 runtime/klee-fp/round.c
+0 −4 runtime/klee-fp/sqrt.c
+0 −4 runtime/klee-fp/trigonometry.c
+0 −2 testcov_run.py
+0 −2 tools/klee-stats/klee-stats
+0 −4 tools/klee/klee.cpp