zircon/system/ulib/fs/journal/test/journal_test.cc
// Tests that writing data to the journal is observable from the "block device".
Tests that writing data to the journal is observable from the "block device".
Tests that writing data to the journal is observable from the " block device " .
TEST_F(JournalTest, WriteDataObserveTransaction) {
  storage::VmoBuffer buffer = registry()->InitializeBuffer(1);
  const storage::UnbufferedOperation operation = {
      zx::unowned_vmo(buffer.vmo().get()),
      {
          storage::OperationType::kWrite,
          .vmo_offset = 0,
          .dev_offset = 20,
          .length = 1,
      },
  };
  JournalRequestVerifier verifier(registry()->info(), registry()->journal(),
                                  registry()->writeback(), 0);
  MockTransactionHandler::TransactionCallback callbacks[] = {
      [&](const std::vector<storage::BufferedOperation>& requests) {
        verifier.VerifyDataWrite(operation, requests);
        return ZX_OK;
      },
  };
  MockTransactionHandler handler(registry(), callbacks, std::size(callbacks));
  {
    Journal journal(&handler, take_info(), take_journal_buffer(), take_data_buffer(), 0,
                    Journal::Options());
    auto promise = journal.WriteData({operation}).and_then([&]() {
      CheckInfoBlock(registry()->info(),  0,  0);
    });
    journal.schedule_task(std::move(promise));
  }
}
TEST_F ( JournalTest , WriteDataObserveTransaction ) { storage :: VmoBuffer buffer = registry ( ) -> InitializeBuffer ( 1 ) ; const storage :: UnbufferedOperation operation = { zx :: unowned_vmo ( buffer . vmo ( ) . get ( ) ) , { storage :: OperationType :: kWrite , . vmo_offset = 0 , . dev_offset = 20 , . length = 1 , } , } ; JournalRequestVerifier verifier ( registry ( ) -> info ( ) , registry ( ) -> journal ( ) , registry ( ) -> writeback ( ) , 0 ) ; MockTransactionHandler :: TransactionCallback callbacks [ ] = { [ & ] ( const std :: vector < storage :: BufferedOperation > & requests ) { verifier . VerifyDataWrite ( operation , requests ) ; return ZX_OK ; } , } ; MockTransactionHandler handler ( registry ( ) , callbacks , std :: size ( callbacks ) ) ; { Journal journal ( & handler , take_info ( ) , take_journal_buffer ( ) , take_data_buffer ( ) , 0 , Journal :: Options ( ) ) ; auto promise = journal . WriteData ( { operation } ) . and_then ( [ & ] ( ) { CheckInfoBlock ( registry ( ) -> info ( ) , 0 , 0 ) ; } ) ; journal . schedule_task ( std :: move ( promise ) ) ; } }
Tests that writing data to the journal is observable from the "block device".
Tests that writing data to the journal is observable from the " block device " .
/* start= */ /* sequence_number= */