Skip to content

Commit 92b7021

Browse files
committed
[leaksrunner] Handle subprocesses segfaulting nicely rather than throwing an IndexError.
1 parent 503b6b8 commit 92b7021

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

benchmark/scripts/Benchmark_RuntimeLeaksRunner.in

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,15 @@ class LeaksRunnerBenchmarkDriver(perf_test_driver.BenchmarkDriver):
8989
"--num-iters={}".format(num_iters), data['test_name']],
9090
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
9191
error_out = p.communicate()[1].split("\n")
92-
except OSError:
93-
print("Child Process Failed! (%s,%s)" % (
92+
result = p.returncode
93+
if result is None:
94+
raise RuntimeError("Expected one line of output")
95+
if result != 0:
96+
raise RuntimeError("Process segfaulted")
97+
except:
98+
sys.stderr.write("Child Process Failed! (%s,%s)\n" % (
9499
data['path'], data['test_name']))
100+
sys.stderr.flush()
95101
return None
96102

97103
try:
@@ -104,9 +110,10 @@ class LeaksRunnerBenchmarkDriver(perf_test_driver.BenchmarkDriver):
104110

105111
total_count = d['objc_count'] + d['swift_count']
106112
return total_count
107-
except (KeyError, ValueError):
108-
print("Failed parse output! (%s,%s)" %
109-
(data['path'], data['test_name']))
113+
except:
114+
tmp = (data['path'], data['test_name'])
115+
sys.stderr.write("Failed parse output! (%s,%s)\n" % tmp)
116+
sys.stderr.flush()
110117
return None
111118

112119
def process_input(self, data):

0 commit comments

Comments
 (0)