Esempio n. 1
0
    def test_expected_exception(self):
        """Test raising an ExpectedException."""
        self.exception = error.GomaNotInstalledError()

        @stackdriver_logging.log
        def raise_expected_exception(param, extra_log_params):  # pylint: disable=unused-argument
            raise self.exception

        with self.assertRaises(SystemExit) as cm:
            # pylint: disable=no-value-for-parameter
            raise_expected_exception(param='yes')

        self.assertEqual(error.GomaNotInstalledError.EXIT_CODE,
                         cm.exception.code)
        self.mock.send_start.assert_called_once_with({
            'command': 'stackdriver_logging_test',
            'param': 'yes',
            'extras': {}
        })
        self.mock.send_failure.assert_called_once_with(
            self.exception, mock.ANY, {
                'command': 'stackdriver_logging_test',
                'param': 'yes',
                'extras': {}
            })
 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 ensure_goma():
  """Ensures GOMA is installed and ready for use, and starts it."""
  goma_dir = os.environ.get('GOMA_DIR', GOMA_DIR)
  if not os.path.isfile(os.path.join(goma_dir, 'goma_ctl.py')):
    raise error.GomaNotInstalledError()

  common.execute('python', 'goma_ctl.py ensure_start', goma_dir)
  return goma_dir
Esempio n. 4
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')])