Skip to content

Fix problem with stdin-read variable in klee and add test for launchi… #563

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 1 commit into from
Dec 21, 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
3 changes: 1 addition & 2 deletions server/src/printers/TestsPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ void TestsPrinter::genVerboseTestCase(const Tests::MethodDescription &methodDesc
void TestsPrinter::initializeFiles(const Tests::MethodDescription &methodDescription,
const Tests::MethodTestCase &testCase) {
if (!testCase.filesValues.has_value()) {
LOG_S(WARNING) << "There are not symbolic files in the test.";
LOG_S(INFO) << "There are not symbolic files in the test.";
return;
}
fs::path pathToSourceFile =
Expand All @@ -292,7 +292,6 @@ void TestsPrinter::initializeFiles(const Tests::MethodDescription &methodDescrip
void TestsPrinter::openFiles(const Tests::MethodDescription &methodDescription,
const Tests::MethodTestCase &testCase) {
if (!testCase.filesValues.has_value()) {
LOG_S(WARNING) << "There are not symbolic files in the test.";
return;
}
char fileName = 'A';
Expand Down
2 changes: 1 addition & 1 deletion server/test/framework/Server_Tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1475,7 +1475,7 @@ namespace {

testUtils::checkStatuses(resultMap, tests);

StatusCountMap expectedStatusCountMap{{testsgen::TEST_PASSED, 8}};
StatusCountMap expectedStatusCountMap{{testsgen::TEST_PASSED, 7}};
testUtils::checkStatusesCount(resultMap, tests, expectedStatusCountMap);
}

Expand Down
76 changes: 76 additions & 0 deletions server/test/framework/Syntax_Tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3223,6 +3223,44 @@ namespace {
);
}

TEST_F(Syntax_Test, run_tests_for_input_output_c) {
auto request = testUtils::createFileRequest(projectName, suitePath, buildDirRelativePath,
srcPaths, input_output_c,
GrpcUtils::UTBOT_AUTO_TARGET_PATH, true, false);
auto testGen = FileTestGen(*request, writer.get(), TESTMODE);
testGen.setTargetForSource(input_output_c);
Status status = Server::TestsGenServiceImpl::ProcessBaseTestRequest(testGen, writer.get());
ASSERT_TRUE(status.ok()) << status.error_message();
EXPECT_EQ(testUtils::getNumberOfTests(testGen.tests), 63); // 61 regression tests and 2 error

fs::path testsDirPath = getTestFilePath("tests");

fs::path input_output_test_cpp = Paths::sourcePathToTestPath(
utbot::ProjectContext(projectName, suitePath, testsDirPath, buildDirRelativePath),
input_output_c);
auto testFilter = GrpcUtils::createTestFilterForFile(input_output_test_cpp);
auto runRequest = testUtils::createCoverageAndResultsRequest(
projectName, suitePath, testsDirPath, buildDirRelativePath, std::move(testFilter));

static auto coverageAndResultsWriter =
std::make_unique<ServerCoverageAndResultsWriter>(nullptr);
CoverageAndResultsGenerator coverageGenerator{ runRequest.get(),
coverageAndResultsWriter.get() };
utbot::SettingsContext settingsContext{
true, false, 45, 30, false, false, ErrorMode::FAILING
};
coverageGenerator.generate(false, settingsContext);

EXPECT_FALSE(coverageGenerator.hasExceptions());
ASSERT_TRUE(coverageGenerator.getCoverageMap().empty());

auto resultMap = coverageGenerator.getTestResultMap();
auto tests = coverageGenerator.getTestsToLaunch();

StatusCountMap expectedStatusCountMap{ {testsgen::TEST_PASSED, 61} };
testUtils::checkStatusesCount(resultMap, tests, expectedStatusCountMap);
}

TEST_F(Syntax_Test, file_fgetc) {
auto [testGen, status] = createTestForFunction(file_c, 5);

Expand Down Expand Up @@ -3377,6 +3415,44 @@ namespace {
);
}

TEST_F(Syntax_Test, run_tests_for_file_c) {
auto request =
testUtils::createFileRequest(projectName, suitePath, buildDirRelativePath, srcPaths,
file_c, GrpcUtils::UTBOT_AUTO_TARGET_PATH, true, false);
auto testGen = FileTestGen(*request, writer.get(), TESTMODE);
testGen.setTargetForSource(file_c);
Status status = Server::TestsGenServiceImpl::ProcessBaseTestRequest(testGen, writer.get());
ASSERT_TRUE(status.ok()) << status.error_message();
EXPECT_EQ(testUtils::getNumberOfTests(testGen.tests), 33);

fs::path testsDirPath = getTestFilePath("tests");

fs::path file_test_cpp = Paths::sourcePathToTestPath(
utbot::ProjectContext(projectName, suitePath, testsDirPath, buildDirRelativePath),
file_c);
auto testFilter = GrpcUtils::createTestFilterForFile(file_test_cpp);
auto runRequest = testUtils::createCoverageAndResultsRequest(
projectName, suitePath, testsDirPath, buildDirRelativePath, std::move(testFilter));

static auto coverageAndResultsWriter =
std::make_unique<ServerCoverageAndResultsWriter>(nullptr);
CoverageAndResultsGenerator coverageGenerator{ runRequest.get(),
coverageAndResultsWriter.get() };
utbot::SettingsContext settingsContext{
true, false, 45, 0, false, false, ErrorMode::FAILING
};
coverageGenerator.generate(false, settingsContext);

EXPECT_FALSE(coverageGenerator.hasExceptions());
ASSERT_TRUE(coverageGenerator.getCoverageMap().empty());

auto resultMap = coverageGenerator.getTestResultMap();
auto tests = coverageGenerator.getTestsToLaunch();

StatusCountMap expectedStatusCountMap{ { testsgen::TEST_PASSED, 33 } };
testUtils::checkStatusesCount(resultMap, tests, expectedStatusCountMap);
}

template<typename T>
bool checkBitfieldFit(const std::shared_ptr<tests::AbstractValueView> &fieldView, size_t size) {
T val = StringUtils::stot<T>(fieldView->getEntryValue(nullptr));
Expand Down
2 changes: 1 addition & 1 deletion submodules/klee
Submodule klee updated 1 files
+25 −20 runtime/POSIX/fd_init.c