def test_init(self):
     """Test init."""
     error.MinimizationNotFinishedError()
     error.SanitizerNotProvidedError()
     error.ClusterFuzzError(500, 'resp', 'identity')
     error.PermissionsTooPermissiveError('filename', 'perm')
     error.GomaNotInstalledError()
     error.JobTypeNotSupportedError('job', '1234')
     error.NotInstalledError('bin')
     error.GsutilNotInstalledError()
     error.BadJobTypeDefinitionError('job')
     error.UnreproducibleError(10,
                               [Signature('type', ['a', 'b'], 'output')])
     error.DirtyRepoError('source')
     error.CommandFailedError('cmd', 12, 'err')
     error.KillProcessFailedError('cmd', 123)
     error.UserRespondingNoError('question')
     error.InvalidTestcaseIdError('123456')
     error.UnauthorizedError('123456', 'identity')
     error.DifferentStacktraceError(
         10, [Signature('type', ['a', 'b'], 'output')])
     error.GdbNotSupportedOnAndroidError()
     error.BootFailed()
     error.NoAndroidDeviceIdError('ANDROID_SERIAL')
     error.GclientManagedEnabledException('/chromium/.gclient')
    def test_fail(self):
        """Test failing with NotInstalledError."""
        self.mock.execute.side_effect = error.NotInstalledError('gsutil')
        with self.assertRaises(error.GsutilNotInstalledError):
            common.gsutil('test', cwd='source')

        self.mock.execute.assert_called_once_with('gsutil',
                                                  'test',
                                                  cwd='source')
    def test_check_binary_fail(self):
        """Test check_binary fail."""
        self.mock.check_binary.side_effect = error.NotInstalledError('cmd')

        with self.assertRaises(error.NotInstalledError) as cm:
            common.execute('cmd', 'aaa', '~/working/directory')

        self.assert_exact_calls(self.mock.check_binary,
                                [mock.call('cmd', '~/working/directory')])
        self.assertEqual(error.NotInstalledError.MESSAGE.format(binary='cmd'),
                         cm.exception.message)
 def __enter__(self):
     if self.disable_xvfb:
         return None
     self.display = xvfbwrapper.Xvfb(width=1280, height=1024)
     self.display.start()
     for i in self.display.xvfb_cmd:
         if i.startswith(':'):
             display_name = i
             break
     logger.info(
         'Starting the blackbox window manager in a virtual display.')
     try:
         self.blackbox = subprocess.Popen(['blackbox'],
                                          env={'DISPLAY': display_name})
     except OSError, e:
         if str(e) == '[Errno 2] No such file or directory':
             raise error.NotInstalledError('blackbox')
         raise
Esempio n. 5
0
 def test_init(self):
     """Test init."""
     error.MinimizationNotFinishedError()
     error.SanitizerNotProvidedError()
     error.ClusterFuzzError(500, 'resp')
     error.PermissionsTooPermissiveError('filename', 'perm')
     error.GomaNotInstalledError()
     error.JobTypeNotSupportedError('job')
     error.NotInstalledError('bin')
     error.GsutilNotInstalledError()
     error.BadJobTypeDefinitionError('job')
     error.UnreproducibleError(10,
                               [Signature('type', ['a', 'b'], 'output')])
     error.DirtyRepoError('source')
     error.CommandFailedError('cmd', 12, 'err')
     error.KillProcessFailedError('cmd', 123)
     error.UserRespondingNoError('question')
     error.InvalidTestcaseIdError('123456')
     error.UnauthorizedError('123456')
     error.DifferentStacktraceError(
         10, [Signature('type', ['a', 'b'], 'output')])
Esempio n. 6
0
def check_binary(binary, cwd):
    """Check if the binary exists."""
    try:
        subprocess.check_output(['which', binary], cwd=cwd)
    except subprocess.CalledProcessError:
        raise error.NotInstalledError(binary)