Download & Extend

Fix php path detection in run-tests.sh

Project:Drupal core
Version:7.x-dev
Component:simpletest.module
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)
Issue tags:needs backport to D7

Issue Summary

The run-tests.sh script tries to find your php binary by checking $_ENV. This is not safe. If you have variables_order set to "GPCS" in php.ini (which is common), it will be empty. This is what the getenv() function is for. Patch fixes.

Also, it returns the results of the tests with simpletest_script_format_result(), which prints html special characters as if the output is html. Patch also fixes this by capturing the output and running it through htmlspecialchars_decode() so it's less ugly.

AttachmentSizeStatusTest resultOperations
un-f-runtests-script.patch1.39 KBIdlePASSED: [[SimpleTest]]: [MySQL] 35,631 pass(es).View details

Comments

#1

I'd RTBC the first hunk, but I'm not sure about the second one (which requires manual testing for various environments and scenarios [e.g., testbots]).

#2

Status:needs review» needs work

I have been meaning to do the first hunk forever. For some reason, the default PHP production configuration doesn't include E in variables_order (which seems slightly retarded, but that's another issue).

The second one looks like a hack: simpletest_script_format_result() is local to the script runner, so we could likely fix it not to return HTML in some cases (what are those? verbose results?)

#3

Title:Make run-test.sh saner» Fix php path detection in run-tests.sh
Status:needs work» needs review

Ok, here's just the env fix. The output fix should probably have it's own issue.

AttachmentSizeStatusTest resultOperations
un-f-runtests-script-3.patch1018 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 35,371 pass(es).View details

#4

Status:needs review» reviewed & tested by the community

#5

This looks backportable to D7, to me. Is it?

#6

Totally backportable.

#7

#8

Version:8.x-dev» 7.x-dev

Committed to 8.x. Moving to 7.x. Thanks!

#9

Version:7.x-dev» 8.x-dev

This did not get pushed yet, setting back.

#10

#11

Same patch should apply fine for D7 with -p2.

#12

Status:reviewed & tested by the community» needs review

Rerolled.

AttachmentSizeStatusTest resultOperations
drupal-1477110-12.patch998 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 38,859 pass(es).View details

#13

Status:needs review» reviewed & tested by the community

+++ b/scripts/run-tests.shundefined
@@ -253,14 +253,14 @@ function simpletest_script_init($server_software) {
-  elseif (!empty($_ENV['_'])) {
+  elseif ($php_env = getenv('_')) {

Does it look to anyone else like the little face is sadder than it used to be?

(RTBC)

#14

Status:reviewed & tested by the community» fixed

great thanks!

committed and pushed to 7.x.

#15

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.