original_docstring: Deferred build steps for test program.
  
    Args:
      env: Environment from ComponentTestProgram().
  
    Sets up the aliases to compile and run the test program.
    
docstring: Deferred build steps for test program.
docstring_tokens: Deferred build steps for test program .
code: def ComponentTestProgramDeferred(env):
    """Deferred build steps for test program.
  
    Args:
      env: Environment from ComponentTestProgram().
  
    Sets up the aliases to compile and run the test program.
    """
    prog_name = env['PROGRAM_BASENAME']
  
    # Install program and resources
    all_outputs = []
    components = _RetrieveComponents(prog_name)
    for resource, dest_dir in env.get('COMPONENT_TEST_RESOURCES').items():
      all_outputs += env.ReplicatePublished(dest_dir, components, resource)
  
    # Add installed program and resources to the alias
    env.Alias(prog_name, all_outputs)
  
    # Add target properties
    env.SetTargetProperty(
        prog_name,
        # The copy of the program we care about is the one in the tests dir
        EXE='$TESTS_DIR/$PROGRAM_NAME',
        RUN_CMDLINE='$COMPONENT_TEST_CMDLINE',
        RUN_DIR='$TESTS_DIR',
        TARGET_PATH='$TESTS_DIR/$PROGRAM_NAME',
    )
  
    # Add an alias for running the test in the test directory, if the test is
    # runnable and has a test command line.
    if env.get('COMPONENT_TEST_RUNNABLE') and env.get('COMPONENT_TEST_CMDLINE'):
      env.Replace(
          COMMAND_OUTPUT_CMDLINE=env['COMPONENT_TEST_CMDLINE'],
          COMMAND_OUTPUT_RUN_DIR='$TESTS_DIR',
      )
      test_out_name = '$TEST_OUTPUT_DIR/${PROGRAM_BASENAME}.out.txt'
      if (env.GetOption('component_test_retest')
          and env.File(test_out_name).exists()):
        # Delete old test results, so test will rerun.
        env.Execute(SCons.Script.Delete(test_out_name))
  
      # Set timeout based on test size
      timeout = env.get('COMPONENT_TEST_TIMEOUT')
      if type(timeout) is dict:
        timeout = timeout.get(env.get('COMPONENT_TEST_SIZE'))
      if timeout:
        env['COMMAND_OUTPUT_TIMEOUT'] = timeout
  
      # Test program is the first run resource we replicated.  (Duplicate
      # replicate is not harmful, and is a handy way to pick out the correct
      # file from all those we replicated above.)
      test_program = env.ReplicatePublished('$TESTS_DIR', prog_name, 'run')
  
      # Run the test.  Note that we need to refer to the file by name, so that
      # SCons will recreate the file node after we've deleted it; if we used the
      # env.File() we created in the if statement above, SCons would still think
      # it exists and not rerun the test.
      test_out = env.CommandOutput(test_out_name, test_program)
  
      # Running the test requires the test and its libs copied to the tests dir
      env.Depends(test_out, all_outputs)
      env.ComponentTestOutput('run_' + prog_name, test_out)
  
      # Add target properties
      env.SetTargetProperty(prog_name, RUN_TARGET='run_' + prog_name)
code_tokens: def ComponentTestProgramDeferred ( env ) : prog_name = env [ 'PROGRAM_BASENAME' ] all_outputs = [ ] components = _RetrieveComponents ( prog_name ) for resource , dest_dir in env . get ( 'COMPONENT_TEST_RESOURCES' ) . items ( ) : all_outputs += env . ReplicatePublished ( dest_dir , components , resource ) env . Alias ( prog_name , all_outputs ) env . SetTargetProperty ( prog_name , EXE = '$TESTS_DIR/$PROGRAM_NAME' , RUN_CMDLINE = '$COMPONENT_TEST_CMDLINE' , RUN_DIR = '$TESTS_DIR' , TARGET_PATH = '$TESTS_DIR/$PROGRAM_NAME' , ) if env . get ( 'COMPONENT_TEST_RUNNABLE' ) and env . get ( 'COMPONENT_TEST_CMDLINE' ) : env . Replace ( COMMAND_OUTPUT_CMDLINE = env [ 'COMPONENT_TEST_CMDLINE' ] , COMMAND_OUTPUT_RUN_DIR = '$TESTS_DIR' , ) test_out_name = '$TEST_OUTPUT_DIR/${PROGRAM_BASENAME}.out.txt' if ( env . GetOption ( 'component_test_retest' ) and env . File ( test_out_name ) . exists ( ) ) : env . Execute ( SCons . Script . Delete ( test_out_name ) ) timeout = env . get ( 'COMPONENT_TEST_TIMEOUT' ) if type ( timeout ) is dict : timeout = timeout . get ( env . get ( 'COMPONENT_TEST_SIZE' ) ) if timeout : env [ 'COMMAND_OUTPUT_TIMEOUT' ] = timeout test_program = env . ReplicatePublished ( '$TESTS_DIR' , prog_name , 'run' ) test_out = env . CommandOutput ( test_out_name , test_program ) env . Depends ( test_out , all_outputs ) env . ComponentTestOutput ( 'run_' + prog_name , test_out ) env . SetTargetProperty ( prog_name , RUN_TARGET = 'run_' + prog_name )
short_docstring: Deferred build steps for test program.
short_docstring_tokens: Deferred build steps for test program .
comment: """Deferred build steps for test program.
  
    Args:
      env: Environment from ComponentTestProgram().
  
    Sets up the aliases to compile and run the test program.
    """$SEP$# Install program and resources$SEP$# Add installed program and resources to the alias$SEP$# Add target properties$SEP$# The copy of the program we care about is the one in the tests dir$SEP$# Add an alias for running the test in the test directory, if the test is$SEP$# runnable and has a test command line.$SEP$# Delete old test results, so test will rerun.$SEP$# Set timeout based on test size$SEP$# Test program is the first run resource we replicated.  (Duplicate$SEP$# replicate is not harmful, and is a handy way to pick out the correct$SEP$# file from all those we replicated above.)$SEP$# Run the test.  Note that we need to refer to the file by name, so that$SEP$# SCons will recreate the file node after we've deleted it; if we used the$SEP$# env.File() we created in the if statement above, SCons would still think$SEP$# it exists and not rerun the test.$SEP$# Running the test requires the test and its libs copied to the tests dir$SEP$# Add target properties