Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ def run_test(
env,
root_dir,
verbose,
only_pattern,
):
test_path = os.path.join(root_dir, test_file)
try:
Expand Down Expand Up @@ -151,6 +152,12 @@ def compute_thread_pool_size_for_gpu_tests(pynvml, gpus_per_test):
)


def filter_only_tests(only_pattern):
legate_tests.clear()
to_test = set(glob.glob("**/*" + only_pattern + "*.py", recursive=True))
legate_tests.extend(to_test)


def run_test_legate(
test_name,
root_dir,
Expand All @@ -161,7 +168,11 @@ def run_test_legate(
opts,
workers,
num_procs,
only_pattern,
):
if only_pattern is not None:
filter_only_tests(only_pattern)

if test_name == "GPU":
try:
import pynvml
Expand Down Expand Up @@ -198,6 +209,7 @@ def run_test_legate(
env,
root_dir,
verbose,
only_pattern,
)
total_pass += report_result(test_name, result)
else:
Expand All @@ -220,6 +232,7 @@ def run_test_legate(
env,
root_dir,
verbose,
only_pattern,
),
)
)
Expand Down Expand Up @@ -297,10 +310,14 @@ def run_tests(
options=[],
interop_tests=False,
workers=None,
only_pattern=None,
):
if interop_tests:
legate_tests.extend(glob.glob("tests/interop/*.py"))

if only_pattern is not None:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not repeat this, unless there's a reason good reason to do so. Can't you factor this and the same code above out?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, done

filter_only_tests(only_pattern)

if root_dir is None:
root_dir = os.path.dirname(os.path.realpath(__file__))

Expand Down Expand Up @@ -369,6 +386,7 @@ def feature_enabled(feature, default=True):
options,
workers,
1,
only_pattern,
)
total_pass += count
total_count += len(legate_tests)
Expand All @@ -384,6 +402,7 @@ def feature_enabled(feature, default=True):
options,
workers,
cpus,
only_pattern,
)
total_pass += count
total_count += len(legate_tests)
Expand All @@ -399,6 +418,7 @@ def feature_enabled(feature, default=True):
options,
workers,
gpus,
only_pattern,
)
total_pass += count
total_count += len(legate_tests)
Expand All @@ -420,6 +440,7 @@ def feature_enabled(feature, default=True):
options,
workers,
openmp * ompthreads,
only_pattern,
)
total_pass += count
total_count += len(legate_tests)
Expand Down Expand Up @@ -556,6 +577,14 @@ def driver():
dest="workers",
help="Number of parallel workers for testing",
)
parser.add_argument(
"--only",
dest="only_pattern",
type=str,
required=False,
default=None,
help="Glob pattern selecting test cases to run.",
)

args, opts = parser.parse_known_args()

Expand Down