Skip to content

Run-Tests Cleanup / Modernization #5707

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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.

@@ -31,7 +31,7 @@
* 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).

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