From c80226d8e17d3cec16b52ca69fa672861b2f7a30 Mon Sep 17 00:00:00 2001 From: Marek Marecki Date: Fri, 8 Dec 2023 00:51:00 +0100 Subject: [PATCH] Handle two-case runs better "Handle better" in this case means "don't crash". --- new/tests/suite.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/new/tests/suite.py b/new/tests/suite.py index 512b8a096..7e29b9f9e 100755 --- a/new/tests/suite.py +++ b/new/tests/suite.py @@ -1539,6 +1539,13 @@ def main(args): ) run_times = sorted(run_times) middle = len(run_times) // 2 + + # If we have only run two cases, we need to handle it with extra care. Otherwise, the + # code will crash later when it tries to access index 2 in a two-element list during + # median calculation. + if middle == 1: + middle = 0 + print( "median run time was {}".format( colorise( -- 2.45.2