? drushrc.php
? mw.patch
? shell.txt
? tmp.patch
? update.sh
? includes/database/log.inc
? includes/database/mw.patch
? modules/simpletest/mw.patch
Index: scripts/run-tests.sh
===================================================================
RCS file: /cvs/drupal/drupal/scripts/run-tests.sh,v
retrieving revision 1.9
diff -u -F^f -p -r1.9 run-tests.sh
--- scripts/run-tests.sh	20 Sep 2008 20:22:25 -0000	1.9
+++ scripts/run-tests.sh	22 Sep 2008 00:23:54 -0000
@@ -111,6 +111,8 @@ All arguments are long options.
   --url       Immediately preceeds a URL to set the host and path. You will
               need this parameter if Drupal is in a subdirectory on your
               localhost and you have not set \$base_url in settings.php.
+              
+  --php      The absolute path to the php executable. Usually not needed.
 
   --concurrency [num]
 
@@ -160,6 +162,7 @@ function simpletest_script_parse_args() 
     'list' => FALSE,
     'clean' => FALSE,
     'url' => '',
+    'php' => NULL,
     'concurrency' => 1,
     'all' => FALSE,
     'class' => FALSE,
@@ -225,7 +228,23 @@ function simpletest_script_init() {
 
   $host = 'localhost';
   $path = '';
-  $php = "/usr/bin/php"; // TODO Get dynamically if possible.
+  // Determine location of php command automatically, unless a comamnd line argument is supplied.
+  if (isset($args['php'])) {
+    $php = $args['php'];
+  }
+  elseif (isset($_ENV['_'])) {
+    // '-' id an environment variable set by the shell. It contains the command that was executed.
+    $php = $_ENV['_'];
+  }
+  elseif (isset($_ENV['SUDO_COMMAND'])) {
+    // 'SUDO_COMMAND' is an environment variable set by the sudo program.
+    // Extract only the php interpreter, not the rest of the command.
+    $php = substr($_ENV['SUDO_COMMAND'], 0, strpos($_ENV['SUDO_COMMAND'], ' '));
+  }
+  else {
+    simpletest_script_print_error('Unable to automatically determine the path to the php interpreter. Please supply the --php command line argument.');
+    exit();
+  }
 
   // Get url from arguments.
   if (!empty($args['url'])) {
