Skip to content

Conversation

@linxpinx
Copy link
Contributor

@linxpinx linxpinx commented Jul 7, 2025

How to reproduce this Issue:
Run runTests.sh on Linux with SELinux e.g. Fedora. It fails with Permission denied Error.

Excellent! The fix is now cross-platform compatible. Here's what the updated solution does:

Cross-Platform Fix Summary

Fixed Issues:

  1. Permission denied error when running PHPUnit in containers
  2. Cross-platform compatibility for Docker/Podman on Linux and macOS

Changes Made:

  1. PHPUnit Execution Fix: • Changed from executing .Build/bin/phpunit (wrapper script with permission issues) • To using php .Build/vendor/phpunit/phpunit/phpunit (direct PHP execution) • Applied to all test suites: unit, unitRandom, and functional
  2. Platform-Aware Volume Mounting: • Linux + Podman: Uses -v ${ROOT_DIR}:${ROOT_DIR}:Z (with SELinux context labeling) • macOS + Podman: Uses -v ${ROOT_DIR}:${ROOT_DIR} (without SELinux flag) • Docker: Unchanged behavior on all platforms

How It Works:
• Detects the operating system using uname
• On Linux systems with Podman, adds the :Z flag for proper SELinux context labeling • On macOS systems with Podman, omits the :Z flag since SELinux is not available • Maintains existing Docker behavior unchanged

Benefits:
✅ Linux users get proper SELinux support with Podman ✅ macOS users can use Podman without SELinux errors ✅ Docker users on any platform continue to work as before ✅ All PHPUnit execution methods now bypass permission issues

The solution is now fully cross-platform and should work seamlessly for Mac users with both Docker and Podman!

Excellent! The fix is now cross-platform compatible. Here's what the updated solution does:

Cross-Platform Fix Summary

Fixed Issues:
1. Permission denied error when running PHPUnit in containers
2. Cross-platform compatibility for Docker/Podman on Linux and macOS

Changes Made:

1. PHPUnit Execution Fix:
•  Changed from executing .Build/bin/phpunit (wrapper script with permission issues)
•  To using php .Build/vendor/phpunit/phpunit/phpunit (direct PHP execution)
•  Applied to all test suites: unit, unitRandom, and functional
2. Platform-Aware Volume Mounting:
•  Linux + Podman: Uses -v ${ROOT_DIR}:${ROOT_DIR}:Z (with SELinux context labeling)
•  macOS + Podman: Uses -v ${ROOT_DIR}:${ROOT_DIR} (without SELinux flag)
•  Docker: Unchanged behavior on all platforms

How It Works:
•  Detects the operating system using uname
•  On Linux systems with Podman, adds the :Z flag for proper SELinux context labeling
•  On macOS systems with Podman, omits the :Z flag since SELinux is not available
•  Maintains existing Docker behavior unchanged

Benefits:
✅ Linux users get proper SELinux support with Podman  
✅ macOS users can use Podman without SELinux errors  
✅ Docker users on any platform continue to work as before  
✅ All PHPUnit execution methods now bypass permission issues  

The solution is now fully cross-platform and should work seamlessly for Mac users with both Docker and Podman!
@coveralls
Copy link

Pull Request Test Coverage Report for Build 16116984068

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 16115288185: 0.0%
Covered Lines: 107
Relevant Lines: 107

💛 - Coveralls

@linxpinx linxpinx moved this to In review in Best Practices Remote Day Jul 9, 2025
@linxpinx linxpinx changed the title Fix the runTests.sh for Linux [Task] Fix the runTests.sh for Linux Jul 9, 2025
@d-s-codappix d-s-codappix requested a review from a team July 10, 2025 05:18
@d-s-codappix d-s-codappix added this to the 4.0.0: Breaking changes milestone Jul 10, 2025
@linxpinx linxpinx self-assigned this Jul 14, 2025
Copy link
Contributor

@oliverklee oliverklee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To proceed, this PR needs an associated ticket that describes the problem and how to reproduce it.

functional)
[ -z "${TEST_FILE}" ] && TEST_FILE="Tests/Functional"
COMMAND=".Build/bin/phpunit -c Build/phpunit/FunctionalTests.xml --exclude-group not-${DBMS} ${EXTRA_TEST_OPTIONS} ${TEST_FILE}"
COMMAND="php .Build/vendor/phpunit/phpunit/phpunit -c Build/phpunit/FunctionalTests.xml --exclude-group not-${DBMS} ${EXTRA_TEST_OPTIONS} ${TEST_FILE}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change looks unrelated. (Also, it doesn't make sense that only the calls to the phpunit binary are changed, but not the calls to phpstan, php-cs-fixer etc.

@oliverklee oliverklee moved this from In review to In Progress in Best Practices Remote Day Nov 3, 2025
@oliverklee oliverklee marked this pull request as draft November 30, 2025 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants