Пример #1
0
    def test(self):
        """Tests copy_local_directory_to_remote."""
        utils.write_data_to_file('a', os.path.join(self.local_temp_dir, 'a'))
        shell.create_directory(os.path.join(self.local_temp_dir, 'b'))
        utils.write_data_to_file('c',
                                 os.path.join(self.local_temp_dir, 'b', 'c'))

        adb.copy_local_directory_to_remote(self.local_temp_dir,
                                           self.device_temp_dir)

        self.assertTrue(
            adb.file_exists(os.path.join(self.device_temp_dir, 'a')))
        self.assertFalse(
            adb.directory_exists(os.path.join(self.device_temp_dir, 'a')))
        self.assertEqual(
            adb.get_file_size(os.path.join(self.device_temp_dir, 'a')), 1)

        self.assertTrue(
            adb.directory_exists(os.path.join(self.device_temp_dir, 'b')))
        self.assertFalse(
            adb.file_exists(os.path.join(self.device_temp_dir, 'b')))

        self.assertTrue(
            adb.file_exists(os.path.join(self.device_temp_dir, 'b', 'c')))
        self.assertFalse(
            adb.directory_exists(os.path.join(self.device_temp_dir, 'b', 'c')))
        self.assertEqual(
            adb.get_file_size(os.path.join(self.device_temp_dir, 'b', 'c')), 1)
Пример #2
0
 def test(self):
   """Test that ASan instrumentation can be successfully set up on device."""
   adb.revert_asan_device_setup_if_needed()
   environment.reset_current_memory_tool_options()
   sanitizer.setup_asan_if_needed()
   self.assertEqual(0, self.mock.log_error.call_count)
   self.assertTrue(adb.file_exists('/system/bin/asanwrapper'))
Пример #3
0
 def test_regular_file(self):
     """Test that checksum is properly calculated for regular files."""
     adb.write_data_to_file('abcd', '/sdcard/file1')
     self.assertTrue(adb.file_exists('/sdcard/file1'))
     self.assertEqual(adb.get_file_checksum('/sdcard/file1'),
                      'e2fc714c4727ee9395f324cd2e7f331f')
Пример #4
0
 def test_nonexistent_file(self):
     """Tests that checksum is None for a non-existent file."""
     self.assertFalse(adb.file_exists('/sdcard/non-existent'))
     self.assertIsNone(adb.get_file_checksum('/sdcard/non-existent'))
Пример #5
0
 def test_regular_file(self):
     """Test that file size is properly calculated for regular files."""
     adb.write_data_to_file('abcd', '/sdcard/file1')
     self.assertTrue(adb.file_exists('/sdcard/file1'))
     self.assertEqual(adb.get_file_size('/sdcard/file1'), 4)
Пример #6
0
 def test_unsupported(self):
   """Test that options are not set with an unsupported sanitizer e.g.
   UBSan, MSan, etc."""
   sanitizer.set_options('UBSAN', 'a=b:c=d')
   self.assertFalse(adb.file_exists('/data/local/tmp/ubsan.options'))
   self.assertEqual(1, self.mock.log_error.call_count)