Add error message

This commit is contained in:
sharkdp authored and David Peter committed 2019-10-07 19:34:05 +02:00
1 parent 5a3fc3c92a
commit 071d5c6993
1 file changed
+7 -2
+7 -2
View File
@@ -2,15 +2,20 @@
import argparse
import json
import sys
from scipy import stats
parser = argparse.ArgumentParser()
parser.add_argument("file", help="JSON file with benchmark results")
parser.add_argument("file", help="JSON file with two benchmark results")
args = parser.parse_args()
with open(args.file) as f:
results = json.load(f)["results"]
if len(results) != 2:
print("The input file has to contain exactly two benchmarks")
sys.exit(1)
a, b = [x["command"] for x in results[:2]]
X, Y = [x["times"] for x in results[:2]]
@@ -25,4 +30,4 @@ print("p < {} = {}\n".format(th, dispose))
if dispose:
print("There is a difference between the two benchmarks.")
else:
print("The two benchmarks are almost the same.")
print("The two benchmarks are almost the same.")