tools/nocompile_driver.py
def StartTest(compiler, sourcefile_path, tempfile_dir, cflags, config):
  """Start one negative compile test.

  Args:
    sourcefile_path: The path to the source file.
    tempfile_dir: A directory to store temporary data from tests.
    cflags: An array of strings with all the CFLAGS to give to gcc.
    config: A dictionary describing the test.  See ExtractTestConfigs
      for a description of the config format.

  Returns:
    A dictionary containing all the information about the started test. The
    fields in the dictionary are as follows:
      { 'proc': A subprocess object representing the compiler run.
        'cmdline': The executed command line.
        'name': The name of the test.
        'suite_name': The suite name to use when generating the gunit test
                      result.
        'terminate_timeout': The timestamp in seconds since the epoch after
                             which the test should be terminated.
        'kill_timeout': The timestamp in seconds since the epoch after which
                        the test should be given a hard kill signal.
        'started_at': A timestamp in seconds since the epoch for when this test
                      was started.
        'aborted_at': A timestamp in seconds since the epoch for when this test
                      was aborted.  If the test completed successfully,
                      this value is 0.
        'finished_at': A timestamp in seconds since the epoch for when this
                       test was successfully complete.  If the test is aborted,
                       or running, this value is 0.
        'expectations': A dictionary with the test expectations. See
                        ParseExpectation() for the structure.
        }
  """
  cmdline = [compiler]
  cmdline.extend(cflags)
  name = config['name']
  expectations = config['expectations']
  if expectations is not None:
    cmdline.append('-D%s' % name)
  cmdline.extend(['-o', '/dev/null', '-c', '-x', 'c++',
                  sourcefile_path])
  test_stdout = tempfile.TemporaryFile(dir=tempfile_dir, mode='w+')
  test_stderr = tempfile.TemporaryFile(dir=tempfile_dir, mode='w+')

  process = subprocess.Popen(cmdline, stdout=test_stdout, stderr=test_stderr)
  now = time.time()
  return {'proc': process,
          'cmdline': ' '.join(cmdline),
          'stdout': test_stdout,
          'stderr': test_stderr,
          'name': name,
          'suite_name': config['suite_name'],
          'terminate_timeout': now + NCTEST_TERMINATE_TIMEOUT_SEC,
          'kill_timeout': now + NCTEST_KILL_TIMEOUT_SEC,
          'started_at': now,
          'aborted_at': 0,
          'finished_at': 0,
          'expectations': expectations}
Start one negative compile test.

  Args:
    sourcefile_path: The path to the source file.
    tempfile_dir: A directory to store temporary data from tests.
    cflags: An array of strings with all the CFLAGS to give to gcc.
    config: A dictionary describing the test.  See ExtractTestConfigs
      for a description of the config format.

  Returns:
    A dictionary containing all the information about the started test. The
    fields in the dictionary are as follows:
      { 'proc': A subprocess object representing the compiler run.
        'cmdline': The executed command line.
        'name': The name of the test.
        'suite_name': The suite name to use when generating the gunit test
                      result.
        'terminate_timeout': The timestamp in seconds since the epoch after
                             which the test should be terminated.
        'kill_timeout': The timestamp in seconds since the epoch after which
                        the test should be given a hard kill signal.
        'started_at': A timestamp in seconds since the epoch for when this test
                      was started.
        'aborted_at': A timestamp in seconds since the epoch for when this test
                      was aborted.  If the test completed successfully,
                      this value is 0.
        'finished_at': A timestamp in seconds since the epoch for when this
                       test was successfully complete.  If the test is aborted,
                       or running, this value is 0.
        'expectations': A dictionary with the test expectations. See
                        ParseExpectation() for the structure.
        }
  
Start one negative compile test.
Start one negative compile test .
def StartTest(compiler, sourcefile_path, tempfile_dir, cflags, config):
  cmdline = [compiler]
  cmdline.extend(cflags)
  name = config['name']
  expectations = config['expectations']
  if expectations is not None:
    cmdline.append('-D%s' % name)
  cmdline.extend(['-o', '/dev/null', '-c', '-x', 'c++',
                  sourcefile_path])
  test_stdout = tempfile.TemporaryFile(dir=tempfile_dir, mode='w+')
  test_stderr = tempfile.TemporaryFile(dir=tempfile_dir, mode='w+')
  process = subprocess.Popen(cmdline, stdout=test_stdout, stderr=test_stderr)
  now = time.time()
  return {'proc': process,
          'cmdline': ' '.join(cmdline),
          'stdout': test_stdout,
          'stderr': test_stderr,
          'name': name,
          'suite_name': config['suite_name'],
          'terminate_timeout': now + NCTEST_TERMINATE_TIMEOUT_SEC,
          'kill_timeout': now + NCTEST_KILL_TIMEOUT_SEC,
          'started_at': now,
          'aborted_at': 0,
          'finished_at': 0,
          'expectations': expectations}
