arguments: tests -- pytest test IDs (e.g. tests/python or tests/python/a_file.py::a_test[param=1]) skip_build -- skip build and setup scripts interactive -- start a shell after running build / test scripts docker-image -- manually specify the docker image to
(
tests: list[str] | None = None,
skip_build: bool = False,
interactive: bool = False,
docker_image: str | None = None,
verbose: bool = False,
**kwargs,
)
| 377 | """ |
| 378 | |
| 379 | def fn( |
| 380 | tests: list[str] | None = None, |
| 381 | skip_build: bool = False, |
| 382 | interactive: bool = False, |
| 383 | docker_image: str | None = None, |
| 384 | verbose: bool = False, |
| 385 | **kwargs, |
| 386 | ) -> None: |
| 387 | """ |
| 388 | arguments: |
| 389 | tests -- pytest test IDs (e.g. tests/python or tests/python/a_file.py::a_test[param=1]) |
| 390 | skip_build -- skip build and setup scripts |
| 391 | interactive -- start a shell after running build / test scripts |
| 392 | docker-image -- manually specify the docker image to use |
| 393 | verbose -- run verbose build |
| 394 | """ |
| 395 | if precheck is not None: |
| 396 | precheck() |
| 397 | |
| 398 | build_dir = get_build_dir(name) |
| 399 | |
| 400 | if skip_build: |
| 401 | scripts = [] |
| 402 | else: |
| 403 | scripts = [ |
| 404 | f"./tests/scripts/task_config_build_{name}.sh {build_dir}", |
| 405 | f"./tests/scripts/task_build.py --build-dir {build_dir}", |
| 406 | ] |
| 407 | |
| 408 | if post_build is not None: |
| 409 | scripts += post_build |
| 410 | |
| 411 | # Check that a test suite was not used alongside specific test names |
| 412 | if any(v for v in kwargs.values()) and tests is not None: |
| 413 | option_flags = ", ".join([f"--{k}" for k in options.keys()]) |
| 414 | clean_exit(f"{option_flags} cannot be used with --tests") |
| 415 | |
| 416 | if tests is not None: |
| 417 | scripts.append(f"python3 -m pytest {' '.join(tests)}") |
| 418 | |
| 419 | # Add named test suites |
| 420 | for option_name, (_, extra_scripts) in options.items(): |
| 421 | if kwargs.get(option_name, False): |
| 422 | scripts.extend(script.format(build_dir=build_dir) for script in extra_scripts) |
| 423 | |
| 424 | docker_env = { |
| 425 | # Need to specify the library path manually or else TVM can't |
| 426 | # determine which build directory to use (i.e. if there are |
| 427 | # multiple copies of libtvm_compiler.so / libtvm_runtime.so laying around) |
| 428 | "TVM_LIBRARY_PATH": str(REPO_ROOT / get_build_dir(name)), |
| 429 | "VERBOSE": "true" if verbose else "false", |
| 430 | } |
| 431 | |
| 432 | if env is not None: |
| 433 | docker_env.update(env) |
| 434 | |
| 435 | docker( |
| 436 | name=gen_name(f"ci-{name}"), |