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

Commit 91b046a8 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "adb: fix `push --sync` with multiple inputs." am: 316298d7 am: 2e4934b5

Original change: https://android-review.googlesource.com/c/platform/system/core/+/1422155

Change-Id: Idd79c51a870b8bff1be888c31cea15ea5f750a5a
parents 076f1571 2e4934b5
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1053,7 +1053,7 @@ static bool sync_send(SyncConnection& sc, const std::string& lpath, const std::s
        if (!sc.SendSmallFile(rpath, mode, lpath, rpath, mtime, buf, data_length, dry_run)) {
            return false;
        }
        return sc.ReadAcknowledgements();
        return sc.ReadAcknowledgements(sync);
#endif
    }

@@ -1077,7 +1077,7 @@ static bool sync_send(SyncConnection& sc, const std::string& lpath, const std::s
            return false;
        }
    }
    return sc.ReadAcknowledgements();
    return sc.ReadAcknowledgements(sync);
}

static bool sync_recv_v1(SyncConnection& sc, const char* rpath, const char* lpath, const char* name,
+25 −0
Original line number Diff line number Diff line
@@ -1271,6 +1271,31 @@ class FileOperationsTest:
                if temp_dir is not None:
                    shutil.rmtree(temp_dir)

        def test_push_sync_multiple(self):
            """Sync multiple host directories to a specific path."""

            try:
                temp_dir = tempfile.mkdtemp()
                temp_files = make_random_host_files(in_dir=temp_dir, num_files=32)

                device_dir = posixpath.join(self.DEVICE_TEMP_DIR, 'sync_src_dst')

                # Clean up any stale files on the device.
                device = adb.get_device()  # pylint: disable=no-member
                device.shell(['rm', '-rf', device_dir])
                device.shell(['mkdir', '-p', device_dir])

                host_paths = [os.path.join(temp_dir, x.base_name) for x in temp_files]
                device.push(host_paths, device_dir, sync=True)

                self.verify_sync(device, temp_files, device_dir)

                self.device.shell(['rm', '-rf', self.DEVICE_TEMP_DIR])
            finally:
                if temp_dir is not None:
                    shutil.rmtree(temp_dir)


        def test_push_dry_run_nonexistent_file(self):
            """Push with dry run."""