Skip to content

Conversation

@Xiaoming-AMD
Copy link
Collaborator

Add execute_patches.sh utility for conditional patch script execution with support for success (exit 0), skip (exit 2), and failure handling.

Changes:

  • Add runner/helpers/execute_patches.sh with conditional patch execution

    • Supports multiple patch scripts with exit code handling
    • Implements skip logic for patches that don't need to run
    • Forces common.sh re-sourcing in subshells to avoid function inheritance issues
    • Provides fallback logging when common.sh is not available
  • Add comprehensive test suite for execute_patches.sh (36 tests)

    • Test no patches, single/multiple patches, skip logic
    • Test error handling: missing patches, unreadable files
    • Test failure scenarios and exit code handling
    • Validates stop-on-first-failure behavior
  • Update run_all_tests.sh to include execute_patches tests

    • Now runs 4 test suites with 121 total tests
    • All tests passing

Add execute_patches.sh utility for conditional patch script execution with
support for success (exit 0), skip (exit 2), and failure handling.

Changes:
- Add runner/helpers/execute_patches.sh with conditional patch execution
  * Supports multiple patch scripts with exit code handling
  * Implements skip logic for patches that don't need to run
  * Forces common.sh re-sourcing in subshells to avoid function inheritance issues
  * Provides fallback logging when common.sh is not available

- Add LOG_ERROR_RANK0 function to runner/lib/common.sh
  * Mirrors LOG_INFO_RANK0 and LOG_SUCCESS_RANK0 pattern
  * Ensures rank 0-only error logging for distributed environments

- Add comprehensive test suite for execute_patches.sh (36 tests)
  * Test no patches, single/multiple patches, skip logic
  * Test error handling: missing patches, unreadable files
  * Test failure scenarios and exit code handling
  * Validates stop-on-first-failure behavior

- Update run_all_tests.sh to include execute_patches tests
  * Now runs 4 test suites with 121 total tests
  * All tests passing

Technical fixes:
- Fix subshell function inheritance issue by unsetting __PRIMUS_COMMON_SOURCED
  before re-sourcing common.sh in execute_patches.sh
- Environment variables are inherited by subshells but functions are not,
  requiring explicit re-sourcing to ensure function availability
@Xiaoming-AMD Xiaoming-AMD merged commit c606188 into main Nov 13, 2025
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants