Index: modules/simpletest/drupal_web_test_case.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/drupal_web_test_case.php,v
retrieving revision 1.96
diff -u -p -r1.96 drupal_web_test_case.php
--- modules/simpletest/drupal_web_test_case.php	22 Apr 2009 09:57:10 -0000	1.96
+++ modules/simpletest/drupal_web_test_case.php	23 Apr 2009 19:36:23 -0000
@@ -879,6 +879,9 @@ class DrupalWebTestCase {
     $directory = file_directory_path();
     // Create the files directory.
     file_check_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
+    // Try to log any fatal errors.
+    ini_set('log_errors', 1);
+    ini_set('error_log', $directory . '/php_error.log');
 
     set_time_limit($this->timeLimit);
   }
Index: modules/simpletest/simpletest.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/simpletest.module,v
retrieving revision 1.39
diff -u -p -r1.39 simpletest.module
--- modules/simpletest/simpletest.module	31 Mar 2009 01:49:53 -0000	1.39
+++ modules/simpletest/simpletest.module	23 Apr 2009 19:36:23 -0000
@@ -438,6 +438,13 @@ function _simpletest_batch_finished($suc
   }
   else {
     drupal_set_message(t('The tests did not successfully finish.'), 'error');
+    // Print the contents of all error logs in abandoned test directories.
+    foreach (file_scan_directory(file_directory_path(), '@php_error\.log$@', array('min_depth' => 1)) as $file) {
+      if (preg_match('@simpletest\d+/php_error\.log$@', $file->filepath)) {
+        drupal_set_message(nl2br(file_get_contents($file->filepath)), 'error');
+      }
+    }    
+    drupal_set_message(t('Please use the <em>Clean environment</em> button to clean-up temporary files and tables.'), 'warning');
   }
 }
 
