From 1ff3b2d5b8d7de2059516e41eb2465a90d73762b Mon Sep 17 00:00:00 2001 From: Scott McKay Date: Tue, 29 Sep 2020 12:55:15 +1000 Subject: [PATCH] Add ability to generate multiple test dirs so that different input mixes can be tested. (#5310) --- tools/python/ort_test_dir_utils.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tools/python/ort_test_dir_utils.py b/tools/python/ort_test_dir_utils.py index 890fa1cb46..c3fd9bd683 100644 --- a/tools/python/ort_test_dir_utils.py +++ b/tools/python/ort_test_dir_utils.py @@ -82,10 +82,18 @@ def create_test_dir(model_path, root_path, test_name, model_path = os.path.abspath(model_path) root_path = os.path.abspath(root_path) test_dir = os.path.join(root_path, test_name) - test_data_dir = os.path.join(test_dir, "test_data_set_0") + if not os.path.exists(test_dir): + os.makedirs(test_dir) - if not os.path.exists(test_dir) or not os.path.exists(test_data_dir): - os.makedirs(test_data_dir) + # add to existing test data sets if present + test_num = 0 + while True: + test_data_dir = os.path.join(test_dir, "test_data_set_" + str(test_num)) + if not os.path.exists(test_data_dir): + os.mkdir(test_data_dir) + break + + test_num += 1 model_filename = os.path.split(model_path)[-1] test_model_filename = os.path.join(test_dir, model_filename)