make sure to always clean up the bjam xml file

This commit is contained in:
Arvid Norberg 2013-06-20 04:43:45 +00:00
parent a5926e5177
commit 67f631e44e
1 changed files with 60 additions and 58 deletions

View File

@ -80,69 +80,71 @@ def svn_info():
def run_tests(toolset, tests, features, options, test_dir, time_limit, incremental): def run_tests(toolset, tests, features, options, test_dir, time_limit, incremental):
xml_file = 'bjam_build.%d.xml' % random.randint(0, 100000) xml_file = 'bjam_build.%d.xml' % random.randint(0, 100000)
try:
results = {} results = {}
toolset_found = False toolset_found = False
os.chdir(test_dir) os.chdir(test_dir)
if not incremental: if not incremental:
p = subprocess.Popen(['bjam', '--abbreviate-paths', toolset, 'clean'] + options + features.split(' '), stdout=subprocess.PIPE) p = subprocess.Popen(['bjam', '--abbreviate-paths', toolset, 'clean'] + options + features.split(' '), stdout=subprocess.PIPE)
for l in p.stdout: pass for l in p.stdout: pass
p.wait() p.wait()
for t in tests: for t in tests:
p = subprocess.Popen(['bjam', '--out-xml=%s' % xml_file, '-l%d' % time_limit, '-q', '--abbreviate-paths', toolset, t] + options + features.split(' '), stdout=subprocess.PIPE) p = subprocess.Popen(['bjam', '--out-xml=%s' % xml_file, '-l%d' % time_limit, '-q', '--abbreviate-paths', toolset, t] + options + features.split(' '), stdout=subprocess.PIPE)
output = '' output = ''
for l in p.stdout: for l in p.stdout:
output += l.decode('latin-1') output += l.decode('latin-1')
p.wait() p.wait()
# parse out the toolset version from the xml file # parse out the toolset version from the xml file
compiler = '' compiler = ''
compiler_version = '' compiler_version = ''
command = '' command = ''
# make this parse the actual test to pick up the time # make this parse the actual test to pick up the time
# spent runnin the test # spent runnin the test
try: try:
dom = et.parse(xml_file) dom = et.parse(xml_file)
command = dom.find('./command').text command = dom.find('./command').text
prop = dom.findall('./action/properties/property') prop = dom.findall('./action/properties/property')
for a in prop: for a in prop:
name = a.attrib['name'] name = a.attrib['name']
if name == 'toolset': if name == 'toolset':
compiler = a.text compiler = a.text
if compiler_version != '': break if compiler_version != '': break
if name.startswith('toolset-') and name.endswith(':version'): if name.startswith('toolset-') and name.endswith(':version'):
compiler_version = a.text compiler_version = a.text
if compiler != '': break if compiler != '': break
if compiler != '' and compiler_version != '': if compiler != '' and compiler_version != '':
toolset = compiler + '-' + compiler_version toolset = compiler + '-' + compiler_version
except: pass except: pass
r = { 'status': p.returncode, 'output': output, 'command': command }
results[t + '|' + features] = r
fail_color = '\033[31;1m'
pass_color = '\033[32;1m'
end_seq = '\033[0m'
if platform.system() == 'Windows':
fail_color == ''
pass_color == ''
end_seq = ''
if p.returncode == 0: sys.stdout.write('.')
else: sys.stdout.write('X')
sys.stdout.flush()
finally:
try: os.unlink(xml_file) try: os.unlink(xml_file)
except: pass except: pass
r = { 'status': p.returncode, 'output': output, 'command': command }
results[t + '|' + features] = r
fail_color = '\033[31;1m'
pass_color = '\033[32;1m'
end_seq = '\033[0m'
if platform.system() == 'Windows':
fail_color == ''
pass_color == ''
end_seq = ''
if p.returncode == 0: sys.stdout.write('.')
else: sys.stdout.write('X')
sys.stdout.flush()
return (toolset, results) return (toolset, results)
def print_usage(): def print_usage():