Skip to content

Commit ade0be3

Browse files
test: support non-root checkout paths
Signed-off-by: svcnemo-autobot <svcnemo-autobot@nvidia.com>
1 parent 7cdfb32 commit ade0be3

16 files changed

Lines changed: 124 additions & 85 deletions

CONTRIBUTING.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,29 @@ On a machine with CUDA, you can additionally sync vLLM:
2121
uv sync --extra te --extra vllm
2222
```
2323

24+
### CI container
25+
26+
To reproduce CI without modifying the prebuilt image, mount a checkout at any
27+
writable location and run with your host user. Replace `$IMAGE` with the image
28+
built by the `cicd-container-build` job and `$COMMIT` with the revision under
29+
test:
30+
31+
```bash
32+
git worktree add --detach export-deploy-test "$COMMIT"
33+
docker run --rm -it \
34+
--user "$(id -u):$(id -g)" \
35+
--env HOME=/tmp/export-deploy-home \
36+
--env PATH=/opt/venv/bin:/usr/local/bin:/usr/bin:/bin \
37+
--workdir /workdir \
38+
--volume "$(pwd)/export-deploy-test:/workdir" \
39+
"$IMAGE" \
40+
bash tests/unit_tests/L0_Unit_Tests_CPU.sh
41+
```
42+
43+
GPU and functional scripts can be invoked from the same checkout after adding
44+
the runtime's GPU flags and test-data mount. The scripts write coverage data to
45+
the checkout root rather than requiring `/workspace` or root privileges.
46+
2447
## 📦 Dependencies management
2548

2649
We use [uv](https://docs.astral.sh/uv/) for managing dependencies. For reproducible builds, our project tracks the generated `uv.lock` file in the repository.

tests/coverage.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright (c) 2026, NVIDIA CORPORATION. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
from pathlib import Path
16+
17+
PROJECT_ROOT = Path(__file__).resolve().parent.parent
18+
COVERAGE_DATA_FILE = PROJECT_ROOT / ".coverage"
19+
20+
21+
def coverage_args() -> list[str]:
22+
"""Return coverage arguments rooted at the active checkout."""
23+
return [
24+
"coverage",
25+
"run",
26+
f"--data-file={COVERAGE_DATA_FILE}",
27+
f"--source={PROJECT_ROOT}",
28+
"--parallel-mode",
29+
]

tests/functional_tests/L2_Launch_InFramework.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616
set -xeuo pipefail # Exit immediately if a command exits with a non-zero status
1717

1818
export CUDA_VISIBLE_DEVICES="0,1"
19+
PROJECT_ROOT=$(git rev-parse --show-toplevel)
1920

2021
coverage run \
21-
--data-file=/workspace/.coverage \
22-
--source=/workspace/ \
22+
--data-file="$PROJECT_ROOT/.coverage" \
23+
--source="$PROJECT_ROOT" \
2324
--parallel-mode \
2425
-m pytest \
2526
-o log_cli=true \

tests/functional_tests/L2_Launch_vLLM.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616
set -xeuo pipefail # Exit immediately if a command exits with a non-zero status
1717

1818
export CUDA_VISIBLE_DEVICES="0"
19+
PROJECT_ROOT=$(git rev-parse --show-toplevel)
1920

2021
coverage run \
21-
--data-file=/workspace/.coverage \
22-
--source=/workspace/ \
22+
--data-file="$PROJECT_ROOT/.coverage" \
23+
--source="$PROJECT_ROOT" \
2324
--parallel-mode \
2425
-m pytest \
2526
-o log_cli=true \

tests/functional_tests/L2_ONNX_TRT.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@ set -xeuo pipefail # Exit immediately if a command exits with a non-zero status
1919
pushd .. && uv pip install transformers==4.51.3 && popd
2020

2121
export CUDA_VISIBLE_DEVICES="0,1"
22+
PROJECT_ROOT=$(git rev-parse --show-toplevel)
2223

2324
coverage run \
24-
--data-file=/workspace/.coverage \
25-
--source=/workspace/ \
25+
--data-file="$PROJECT_ROOT/.coverage" \
26+
--source="$PROJECT_ROOT" \
2627
--parallel-mode \
2728
-m pytest \
2829
-o log_cli=true \

tests/functional_tests/tests_inframework/test_deploy_query_hf_ray.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
import subprocess
1717
import time
1818

19+
from tests.coverage import coverage_args
20+
1921
logging.basicConfig(level=logging.INFO)
2022
logger = logging.getLogger(__name__)
2123

@@ -45,11 +47,7 @@ def test_deploy_ray_hf(self):
4547
# Run Ray deployment for HF model
4648
self.deploy_proc = subprocess.Popen(
4749
[
48-
"coverage",
49-
"run",
50-
"--data-file=/workspace/.coverage",
51-
"--source=/workspace/",
52-
"--parallel-mode",
50+
*coverage_args(),
5351
"scripts/deploy/nlp/deploy_ray_hf.py",
5452
"--model_path",
5553
hf_model_path,

tests/functional_tests/tests_inframework/test_deploy_query_mbridge_ray.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
import subprocess
1717
import time
1818

19+
from tests.coverage import coverage_args
20+
1921
logging.basicConfig(level=logging.INFO)
2022
logger = logging.getLogger(__name__)
2123

@@ -48,11 +50,7 @@ def test_deploy_ray(self):
4850
# Run Ray deployment
4951
self.deploy_proc = subprocess.Popen(
5052
[
51-
"coverage",
52-
"run",
53-
"--data-file=/workspace/.coverage",
54-
"--source=/workspace/",
55-
"--parallel-mode",
53+
*coverage_args(),
5654
"scripts/deploy/nlp/deploy_ray_inframework.py",
5755
"--megatron_checkpoint",
5856
mbridge_checkpoint_path,

tests/functional_tests/tests_inframework/test_deploy_query_vlm_ray.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
import requests
2020

21+
from tests.coverage import coverage_args
22+
2123
logging.basicConfig(level=logging.INFO)
2224
logger = logging.getLogger(__name__)
2325

@@ -72,11 +74,7 @@ def test_deploy_ray(self):
7274
# Run Ray deployment for Megatron multimodal (VLM) model
7375
self.deploy_proc = subprocess.Popen(
7476
[
75-
"coverage",
76-
"run",
77-
"--data-file=/workspace/.coverage",
78-
"--source=/workspace/",
79-
"--parallel-mode",
77+
*coverage_args(),
8078
"scripts/deploy/multimodal/deploy_ray_inframework.py",
8179
"--megatron_checkpoint",
8280
vlm_checkpoint_path,

tests/functional_tests/tests_onnx_trt/test_export.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
import pytest
2222

23+
from tests.coverage import coverage_args
24+
2325
logging.basicConfig(level=logging.INFO)
2426
logger = logging.getLogger(__name__)
2527

@@ -38,11 +40,7 @@ class TestONNXTRTExport:
3840
def test_export_onnx_trt_embedding(self):
3941
subprocess.run(
4042
[
41-
"coverage",
42-
"run",
43-
"--data-file=/workspace/.coverage",
44-
"--source=/workspace/",
45-
"--parallel-mode",
43+
*coverage_args(),
4644
"tests/functional_tests/utils/run_onnx_trt_embedding_export.py",
4745
"--hf_model_path",
4846
"/home/TestData/llm/models/llama-3.2-nv-embedqa-1b-v2",
@@ -58,11 +56,7 @@ def test_export_onnx_trt_embedding(self):
5856
def test_export_onnx_trt_embedding_int8(self):
5957
subprocess.run(
6058
[
61-
"coverage",
62-
"run",
63-
"--data-file=/workspace/.coverage",
64-
"--source=/workspace/",
65-
"--parallel-mode",
59+
*coverage_args(),
6660
"tests/functional_tests/utils/run_onnx_trt_embedding_export.py",
6761
"--hf_model_path",
6862
"/home/TestData/llm/models/llama-3.2-nv-embedqa-1b-v2",
@@ -85,11 +79,7 @@ def test_export_onnx_trt_embedding_int8(self):
8579
def test_export_onnx_trt_reranking(self):
8680
subprocess.run(
8781
[
88-
"coverage",
89-
"run",
90-
"--data-file=/workspace/.coverage",
91-
"--source=/workspace/",
92-
"--parallel-mode",
82+
*coverage_args(),
9383
"tests/functional_tests/utils/run_onnx_trt_reranking_export.py",
9484
"--hf_model_path",
9585
"/home/TestData/llm/models/llama-3.2-nv-reranker-1b",

tests/functional_tests/tests_vllm/test_deploy_query_hf_ray_vllm.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
import subprocess
1717
import time
1818

19+
from tests.coverage import coverage_args
20+
1921
logging.basicConfig(level=logging.INFO)
2022
logger = logging.getLogger(__name__)
2123

@@ -46,11 +48,7 @@ def test_deploy_ray_hf_vllm_backend(self):
4648
# Run Ray deployment for HF model with vLLM backend
4749
self.deploy_proc = subprocess.Popen(
4850
[
49-
"coverage",
50-
"run",
51-
"--data-file=/workspace/.coverage",
52-
"--source=/workspace/",
53-
"--parallel-mode",
51+
*coverage_args(),
5452
"scripts/deploy/nlp/deploy_ray_hf.py",
5553
"--model_path",
5654
hf_model_path,
@@ -134,11 +132,7 @@ def test_deploy_ray_hf_vllm_backend_with_parameters(self):
134132
# Run Ray deployment for HF model with vLLM backend and custom parameters
135133
self.deploy_proc = subprocess.Popen(
136134
[
137-
"coverage",
138-
"run",
139-
"--data-file=/workspace/.coverage",
140-
"--source=/workspace/",
141-
"--parallel-mode",
135+
*coverage_args(),
142136
"scripts/deploy/nlp/deploy_ray_hf.py",
143137
"--model_path",
144138
hf_model_path,

0 commit comments

Comments
 (0)