| 1 |
import os |
| 2 |
import sys |
| 3 |
import glob |
| 4 |
import json |
| 5 |
|
| 6 |
# If we have arguments passed to the script, use them as the test names to run |
| 7 |
if len(sys.argv) > 1: |
| 8 |
suites = sys.argv[1:] |
| 9 |
valid_suites = [] |
| 10 |
# Validate if the path is a valid file or directory with files |
| 11 |
for suite in suites: |
| 12 |
test_path = os.path.join("dirsrvtests/tests/suites/", suite) |
| 13 |
if os.path.exists(test_path) and not os.path.islink(test_path): |
| 14 |
if os.path.isfile(test_path) and test_path.endswith(".py"): |
| 15 |
valid_suites.append(suite) |
| 16 |
elif os.path.isdir(test_path): |
| 17 |
valid_suites.append(suite) |
| 18 |
suites = valid_suites |
| 19 |
|
| 20 |
else: |
| 21 |
# Use tests from the source |
| 22 |
suites = next(os.walk('dirsrvtests/tests/suites/'))[1] |
| 23 |
|
| 24 |
# Run each replication test module separately to speed things up |
| 25 |
suites.remove('replication') |
| 26 |
repl_tests = glob.glob('dirsrvtests/tests/suites/replication/*_test.py') |
| 27 |
suites += [repl_test.replace('dirsrvtests/tests/suites/', '') for repl_test in repl_tests] |
| 28 |
suites.sort() |
| 29 |
|
| 30 |
suites_list = [{ "suite": suite} for suite in suites] |
| 31 |
matrix = {"include": suites_list} |
| 32 |
|
| 33 |
print(json.dumps(matrix)) |
| 34 |
|