Example #1
0
  def test_invalid(self):
    """Test an invalid binary."""
    self.mock.check_output.side_effect = subprocess.CalledProcessError(1, '')
    with self.assertRaises(common.NotInstalledError) as cm:
      common.check_binary('test', 'cwd')

    self.mock.check_output.assert_called_once_with(['which', 'test'], cwd='cwd')
    self.assertEqual(
        'test is not found. Please install it or ensure the path is correct.',
        cm.exception.message)
    def test_invalid(self):
        """Test an invalid binary."""
        self.mock.check_output.side_effect = subprocess.CalledProcessError(
            1, '')
        with self.assertRaises(error.NotInstalledError) as cm:
            common.check_binary('test', 'cwd')

        self.mock.check_output.assert_called_once_with(['which', 'test'],
                                                       cwd='cwd')
        self.assertEqual(error.NotInstalledError.MESSAGE.format(binary='test'),
                         cm.exception.message)
Example #3
0
def ensure_asan(android_libclang_dir_path, device_id):
    """Ensures ASan is installed on Android."""
    logger.info(
        'The testcase needs ASAN. After installing ASAN, the device might be '
        'restarted.')

    common.check_confirm(
        'Are you sure you want to install ASAN on the device %s?' % device_id)

    _, output = common.execute(
        common.get_resource(0755, 'resources', 'asan_device_setup.sh'),
        '--lib %s --device %s' % (android_libclang_dir_path, device_id),
        env={'ADB_PATH': common.check_binary('adb', cwd='.')},
        redirect_stderr_to_stdout=True,
        cwd='.')

    # tool/clusterfuzz/resources/asan_device_setup.sh prints the below string
    # when it modifies asan configuration on device. So, wait for the reboot to
    # be complete.
    if ASAN_BEING_INSTALLED_SEARCH_STRING in output:
        wait_until_fully_booted()
 def test_valid(self):
     """Test a valid binary."""
     common.check_binary('test', 'cwd')
     self.mock.check_output.assert_called_once_with(['which', 'test'],
                                                    cwd='cwd')