def TestsuiteReport(env, config, options): """Generate a report from the prior LLVM test suite run. Args: env: The result of SetupEnvironment(). config: A dict that was the result of ParseConfig(). This determines the specific optimization levels. options: The result of OptionParser().parse_args(). Returns: 0 for success, non-zero integer on failure. """ arch = options.arch or Fatal("Error: missing --arch argument") suffix = GetConfigSuffix(config) report_file = ('{LLVM_TESTSUITE_BUILD}/report.pnacl.{arch}.{suffix}.csv' .format(arch=arch, suffix=suffix, **env)) failures1 = '{PNACL_SCRIPTS}/testsuite_known_failures_base.txt'.format(**env) failures2 = '{PNACL_SCRIPTS}/testsuite_known_failures_pnacl.txt'.format(**env) parse_options = vars(options) parse_options['excludes'].extend([failures1, failures2]) parse_options['buildpath'] = env['LLVM_TESTSUITE_BUILD'] parse_options['attributes'].extend([arch, config['frontend_attr'], config['backend_attr']]) parse_options['testsuite'] = True return parse_llvm_test_report.Report(parse_options, filename=report_file)
def RunLitTest(testdir, testarg, env, options): """Run LLVM lit tests, and check failures against known failures. Args: testdir: Directory with the make/ninja file to test. testarg: argument to pass to make/ninja. env: The result of SetupEnvironment(). options: The result of OptionParser().parse_args(). Returns: 0 always """ with remember_cwd(): os.chdir(testdir) maker = 'ninja' if os.path.isfile('./build.ninja') else 'make' cmd = [maker, testarg, '-v' if maker == 'ninja' else 'VERBOSE=1'] make_pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE) lines = [] # When run by a buildbot, we need to incrementally tee the 'make' # stdout to our stdout, rather than collect its entire stdout and # print it at the end. Otherwise the watchdog may try to kill the # process after too long without any output. # # Note: We use readline instead of 'for line in make_pipe.stdout' # because otherwise the process on the Cygwin bot seems to hang # when the 'make' process completes (with slightly truncated # output). The readline avoids buffering when reading from a # pipe in Python 2, which may be complicit in the problem. for line in iter(make_pipe.stdout.readline, ''): if env['PNACL_BUILDBOT'] != 'false': # The buildbots need to be fully verbose and print all output. print str(datetime.datetime.now()) + ' ' + line, lines.append(line) print (str(datetime.datetime.now()) + ' ' + "Waiting for '%s' to complete." % cmd) make_pipe.wait() make_stdout = ''.join(lines) parse_options = vars(options) parse_options['lit'] = True parse_options['excludes'].append(env['LIT_KNOWN_FAILURES']) parse_options['attributes'].append(env['BUILD_PLATFORM']) print (str(datetime.datetime.now()) + ' ' + 'Parsing LIT test report output.') parse_llvm_test_report.Report(parse_options, filecontents=make_stdout) return 0
def RunLitTest(testdir, testarg, lit_failures, env, options): """Run LLVM lit tests, and check failures against known failures. Args: testdir: Directory with the make/ninja file to test. testarg: argument to pass to make/ninja. env: The result of SetupEnvironment(). options: The result of OptionParser().parse_args(). Returns: 0 always """ with remember_cwd(): if not ToolchainWorkDirExists(testdir): print 'Working directory %s is empty. Not running tests' % testdir if env['PNACL_BUILDBOT'] != 'false' or options.verbose: print '@@@STEP_TEXT (skipped)@@@' return 0 os.chdir(testdir) sub_env = os.environ.copy() # Tell run.py to use the architecture specified by --arch, or the # current host architecture if none was provided. sub_env['PNACL_RUN_ARCH'] = options.arch or env['HOST_ARCH'] maker = 'ninja' if os.path.isfile('./build.ninja') else 'make' cmd = [maker, testarg, '-v' if maker == 'ninja' else 'VERBOSE=1'] print 'Running lit test:', ' '.join(cmd) make_pipe = subprocess.Popen(cmd, env=sub_env, stdout=subprocess.PIPE) lines = [] # When run by a buildbot, we need to incrementally tee the 'make' # stdout to our stdout, rather than collect its entire stdout and # print it at the end. Otherwise the watchdog may try to kill the # process after too long without any output. # # Note: We use readline instead of 'for line in make_pipe.stdout' # because otherwise the process on the Cygwin bot seems to hang # when the 'make' process completes (with slightly truncated # output). The readline avoids buffering when reading from a # pipe in Python 2, which may be complicit in the problem. for line in iter(make_pipe.stdout.readline, ''): if env['PNACL_BUILDBOT'] != 'false' or options.verbose: # The buildbots need to be fully verbose and print all output. print str(datetime.datetime.now()) + ' ' + line, lines.append(line) print( str(datetime.datetime.now()) + ' ' + "Waiting for '%s' to complete." % cmd) make_pipe.wait() make_stdout = ''.join(lines) parse_options = vars(options) parse_options['lit'] = True parse_options['excludes'].append(env[lit_failures]) parse_options['attributes'].append(env['BUILD_PLATFORM']) parse_options['attributes'].append(env['HOST_ARCH']) print( str(datetime.datetime.now()) + ' ' + 'Parsing LIT test report output.') ret = parse_llvm_test_report.Report(parse_options, filecontents=make_stdout) return ret