def StartTest ( compiler , sourcefile_path , tempfile_dir , cflags , config ) : cmdline = [ compiler ] cmdline . extend ( cflags ) name = config [ 'name' ] expectations = config [ 'expectations' ] if expectations is not None : cmdline . append ( '-D%s' % name ) cmdline . extend ( [ '-o' , '/dev/null' , '-c' , '-x' , 'c++' , sourcefile_path ] ) test_stdout = tempfile . TemporaryFile ( dir = tempfile_dir , mode = 'w+' ) test_stderr = tempfile . TemporaryFile ( dir = tempfile_dir , mode = 'w+' ) process = subprocess . Popen ( cmdline , stdout = test_stdout , stderr = test_stderr ) now = time . time ( ) return { 'proc' : process , 'cmdline' : ' ' . join ( cmdline ) , 'stdout' : test_stdout , 'stderr' : test_stderr , 'name' : name , 'suite_name' : config [ 'suite_name' ] , 'terminate_timeout' : now + NCTEST_TERMINATE_TIMEOUT_SEC , 'kill_timeout' : now + NCTEST_KILL_TIMEOUT_SEC , 'started_at' : now , 'aborted_at' : 0 , 'finished_at' : 0 , 'expectations' : expectations }
Start one negative compile test.
Start one negative compile test .
"""Start one negative compile test.

  Args:
    sourcefile_path: The path to the source file.
    tempfile_dir: A directory to store temporary data from tests.
    cflags: An array of strings with all the CFLAGS to give to gcc.
    config: A dictionary describing the test.  See ExtractTestConfigs
      for a description of the config format.

  Returns:
    A dictionary containing all the information about the started test. The
    fields in the dictionary are as follows:
      { 'proc': A subprocess object representing the compiler run.
        'cmdline': The executed command line.
        'name': The name of the test.
        'suite_name': The suite name to use when generating the gunit test
                      result.
        'terminate_timeout': The timestamp in seconds since the epoch after
                             which the test should be terminated.
        'kill_timeout': The timestamp in seconds since the epoch after which
                        the test should be given a hard kill signal.
        'started_at': A timestamp in seconds since the epoch for when this test
                      was started.
        'aborted_at': A timestamp in seconds since the epoch for when this test
                      was aborted.  If the test completed successfully,
                      this value is 0.
        'finished_at': A timestamp in seconds since the epoch for when this
                       test was successfully complete.  If the test is aborted,
                       or running, this value is 0.
        'expectations': A dictionary with the test expectations. See
                        ParseExpectation() for the structure.
        }
  """
A dictionary containing all the information about the started test. The
fields in the dictionary are as follows:
{ 'proc': A subprocess object representing the compiler run.
'cmdline': The executed command line.
'name': The name of the test.
'suite_name': The suite name to use when generating the gunit test
result.
'terminate_timeout': The timestamp in seconds since the epoch after
which the test should be terminated.
'kill_timeout': The timestamp in seconds since the epoch after which
the test should be given a hard kill signal.
'started_at': A timestamp in seconds since the epoch for when this test
was started.
'aborted_at': A timestamp in seconds since the epoch for when this test
was aborted.  If the test completed successfully,
this value is 0.
'finished_at': A timestamp in seconds since the epoch for when this
test was successfully complete.  If the test is aborted,
or running, this value is 0.
'expectations': A dictionary with the test expectations. See
ParseExpectation() for the structure.
A dictionary containing all the information about the started test . The fields in the dictionary are as follows : { ' proc ' : A subprocess object representing the compiler run . ' cmdline ' : The executed command line . ' name ' : The name of the test . ' suite_name ' : The suite name to use when generating the gunit test result . ' terminate_timeout ' : The timestamp in seconds since the epoch after which the test should be terminated . ' kill_timeout ' : The timestamp in seconds since the epoch after which the test should be given a hard kill signal . ' started_at ' : A timestamp in seconds since the epoch for when this test was started . ' aborted_at ' : A timestamp in seconds since the epoch for when this test was aborted . If the test completed successfully this value is 0 . ' finished_at ' : A timestamp in seconds since the epoch for when this test was successfully complete . If the test is aborted or running this value is 0 . ' expectations ' : A dictionary with the test expectations . See ParseExpectation () for the structure .
compiler
sourcefile_path
The path to the source file.
The path to the source file .
tempfile_dir
A directory to store temporary data from tests.
A directory to store temporary data from tests .
cflags
An array of strings with all the CFLAGS to give to gcc.
An array of strings with all the CFLAGS to give to gcc .
config
A dictionary describing the test.  See ExtractTestConfigs
for a description of the config format.
A dictionary describing the test . See ExtractTestConfigs for a description of the config format .