-
Notifications
You must be signed in to change notification settings - Fork 104
Create separate test run scripts #722
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?
Conversation
📝 WalkthroughWalkthroughNew Bash wrapper scripts are added to encapsulate test execution for Google Test binaries and Python test suites. Existing CI test scripts are refactored to delegate test execution to these wrapper scripts instead of performing inline execution, improving modularity and consistency across the CI pipeline. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
ci/run_ctests.sh (1)
24-28: Consider adding glob failure handling for edge cases.If
GTEST_DIRexists but contains no*_TESTfiles, the glob won't expand and the loop will attempt to execute a literal*_TESTcommand, producing an unclear error message. This is unlikely in practice but could be handled for robustness.Add this check before the loop:
+# Ensure test binaries exist +shopt -s nullglob for gt in "${GTEST_DIR}"/*_TEST; do test_name=$(basename "${gt}") echo "Running gtest ${test_name}" "${gt}" "$@" done +shopt -u nullglobOr alternatively, add an explicit check:
+if ! compgen -G "${GTEST_DIR}/*_TEST" > /dev/null; then + echo "Error: No test binaries found matching ${GTEST_DIR}/*_TEST" >&2 + exit 1 +fi for gt in "${GTEST_DIR}"/*_TEST; do test_name=$(basename "${gt}") echo "Running gtest ${test_name}" "${gt}" "$@" done
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
ci/run_ctests.sh(1 hunks)ci/run_cuopt_pytests.sh(1 hunks)ci/run_cuopt_server_pytests.sh(1 hunks)ci/test_cpp.sh(1 hunks)ci/test_python.sh(1 hunks)ci/test_wheel_cuopt.sh(1 hunks)ci/test_wheel_cuopt_server.sh(1 hunks)
🧰 Additional context used
🧠 Learnings (7)
📓 Common learnings
Learnt from: CR
Repo: NVIDIA/cuopt PR: 0
File: .github/.coderabbit_review_guide.md:0-0
Timestamp: 2025-11-25T10:20:49.822Z
Learning: Applies to **/*test*.{cpp,cu,py} : Ensure test isolation: prevent GPU state, cached memory, and global variables from leaking between test cases; verify each test independently initializes its environment
📚 Learning: 2025-11-25T10:20:49.822Z
Learnt from: CR
Repo: NVIDIA/cuopt PR: 0
File: .github/.coderabbit_review_guide.md:0-0
Timestamp: 2025-11-25T10:20:49.822Z
Learning: Applies to **/*test*.{cpp,cu,py} : Ensure test isolation: prevent GPU state, cached memory, and global variables from leaking between test cases; verify each test independently initializes its environment
Applied to files:
ci/test_wheel_cuopt.shci/run_cuopt_server_pytests.shci/run_ctests.shci/test_python.shci/test_cpp.shci/run_cuopt_pytests.sh
📚 Learning: 2025-11-25T10:20:49.822Z
Learnt from: CR
Repo: NVIDIA/cuopt PR: 0
File: .github/.coderabbit_review_guide.md:0-0
Timestamp: 2025-11-25T10:20:49.822Z
Learning: Applies to **/*benchmark*.{cpp,cu,py} : Include performance benchmarks and regression detection for GPU operations; verify near real-time performance on million-variable problems
Applied to files:
ci/test_wheel_cuopt.shci/run_ctests.shci/test_cpp.sh
📚 Learning: 2025-11-25T10:20:49.822Z
Learnt from: CR
Repo: NVIDIA/cuopt PR: 0
File: .github/.coderabbit_review_guide.md:0-0
Timestamp: 2025-11-25T10:20:49.822Z
Learning: Applies to **/*test*.{cpp,cu,py} : Write tests validating numerical correctness of optimization results (not just 'runs without error'); test degenerate cases (infeasible, unbounded, empty, singleton problems)
Applied to files:
ci/test_wheel_cuopt.shci/run_ctests.shci/run_cuopt_pytests.sh
📚 Learning: 2025-11-25T10:20:49.822Z
Learnt from: CR
Repo: NVIDIA/cuopt PR: 0
File: .github/.coderabbit_review_guide.md:0-0
Timestamp: 2025-11-25T10:20:49.822Z
Learning: Applies to **/*test*.{cpp,cu,py} : Add tests for algorithm phase transitions: verify correct initialization of bounds and state when transitioning from presolve to simplex to diving to crossover
Applied to files:
ci/run_ctests.shci/test_cpp.sh
📚 Learning: 2025-11-25T10:20:49.822Z
Learnt from: CR
Repo: NVIDIA/cuopt PR: 0
File: .github/.coderabbit_review_guide.md:0-0
Timestamp: 2025-11-25T10:20:49.822Z
Learning: Applies to **/*test*.{cpp,cu,py} : Add tests for problem transformations: verify correctness of original→transformed→postsolve mappings and index consistency across problem representations
Applied to files:
ci/run_ctests.sh
📚 Learning: 2025-11-25T10:20:49.822Z
Learnt from: CR
Repo: NVIDIA/cuopt PR: 0
File: .github/.coderabbit_review_guide.md:0-0
Timestamp: 2025-11-25T10:20:49.822Z
Learning: Applies to **/*test*.{cpp,cu,py} : Test with free variables, singleton problems, and extreme problem dimensions near resource limits to validate edge case handling
Applied to files:
ci/test_cpp.sh
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: wheel-build-cuopt-mps-parser / 13.0.2, 3.10, amd64, rockylinux8
- GitHub Check: wheel-build-cuopt-mps-parser / 13.0.2, 3.12, arm64, rockylinux8
- GitHub Check: wheel-build-cuopt-mps-parser / 13.0.2, 3.10, arm64, rockylinux8
- GitHub Check: wheel-build-cuopt-mps-parser / 13.0.2, 3.11, amd64, rockylinux8
- GitHub Check: checks / check-style
🔇 Additional comments (12)
ci/run_cuopt_pytests.sh (2)
1-10: LGTM! Robust path resolution and strict error handling.The script correctly uses
set -euo pipefailfor strict error handling, and the path resolution withrealpathandBASH_SOURCE[0]ensures the script works when invoked from any location. Thecdwill fail fast if the target directory doesn't exist, thanks to the-eflag.
12-12: LGTM! Proper argument forwarding.The
"$@"forwarding allows callers to pass additional pytest flags (e.g., coverage, JUnit XML output) while--cache-clearensures consistent test runs.ci/run_cuopt_server_pytests.sh (1)
1-12: LGTM! Consistent with cuopt pytest wrapper.This script follows the same pattern as
ci/run_cuopt_pytests.sh, ensuring consistent behavior across test suites. The structure, error handling, and argument forwarding are all appropriate.ci/test_wheel_cuopt_server.sh (1)
31-31: LGTM! Clean delegation to wrapper script.The change correctly delegates test execution to the new
run_cuopt_server_pytests.shwrapper while preserving the timeout and pytest flags. This aligns with the PR's goal of centralizing test execution logic.ci/test_cpp.sh (2)
51-52: LGTM! Proper gtest XML output configuration.The
GTEST_OUTPUTenvironment variable is correctly exported before invoking the test runner, ensuring all gtests generate XML reports in the specified directory.
55-55: Note the timeout semantic change: from per-test 20m to total wrapper 40m. The timeout changed from an individual limit per test (20m per${gt}in the loop) to a total limit for all tests combined (40m for./ci/run_ctests.sh). Since the wrapper script runs tests sequentially without per-test timeouts, verify that 40m total accommodates all tests' actual execution time plus a reasonable buffer.ci/test_wheel_cuopt.sh (1)
65-65: LGTM! Consistent delegation to wrapper script.The change correctly delegates to
run_cuopt_pytests.shwhile preserving timeout and pytest flags. TheRAPIDS_DATASET_ROOT_DIRenvironment variable set at line 55 is properly inherited by the wrapper script.ci/test_python.sh (2)
61-67: LGTM! Cleaner test invocation with wrapper.The refactoring correctly delegates to
run_cuopt_pytests.sh, eliminating manual directory changes and redundant--cache-clearflags. Coverage and JUnit XML configurations are properly forwarded.
70-75: LGTM! Consistent wrapper delegation.The cuopt_server test invocation follows the same clean pattern as the cuopt tests, with proper forwarding of coverage and reporting configurations to the wrapper script.
ci/run_ctests.sh (3)
1-5: LGTM! Standard script setup.The script uses appropriate strict error handling with
set -euo pipefail, consistent with the other test wrapper scripts.
7-22: LGTM! Robust multi-environment path resolution.The script correctly handles both CI (conda/installed) and devcontainer (build directory) environments. The error message clearly lists all searched locations, and the fallback logic prioritizes the installed location over the build directory, which is the correct ordering for CI environments.
24-28: LGTM! Clean sequential test execution.The test discovery via glob pattern and sequential execution with argument forwarding is straightforward and correct. The echo statement before each test execution aids debugging and provides clear progress indication.
Description
This PR creates separate test run scripts like
ci/run_ctests.sh. This aligns with the pattern used in RAPIDS libraries. I am exploring adding devcontainers to cuOpt (rapidsai/devcontainers#637), and this change would help with allowing tests to run in both CI and devcontainer environments.Checklist
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.