Skip to content

Commit

Permalink
fix gcc warning about dangling-reference in backup_engine_test
Browse files Browse the repository at this point in the history
  • Loading branch information
raffertyyu committed May 10, 2024
1 parent b92d874 commit d432305
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions utilities/backup/backup_engine_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4406,9 +4406,9 @@ TEST_F(BackupEngineTest, ExcludeFiles) {
delete db;
db = nullptr;

for (auto be_pair :
{std::make_pair(backup_engine_.get(), alt_backup_engine),
std::make_pair(alt_backup_engine, backup_engine_.get())}) {
auto backup_engine = backup_engine_.get();
for (auto be_pair : {std::make_pair(backup_engine, alt_backup_engine),
std::make_pair(alt_backup_engine, backup_engine)}) {
ASSERT_OK(DestroyDB(dbname_, options_));
RestoreOptions ro;
// Fails without alternate dir
Expand All @@ -4430,9 +4430,8 @@ TEST_F(BackupEngineTest, ExcludeFiles) {
CloseBackupEngine();
OpenBackupEngine();

for (auto be_pair :
{std::make_pair(backup_engine_.get(), alt_backup_engine),
std::make_pair(alt_backup_engine, backup_engine_.get())}) {
for (auto be_pair : {std::make_pair(backup_engine, alt_backup_engine),
std::make_pair(alt_backup_engine, backup_engine)}) {
ASSERT_OK(DestroyDB(dbname_, options_));
RestoreOptions ro;
ro.alternate_dirs.push_front(be_pair.second);
Expand All @@ -4459,9 +4458,8 @@ TEST_F(BackupEngineTest, ExcludeFiles) {
AssertBackupInfoConsistency(/*allow excluded*/ true);

// Excluded file(s) deleted, unable to restore
for (auto be_pair :
{std::make_pair(backup_engine_.get(), alt_backup_engine),
std::make_pair(alt_backup_engine, backup_engine_.get())}) {
for (auto be_pair : {std::make_pair(backup_engine, alt_backup_engine),
std::make_pair(alt_backup_engine, backup_engine)}) {
RestoreOptions ro;
ro.alternate_dirs.push_front(be_pair.second);
ASSERT_TRUE(be_pair.first->RestoreDBFromLatestBackup(dbname_, dbname_, ro)
Expand All @@ -4475,9 +4473,8 @@ TEST_F(BackupEngineTest, ExcludeFiles) {
AssertBackupInfoConsistency(/*allow excluded*/ true);

// Excluded file(s) deleted, unable to restore
for (auto be_pair :
{std::make_pair(backup_engine_.get(), alt_backup_engine),
std::make_pair(alt_backup_engine, backup_engine_.get())}) {
for (auto be_pair : {std::make_pair(backup_engine, alt_backup_engine),
std::make_pair(alt_backup_engine, backup_engine)}) {
RestoreOptions ro;
ro.alternate_dirs.push_front(be_pair.second);
ASSERT_TRUE(be_pair.first->RestoreDBFromLatestBackup(dbname_, dbname_, ro)
Expand Down

0 comments on commit d432305

Please sign in to comment.