Skip to content

Conversation

dragoonis
Copy link
Contributor

No description provided.

@dragoonis dragoonis changed the title Run tests cleanup 1 Run-Tests Modernization Jun 18, 2020
@dragoonis dragoonis force-pushed the run-tests-cleanup-1 branch from 2038a98 to 8fe7690 Compare June 18, 2020 10:14
@dragoonis
Copy link
Contributor Author

@KalleZ I've resolved our conversation as I've moved things to snake_case.

@nikic
Copy link
Member

nikic commented Jun 19, 2020

Please rebase this PR, so that the first (now committed) commit will be dropped.

@dragoonis
Copy link
Contributor Author

@nikic i will. Thanks.

@dragoonis dragoonis force-pushed the run-tests-cleanup-1 branch from 8fe7690 to eafcd0a Compare June 20, 2020 18:20
@dragoonis dragoonis force-pushed the run-tests-cleanup-1 branch from eafcd0a to be6e80c Compare June 20, 2020 18:22
@dragoonis dragoonis changed the title Run-Tests Modernization Run-Tests Cleanup / Modernization Jun 20, 2020
@dragoonis
Copy link
Contributor Author

@nikic rebased and ready for merge.

/* Let there be no top-level code beyond this point:
* Only functions and classes, thanks!
*
* Minimum required PHP version: 7.0.0
Copy link
Member

Choose a reason for hiding this comment

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

As you are using void, update this comment to say 7.1.0.

$workerID = intval(getenv("TEST_PHP_WORKER"));
run_worker();
$workerID = get_worker_id();
if($workerID) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if($workerID) {
if ($workerID) {

break;
case 'r':
case 'l':
// @Dragoonis
Copy link
Member

Choose a reason for hiding this comment

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

Leftover?

return 0;
}

return intval(getenv("TEST_PHP_WORKER"));
Copy link
Member

Choose a reason for hiding this comment

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

This function can be simplified to (int) getenv("TEST_PHP_WORKER").


function get_max_workers_from_test_files($workers, $test_files): int
{
return max(1, min($workers, count($test_files)));
Copy link
Member

Choose a reason for hiding this comment

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

This code seems easier to understand if left inlined.




function get_number_of_workers($workers): int
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
function get_number_of_workers($workers): int
function parse_number_of_workers(string $workers): int

maybe

$cleanWorkers = intval($cleanWorkers, 10);
// Don't use parallel testing infrastructure if there is only one worker.
if ($cleanWorkers === 1) {
$cleanWorkers = null;
Copy link
Member

Choose a reason for hiding this comment

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

This should be either 0, or the return type should be ?int.

'SKIPIF', 'XFAIL', 'XLEAK', 'CLEAN',
'CREDITS', 'DESCRIPTION', 'CONFLICTS', 'WHITESPACE_SENSITIVE',
))) {
if (is_section_unknown($section)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I would prefer if this was !is_section_known($section) or !is_known_section($section).

@krakjoe
Copy link
Member

krakjoe commented Aug 31, 2025

Closing as this is out of date, and contains open questions or otherwise was not responded too when it was reviewed.

If you feel strongly I'm wrong, please open a fresh PR against master, linking to this one, that resolves all open questions.

Thanks for taking the time ;)

@krakjoe krakjoe closed this Aug 31, 2025
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.

6 participants