Allow an out-of-memory condition to be interpreted as a pass for testBug507425. (510207, r=dmandelin)

This commit is contained in:
Jacob Bramley 2009-08-18 12:00:10 +01:00
parent 01e935eb04
commit 56c7a54588
2 changed files with 11 additions and 10 deletions

View File

@ -53,23 +53,24 @@ def run_test(path, lib_dir):
if OPTIONS.show_output: if OPTIONS.show_output:
sys.stdout.write(out) sys.stdout.write(out)
sys.stdout.write(err) sys.stdout.write(err)
return (check_output(out, err, p.returncode), out, err) # Determine whether or not we can allow an out-of-memory condition.
allow_oom = 'allow_oom' in path
assert_re = re.compile(r'Assertion failed:') return (check_output(out, err, p.returncode, allow_oom), out, err)
stat_re = re.compile(r'^Trace stats check failed')
def check_output(out, err, rc):
if rc != 0:
return False
def check_output(out, err, rc, allow_oom):
for line in out.split('\n'): for line in out.split('\n'):
if stat_re.match(line): if line.startswith('Trace stats check failed'):
return False return False
for line in err.split('\n'): for line in err.split('\n'):
if assert_re.match(line): if 'Assertion failed:' in line:
return False return False
if rc != 0:
# Allow a non-zero exit code if we want to allow OOM, but only if we
# actually got OOM.
return allow_oom and ': out of memory\n' in err
return True return True
def run_tests(tests, lib_dir): def run_tests(tests, lib_dir):