Skip to content

Commit

Permalink
Merge pull request #902 from apple/fix-120671990
Browse files Browse the repository at this point in the history
  • Loading branch information
shahmishal committed Jan 9, 2024
2 parents e15b815 + 4438e23 commit fd7c2e0
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions unittests/Core/SQLiteBuildDBTest.cpp
Expand Up @@ -47,10 +47,7 @@ TEST(SQLiteBuildDBTest, ErrorHandling) {
bool result = true;
buildDB->getCurrentEpoch(&result, &error);
EXPECT_FALSE(result);

std::stringstream out;
out << "error: accessing build database \"" << path << "\": database is locked Possibly there are two concurrent builds running in the same filesystem location.";
EXPECT_EQ(error, out.str());
EXPECT_TRUE(error.find("database is locked") != std::string::npos);

// Clean up database connections before unlinking
sqlite3_exec(db, "END;", nullptr, nullptr, nullptr);
Expand Down Expand Up @@ -85,9 +82,7 @@ TEST(SQLiteBuildDBTest, LockedWhileBuilding) {
// Tests that we cannot start a second build with an existing connection
result = secondBuildDB->buildStarted(&error);
EXPECT_FALSE(result);
std::stringstream out;
out << "error: accessing build database \"" << path << "\": database is locked Possibly there are two concurrent builds running in the same filesystem location.";
EXPECT_EQ(error, out.str());
EXPECT_TRUE(error.find("database is locked") != std::string::npos);

// Tests that we cannot create new connections while a build is running
std::unique_ptr<BuildDB> otherBuildDB = createSQLiteBuildDB(dbPath, 1, /* recreateUnmatchedVersion = */ true, &error);
Expand All @@ -98,7 +93,7 @@ TEST(SQLiteBuildDBTest, LockedWhileBuilding) {
bool success = true;
otherBuildDB->getCurrentEpoch(&success, &error);
EXPECT_FALSE(success);
EXPECT_EQ(error, out.str());
EXPECT_TRUE(error.find("database is locked") != std::string::npos);

// Clean up database connections before unlinking
buildDB->buildComplete();
Expand Down

0 comments on commit fd7c2e0

Please sign in to comment.