Skip to content

run-tests: removed unused code #16675

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

Merged
merged 3 commits into from
Nov 2, 2024
Merged

run-tests: removed unused code #16675

merged 3 commits into from
Nov 2, 2024

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Nov 2, 2024

No description provided.

run-tests.php Outdated
@@ -3651,11 +3650,6 @@ class RuntestsValgrind
protected bool $version_3_8_0;
protected string $tool;

public function getHeader(): string
Copy link
Contributor Author

Choose a reason for hiding this comment

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

never invoked method

Copy link
Member

Choose a reason for hiding this comment

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

You sure?

VALGRIND : " . ($valgrind ? $valgrind->getHeader() : 'Not used') . "

run-tests.php Outdated
@@ -3672,20 +3666,6 @@ public function __construct(array $environment, string $tool = 'memcheck')
$this->header = sprintf("%s (%s)", trim($header), $this->tool);
$this->version_3_8_0 = version_compare($version, '3.8.0', '>=');
}

public function wrapCommand(string $cmd, string $memcheck_filename, bool $check_all): string
Copy link
Contributor Author

Choose a reason for hiding this comment

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

never invoked method.

in the past this was used in

php-src/run-tests.php

Lines 2432 to 2437 in 196f8fd

if ($valgrind) {
$env['USE_ZEND_ALLOC'] = '0';
$env['ZEND_DONT_UNLOAD_MODULES'] = 1;
$cmd = $valgrind->wrapCommand($cmd, $memcheck_filename, strpos($test_file, "pcre") !== false);
}

Copy link
Member

Choose a reason for hiding this comment

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

Why do you think this if code can no longer be executed? Or how did you conclude this is never invoked?

Copy link
Contributor Author

@staabm staabm Nov 2, 2024

Choose a reason for hiding this comment

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

good catch!

phpstorm indicated the unused code. it seems it got tricked by the untyped global variables (and I got tricked by phpstorm ;)).

would you accept a new PR which gets rid of global variables in run-tests where possible?

Copy link
Member

Choose a reason for hiding this comment

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

Maybe that's not worth it, it will make merging fixes in the test runner from lower to higher branches a bit harder, for no obvious benefit imho.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see. proposed something in #16678 - feel free to close it if you don't think its valuable

@staabm staabm marked this pull request as ready for review November 2, 2024 09:06
/**
* @return bool|int
*/
function comp_line(string $l1, string $l2, bool $is_reg)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

never called function

run-tests.php Outdated
@@ -3651,11 +3650,6 @@ class RuntestsValgrind
protected bool $version_3_8_0;
protected string $tool;

public function getHeader(): string
Copy link
Member

Choose a reason for hiding this comment

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

You sure?

VALGRIND : " . ($valgrind ? $valgrind->getHeader() : 'Not used') . "

run-tests.php Outdated
@@ -3672,20 +3666,6 @@ public function __construct(array $environment, string $tool = 'memcheck')
$this->header = sprintf("%s (%s)", trim($header), $this->tool);
$this->version_3_8_0 = version_compare($version, '3.8.0', '>=');
}

public function wrapCommand(string $cmd, string $memcheck_filename, bool $check_all): string
Copy link
Member

Choose a reason for hiding this comment

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

Why do you think this if code can no longer be executed? Or how did you conclude this is never invoked?

@staabm staabm force-pushed the run-tests-unused branch 3 times, most recently from 97c05d7 to 1c43015 Compare November 2, 2024 09:42
@nielsdos nielsdos merged commit cf5ded9 into php:master Nov 2, 2024
11 of 18 checks passed
@staabm staabm deleted the run-tests-unused branch November 2, 2024 10:45
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.

2 participants