summaryrefslogtreecommitdiffstats
path: root/python-packages
diff options
context:
space:
mode:
authorJosh Gao <jmgao@google.com>2015-11-07 00:53:02 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-11-07 00:53:02 +0000
commit084d084bbce132561d91b6e0fbef8ad1fe7e7099 (patch)
treeb94f40bd5434d4b3ddf79be9c5ce1a3a1a156bbb /python-packages
parentfbc902755869a2f1dbebc7074740e8bd9618b206 (diff)
parentcdf675849c233bc7f720afd7411120a15070634b (diff)
downloadandroid_development-084d084bbce132561d91b6e0fbef8ad1fe7e7099.tar.gz
android_development-084d084bbce132561d91b6e0fbef8ad1fe7e7099.tar.bz2
android_development-084d084bbce132561d91b6e0fbef8ad1fe7e7099.zip
Merge "adb: add tests for pushing/pulling empty dirs."
Diffstat (limited to 'python-packages')
-rw-r--r--python-packages/adb/test_device.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/python-packages/adb/test_device.py b/python-packages/adb/test_device.py
index c54d54bce..0b1bb641d 100644
--- a/python-packages/adb/test_device.py
+++ b/python-packages/adb/test_device.py
@@ -701,6 +701,32 @@ class FileOperationsTest(DeviceTest):
if host_dir is not None:
shutil.rmtree(host_dir)
+ @unittest.expectedFailure # b/25566053
+ def test_push_empty(self):
+ """Push a directory containing an empty directory to the device."""
+ self.device.shell(['rm', '-rf', self.DEVICE_TEMP_DIR])
+ self.device.shell(['mkdir', self.DEVICE_TEMP_DIR])
+
+ try:
+ host_dir = tempfile.mkdtemp()
+
+ # Make sure the temp directory isn't setuid, or else adb will complain.
+ os.chmod(host_dir, 0o700)
+
+ # Create an empty directory.
+ os.mkdir(os.path.join(host_dir, 'empty'))
+
+ self.device.push(host_dir, self.DEVICE_TEMP_DIR)
+
+ test_empty_cmd = ['[', '-d',
+ os.path.join(self.DEVICE_TEMP_DIR, 'empty')]
+ rc, _, _ = self.device.shell_nocheck(test_empty_cmd)
+ self.assertEqual(rc, 0)
+ self.device.shell(['rm', '-rf', self.DEVICE_TEMP_DIR])
+ finally:
+ if host_dir is not None:
+ shutil.rmtree(host_dir)
+
def test_multiple_push(self):
"""Push multiple files to the device in one adb push command.
@@ -803,6 +829,20 @@ class FileOperationsTest(DeviceTest):
if host_dir is not None:
shutil.rmtree(host_dir)
+ def test_pull_empty(self):
+ """Pull a directory containing an empty directory from the device."""
+ try:
+ host_dir = tempfile.mkdtemp()
+
+ remote_empty_path = posixpath.join(self.DEVICE_TEMP_DIR, 'empty')
+ self.device.shell(['rm', '-rf', self.DEVICE_TEMP_DIR])
+ self.device.shell(['mkdir', '-p', remote_empty_path])
+
+ self.device.pull(remote=self.DEVICE_TEMP_DIR, local=host_dir)
+ self.assertTrue(os.path.isdir(os.path.join(host_dir, 'empty')))
+ finally:
+ if host_dir is not None:
+ shutil.rmtree(host_dir)
def test_multiple_pull(self):
"""Pull a randomly generated directory of files from the device."""