Beispiel #1
0
def build_definition(job_definition, presets):
    """Converts a job definition hash into a binary definition."""

    builders = {
        'CfiChromium': binary_providers.CfiChromiumBuilder,
        'Chromium_32': binary_providers.ChromiumBuilder32Bit,
        'Chromium': binary_providers.ChromiumBuilder,
        'MsanChromium': binary_providers.MsanChromiumBuilder,
        'MsanV8': binary_providers.MsanV8Builder,
        'Pdfium': binary_providers.PdfiumBuilder,
        'V8': binary_providers.V8Builder,
        'V8_32': binary_providers.V8Builder32Bit,
    }
    reproducer_map = {
        'Base': reproducers.BaseReproducer,
        'LibfuzzerJob': reproducers.LibfuzzerJobReproducer,
        'LinuxChromeJob': reproducers.LinuxChromeJobReproducer
    }

    result = parse_job_definition(job_definition, presets)

    return common.Definition(builder=builders[result['builder']],
                             source_var=result['source'],
                             reproducer=reproducer_map[result['reproducer']],
                             binary_name=result.get('binary'),
                             sanitizer=result.get('sanitizer'),
                             target=result.get('target'),
                             require_user_data_dir=result.get(
                                 'require_user_data_dir', False))
 def test_no_sanitizer(self):
     with self.assertRaises(error.SanitizerNotProvidedError):
         common.Definition(builder='builder',
                           source_var='CHROME_SRC',
                           reproducer='reproducer',
                           binary_name=None,
                           sanitizer=None,
                           target=None,
                           require_user_data_dir=False)
Beispiel #3
0
 def test_no_sanitizer(self):
     with self.assertRaises(error.SanitizerNotProvidedError):
         common.Definition(builder='builder',
                           source_name='chromium',
                           reproducer='reproducer',
                           binary_name=None,
                           sanitizer=None,
                           targets=None,
                           require_user_data_dir=False,
                           revision_url=None)
Beispiel #4
0
 def setUp(self):
     helpers.patch(self,
                   ['clusterfuzz.commands.reproduce.get_supported_jobs'])
     self.mock.get_supported_jobs.return_value = {
         'chromium': {
             'libfuzzer_chrome_msan':
             common.Definition(builder=binary_providers.ChromiumBuilder,
                               source_var='CHROMIUM_SRC',
                               reproducer=reproducers.BaseReproducer,
                               binary_name=None,
                               sanitizer='MSAN',
                               target=None,
                               require_user_data_dir=False)
         },
         'standalone': {}
     }
Beispiel #5
0
def make_definition(builder=binary_providers.ChromiumBuilder,
                    source_name='chromium',
                    reproducer=reproducers.LinuxChromeJobReproducer,
                    binary_name='chrome',
                    sanitizer='ASAN',
                    targets=None,
                    require_user_data_dir=True,
                    revision_url=None):
    """Make a definition."""
    if targets is None:
        targets = ['chromium_builder_asan']
    return common.Definition(builder=builder,
                             source_name=source_name,
                             reproducer=reproducer,
                             binary_name=binary_name,
                             sanitizer=sanitizer,
                             targets=targets,
                             require_user_data_dir=require_user_data_dir,
                             revision_url=revision_url)
Beispiel #6
0
def build_definition(job_definition, presets):
    """Converts a job definition hash into a binary definition."""

    # TODO(tanin): use the full class name in the YAML and eliminate this dict.
    builders = {
        'CfiChromium': binary_providers.CfiChromiumBuilder,
        'Chromium_32': binary_providers.ChromiumBuilder32Bit,
        'Chromium': binary_providers.ChromiumBuilder,
        'Clankium': binary_providers.ClankiumBuilder,
        'MsanChromium': binary_providers.MsanChromiumBuilder,
        'MsanV8': binary_providers.MsanV8Builder,
        'CfiV8': binary_providers.CfiV8Builder,
        'Pdfium': binary_providers.PdfiumBuilder,
        'V8': binary_providers.V8Builder,
        'V8_32': binary_providers.V8Builder32Bit,
        'Afl': binary_providers.LibfuzzerAndAflBuilder,
        'Libfuzzer': binary_providers.LibfuzzerAndAflBuilder,
        'LibfuzzerMsanChromium': binary_providers.LibfuzzerMsanBuilder
    }
    reproducer_map = {
        'Base': reproducers.BaseReproducer,
        'LibfuzzerJob': reproducers.LibfuzzerJobReproducer,
        'LinuxChromeJob': reproducers.LinuxChromeJobReproducer,
        'Android': reproducers.AndroidChromeReproducer,
        'AndroidWebView': reproducers.AndroidWebViewReproducer
    }

    result = parse_job_definition(job_definition, presets)

    return common.Definition(builder=builders[result['builder']],
                             source_name=result['source_name'],
                             reproducer=reproducer_map[result['reproducer']],
                             binary_name=result.get('binary'),
                             sanitizer=result['sanitizer'],
                             targets=result.get('targets'),
                             require_user_data_dir=result.get(
                                 'require_user_data_dir', False),
                             revision_url=result.get('revision_url', None))