Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 933d341b authored by Yifan Hong's avatar Yifan Hong
Browse files

libsnapshot_fuzzer: also create snapshots dir

/metadata/ota/snapshots is created by init.rc at boot time.
Conditionally create it in the fuzz test

Test: run it
Bug: 154633114

Change-Id: Ice5e340b554ffd59861c4b21d9c4eb652ca60c55
parent 7134ae06
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -97,7 +97,10 @@ message SnapshotFuzzData {
    bool is_super_metadata_valid = 3;
    chromeos_update_engine.DeltaArchiveManifest super_data = 4;

    // Whether the directory that mocks /metadata/ota/snapshot is created.
    bool has_metadata_snapshots_dir = 5;

    // More data used to prep the test before running actions.
    reserved 5 to 9999;
    reserved 6 to 9999;
    repeated SnapshotManagerActionProto actions = 10000;
}
+3 −0
Original line number Diff line number Diff line
@@ -258,6 +258,9 @@ std::unique_ptr<ISnapshotManager> SnapshotFuzzEnv::CheckCreateSnapshotManager(
    CheckWriteSuperMetadata(data, *partition_opener);
    auto metadata_dir = fake_root_->tmp_path() + "/snapshot_metadata";
    PCHECK(Mkdir(metadata_dir));
    if (data.has_metadata_snapshots_dir()) {
        PCHECK(Mkdir(metadata_dir + "/snapshots"));
    }

    auto device_info = new SnapshotFuzzDeviceInfo(data.device_info_data(),
                                                  std::move(partition_opener), metadata_dir);