-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[TRTLLMINF-133][infra] Move check testlist stage earlier in CI #17513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # CI tool versions shared across Jenkins pipelines and Python scripts. | ||
| # Format: KEY=VALUE (no quotes, no spaces around '='). | ||
| # | ||
| # Consumed by: | ||
| # - jenkins/L0_Test.groovy (readProperties) | ||
| # - scripts/check_test_list.py (key=value parse) | ||
| TRT_TEST_DB_VERSION=1.8.5+bc6df7 | ||
|
tburt-nv marked this conversation as resolved.
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,12 @@ | |
| --waive: Check only the tests in $LLM_ROOT/tests/integration/test_list/waives.txt. | ||
| --validate: Run AST-based validation of test list entries against source files. | ||
|
|
||
| Collection stub (``--l0`` / ``--qa`` / ``--waive``): | ||
| These modes run ``pytest --co`` with the plugin | ||
| ``tests/integration/defs/stubify_bindings.py`` to avoid compiling or | ||
| downloading TRT-LLM C++ binaries. Instead, the plugin creates a pure-Python | ||
| stub of the compiled modules. | ||
|
|
||
| Note: | ||
| All the perf tests will be excluded since they are generated dynamically. | ||
| """ | ||
|
|
@@ -523,23 +529,63 @@ def validate_test_lists(test_lists_dir: str, test_base_dir: str): | |
|
|
||
|
|
||
| # ============================================================================= | ||
| # L0 / QA / Waive verification (runtime, requires pytest + model weights) | ||
| # L0 / QA / Waive verification (runtime pytest --co with bindings collection stub) | ||
| # ============================================================================= | ||
|
|
||
|
|
||
| def install_python_dependencies(llm_src): | ||
| def _get_trt_test_db_version() -> str: | ||
| """Read TRT_TEST_DB_VERSION from jenkins/ci_versions.properties.""" | ||
| props_file = Path( | ||
| __file__).resolve().parent.parent / "jenkins" / "ci_versions.properties" | ||
| with open(props_file) as f: | ||
| for line in f: | ||
| line = line.strip() | ||
| if line.startswith("TRT_TEST_DB_VERSION="): | ||
| return line.split("=", 1)[1] | ||
| raise RuntimeError(f"TRT_TEST_DB_VERSION not found in {props_file}") | ||
|
|
||
|
|
||
| def install_python_dependencies(llm_src: str) -> None: | ||
| """Install Python deps for collection — no TRT-LLM wheel or compile.""" | ||
| subprocess.run(f"cd {llm_src} && pip3 install -r requirements-dev.txt", | ||
| shell=True, | ||
| check=True) | ||
|
|
||
| trt_test_db_ver = _get_trt_test_db_version() | ||
| subprocess.run( | ||
| f"pip3 install --force-reinstall --no-deps {llm_src}/../tensorrt_llm-*.whl", | ||
| f"pip3 install --extra-index-url https://urm.nvidia.com/artifactory/api/pypi/sw-tensorrt-pypi/simple " | ||
| f"--ignore-installed trt-test-db=={trt_test_db_ver}", | ||
| shell=True, | ||
| check=True) | ||
|
|
||
|
|
||
| def _collection_pytest_env(llm_src: str) -> dict[str, str]: | ||
| """Env for stubbed ``pytest --co``: PYTHONPATH + placeholder models root.""" | ||
| # The stubify_bindings plugin needs to be in the PYTHONPATH so it can be imported by pytest. | ||
| defs_dir = os.path.join(llm_src, "tests", "integration", "defs") | ||
| existing = os.environ.get("PYTHONPATH", "") | ||
| pythonpath = os.pathsep.join(p for p in (llm_src, defs_dir, existing) if p) | ||
| return { | ||
| **os.environ, | ||
| "PYTHONPATH": pythonpath, | ||
| "TRT_LLM_NO_LIB_INIT": "1", | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nobody should be attempting to use |
||
| # Collection only needs llm_models_root() to be a directory. | ||
| # Fixtures and weight loads do not run under pytest --co. | ||
| "LLM_MODELS_ROOT": "/tmp", | ||
| } | ||
|
|
||
|
|
||
| def _run_collection_pytest(llm_src: str, test_list: str) -> None: | ||
| """Run pytest --co with the collection bindings stub plugin.""" | ||
| env = _collection_pytest_env(llm_src) | ||
| subprocess.run( | ||
| "pip3 install --extra-index-url https://urm.nvidia.com/artifactory/api/pypi/sw-tensorrt-pypi/simple " | ||
| "--ignore-installed trt-test-db==1.8.5+bc6df7", | ||
| f"cd {llm_src}/tests/integration/defs && " | ||
| f"pytest -p stubify_bindings --test-list={test_list} " | ||
| f"--output-dir={llm_src} -s --co -q", | ||
| shell=True, | ||
| check=True) | ||
| check=True, | ||
| env=env, | ||
| ) | ||
|
tburt-nv marked this conversation as resolved.
|
||
|
|
||
|
|
||
| def verify_l0_test_lists(llm_src): | ||
|
|
@@ -591,11 +637,7 @@ def verify_l0_test_lists(llm_src): | |
| with open(test_list, "w") as f: | ||
| f.writelines(f"{line}\n" for line in sorted(cleaned_lines)) | ||
|
|
||
| subprocess.run( | ||
| f"cd {llm_src}/tests/integration/defs && " | ||
| f"pytest --test-list={test_list} --output-dir={llm_src} -s --co -q", | ||
| shell=True, | ||
| check=True) | ||
| _run_collection_pytest(llm_src, test_list) | ||
|
|
||
|
|
||
| def verify_qa_test_lists(llm_src): | ||
|
|
@@ -605,11 +647,7 @@ def verify_qa_test_lists(llm_src): | |
| test_def_files = subprocess.check_output( | ||
| f"ls -d {test_qa_path}/*.txt", shell=True).decode().strip().split('\n') | ||
| for test_def_file in test_def_files: | ||
| subprocess.run( | ||
| f"cd {llm_src}/tests/integration/defs && " | ||
| f"pytest --test-list={test_def_file} --output-dir={llm_src} -s --co -q", | ||
| shell=True, | ||
| check=True) | ||
| _run_collection_pytest(llm_src, test_def_file) | ||
| # append all the test_def_file to qa_test.txt | ||
| with open(f"{llm_src}/qa_test.txt", "a") as f: | ||
| with open(test_def_file, "r") as test_file: | ||
|
|
@@ -720,11 +758,7 @@ def verify_waive_list(llm_src, args): | |
| with open(tmp_waives_file, "w") as f: | ||
| f.writelines(f"{line}\n" for line in sorted(processed_lines)) | ||
|
|
||
| subprocess.run( | ||
| f"cd {llm_src}/tests/integration/defs && " | ||
| f"pytest --test-list={tmp_waives_file} --output-dir={llm_src} -s --co -q", | ||
| shell=True, | ||
| check=True) | ||
| _run_collection_pytest(llm_src, tmp_waives_file) | ||
|
|
||
|
|
||
| def main(): | ||
|
|
@@ -765,7 +799,6 @@ def main(): | |
| script_dir = os.path.dirname(os.path.realpath(__file__)) | ||
| llm_src = os.path.abspath(os.path.join(script_dir, "../")) | ||
|
|
||
| # Only skip installing dependencies if ONLY --check-duplicates or --validate is used | ||
| if args.l0 or args.qa or args.waive: | ||
| install_python_dependencies(llm_src) | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.