Exemplo n.º 1
0
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)
Exemplo n.º 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)
Exemplo n.º 3
0
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)
Exemplo n.º 4
0
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)