コード例 #1
0
ファイル: commands.py プロジェクト: yiqideren/clusterfuzz
def update_environment_for_job(environment_string):
  """Process the environment variable string included with a job."""
  # Now parse the job's environment definition.
  environment_values = (
      environment.parse_environment_definition(environment_string))

  for key, value in six.iteritems(environment_values):
    environment.set_value(key, value)

  # If we share the build with another job type, force us to be a custom binary
  # job type.
  if environment.get_value('SHARE_BUILD_WITH_JOB_TYPE'):
    environment.set_value('CUSTOM_BINARY', True)

  # Allow the default FUZZ_TEST_TIMEOUT and MAX_TESTCASES to be overridden on
  # machines that are preempted more often.
  fuzz_test_timeout_override = environment.get_value(
      'FUZZ_TEST_TIMEOUT_OVERRIDE')
  if fuzz_test_timeout_override:
    environment.set_value('FUZZ_TEST_TIMEOUT', fuzz_test_timeout_override)

  max_testcases_override = environment.get_value('MAX_TESTCASES_OVERRIDE')
  if max_testcases_override:
    environment.set_value('MAX_TESTCASES', max_testcases_override)

  if environment.is_trusted_host():
    environment_values['JOB_NAME'] = environment.get_value('JOB_NAME')
    from bot.untrusted_runner import environment as worker_environment
    worker_environment.update_environment(environment_values)
コード例 #2
0
  def test_update_environment(self):
    """Test update environment."""
    environment.update_environment({
        'BLAH': 'abc',
        'BLAH2': os.path.join(os.environ['ROOT_DIR'], 'blah2'),
        'FUZZER_DIR': os.path.join(os.environ['ROOT_DIR'], 'fuzzer'),
    })

    request = self.mock.stub().UpdateEnvironment.call_args[0][0]
    self.assertEqual({
        'BLAH': 'abc',
        'BLAH2': os.path.join(os.environ['ROOT_DIR'], 'blah2'),
        'FUZZER_DIR': '/worker/fuzzer',
    }, request.env)
コード例 #3
0
ファイル: commands.py プロジェクト: wdgreen/clusterfuzz
def update_environment_for_job(environment_string):
    """Process the environment variable string included with a job."""
    # Now parse the job's environment definition.
    environment_values = (
        environment.parse_environment_definition(environment_string))

    for key, value in six.iteritems(environment_values):
        environment.set_value(key, value)

    # If we share the build with another job type, force us to be a custom binary
    # job type.
    if environment.get_value('SHARE_BUILD_WITH_JOB_TYPE'):
        environment.set_value('CUSTOM_BINARY', True)

    if environment.is_trusted_host():
        environment_values['JOB_NAME'] = environment.get_value('JOB_NAME')
        from bot.untrusted_runner import environment as worker_environment
        worker_environment.update_environment(environment_values)
コード例 #4
0
ファイル: commands.py プロジェクト: whiteHat001/clusterfuzz
def update_environment_for_job(environment_string):
    """Process the environment variable string included with a job."""
    # Stacktraces to ignore for found crashes.
    # This is set in admin configuration.
    environment.set_value('CRASH_EXCLUSIONS',
                          db_config.get_value('stack_blacklist'))

    # Now parse the job's environment definition.
    environment_values = (
        environment.parse_environment_definition(environment_string))

    for key, value in six.iteritems(environment_values):
        environment.set_value(key, value)

    # If we share the build with another job type, force us to be a custom binary
    # job type.
    if environment.get_value('SHARE_BUILD_WITH_JOB_TYPE'):
        environment.set_value('CUSTOM_BINARY', True)

    if environment.is_trusted_host():
        environment_values['JOB_NAME'] = environment.get_value('JOB_NAME')
        from bot.untrusted_runner import environment as worker_environment
        worker_environment.update_environment(environment_values)