Skip to content

Commit

Permalink
Small step towards supporting ion-tests multi-version layout
Browse files Browse the repository at this point in the history
  • Loading branch information
nirosys committed Oct 10, 2023
1 parent fff3a34 commit 1815f9c
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions amazon/iontest/ion_test_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,13 @@ def test_type_from_str(name):
return TestType.EQUIV_TIMELINE
raise ValueError("Given string '%s' does not map to a known TestType" % name)

def test_dir_from_version(version):
if "1.0" == version:
return "iontestdata_1_0"
elif "1.1" == version:
return "iontestdata_1_1"
raise ValueError("Unknown Ion version: %s" % version)


class TestFile:
ERROR_TYPE_FIELD = 'error_type'
Expand Down Expand Up @@ -580,11 +587,12 @@ def filter_files(test_type):
continue
yield TestFile(test_type, full_test_file, results_root, ion_implementations)

test_file_root = os.path.abspath(os.path.join(tests_dir, 'iontestdata'))
version_test_dir = test_dir_from_version("1.0")
test_file_root = os.path.abspath(os.path.join(tests_dir, version_test_dir))
if not os.path.exists(test_file_root):
raise ValueError("Invalid ion-tests directory. Could not find test files.")
for root, dirs, files in os.walk(test_file_root):
if os.path.join('iontestdata', str(TestType.GOOD)) in root:
if os.path.join(version_test_dir, str(TestType.GOOD)) in root:
if os.path.join(str(TestType.GOOD), str(TestType.EQUIVS)) in root and TestType.EQUIVS in test_types:
for equivs_file in filter_files(TestType.EQUIVS):
yield equivs_file
Expand All @@ -599,7 +607,7 @@ def filter_files(test_type):
elif TestType.GOOD in test_types:
for good_file in filter_files(TestType.GOOD):
yield good_file
elif os.path.join('iontestdata', str(TestType.BAD)) in root and TestType.BAD in test_types:
elif os.path.join(version_test_dir, str(TestType.BAD)) in root and TestType.BAD in test_types:
for bad_file in filter_files(TestType.BAD):
yield bad_file

Expand Down

0 comments on commit 1815f9c

Please sign in to comment.