zircon/system/ulib/fs/journal/test/journal_test.cc
// Tests that calling |journal.Sync| will wait for the journal to complete, while
// generating no additional work (without concurrent metadata writes).
Tests that calling |journal.Sync| will wait for the journal to complete, while
generating no additional work (without concurrent metadata writes).
Tests that calling |journal . Sync| will wait for the journal to complete while generating no additional work ( without concurrent metadata writes ) .
TEST_F(JournalTest, NoWorkSyncCompletesBeforeJournalDestruction) {
  MockTransactionHandler handler(registry());
  Journal journal(&handler, take_info(), take_journal_buffer(), take_data_buffer(), 0,
                  Journal::Options());
  sync_completion_t sync_completion;
  bool sync_completed = false;
  auto promise = journal.Sync().and_then([&] {
    sync_completed = true;
    sync_completion_signal(&sync_completion);
    return fit::ok();
  });
  ASSERT_FALSE(sync_completed);
  journal.schedule_task(std::move(promise));
  ASSERT_OK(sync_completion_wait(&sync_completion, zx::duration::infinite().get()));
  ASSERT_TRUE(sync_completed);
}
TEST_F ( JournalTest , NoWorkSyncCompletesBeforeJournalDestruction ) { MockTransactionHandler handler ( registry ( ) ) ; Journal journal ( & handler , take_info ( ) , take_journal_buffer ( ) , take_data_buffer ( ) , 0 , Journal :: Options ( ) ) ; sync_completion_t sync_completion ; bool sync_completed = false ; auto promise = journal . Sync ( ) . and_then ( [ & ] { sync_completed = true ; sync_completion_signal ( & sync_completion ) ; return fit :: ok ( ) ; } ) ; ASSERT_FALSE ( sync_completed ) ; journal . schedule_task ( std :: move ( promise ) ) ; ASSERT_OK ( sync_completion_wait ( & sync_completion , zx :: duration :: infinite ( ) . get ( ) ) ) ; ASSERT_TRUE ( sync_completed ) ; }
Tests that calling |journal.Sync| will wait for the journal to complete, while
generating no additional work (without concurrent metadata writes).
Tests that calling |journal . Sync| will wait for the journal to complete while generating no additional work ( without concurrent metadata writes ) .