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 reproduce_normal(self, iteration_max):
        """Reproduce normally."""
        iterations = 1
        signatures = set()
        has_signature = False
        while iterations <= iteration_max:
            _, output = self.reproduce_crash()

            new_signature = get_crash_signature(self.job_type, output)
            new_signature.output = output
            signatures.add(new_signature)

            has_signature = (bool(new_signature.crash_type)
                             or bool(new_signature.crash_state_lines))
            logger.info(
                'New crash type: %s\n'
                'New crash state:\n  %s\n\n'
                'Original crash type: %s\n'
                'Original crash state:\n  %s\n', new_signature.crash_type,
                '\n  '.join(new_signature.crash_state_lines),
                self.get_crash_signature().crash_type,
                '\n  '.join(self.get_crash_signature().crash_state_lines))

            # The crash signature validation is intentionally forgiving.
            if is_similar(new_signature, self.get_crash_signature()):
                logger.info(
                    common.colorize(
                        'The stacktrace seems similar to the original stacktrace.\n'
                        "Since you've reproduced the crash correctly, there are some "
                        'tricks that might help you move faster:\n'
                        '- In case of fixing the crash, you can use `--current` to run '
                        'on tip-of-tree (or, in other words, avoid git-checkout).\n'
                        '- You can save time by using `--skip-deps` to avoid '
                        '`gclient sync`, `gclient runhooks`, and other dependency '
                        'installations in subsequential runs.\n'
                        '- You can debug with gdb using `--enable-debug`.\n'
                        '- You can modify args.gn and arguments using `--edit-mode`.',
                        common.BASH_GREEN_MARKER))
                return True
            else:
                logger.info(
                    "The stacktrace doesn't match the original stacktrace.")
                logger.info(
                    'Try again (%d times). Press Ctrl+C to stop trying to '
                    'reproduce.', iterations)
            iterations += 1
            time.sleep(3)

        if has_signature:
            raise error.DifferentStacktraceError(iteration_max, signatures)
        else:
            raise error.UnreproducibleError(iteration_max, signatures)
 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')])