diff --git a/core/scripts/run-tests.sh b/core/scripts/run-tests.sh index 25a6933..a6caec2 100755 --- a/core/scripts/run-tests.sh +++ b/core/scripts/run-tests.sh @@ -160,6 +160,11 @@ function simpletest_script_help() { --color Output text format results with color highlighting. + --summary-only + + Do not output detailed assertion messages for exceptions and + failed tests. + --verbose Output detailed assertion messages in addition to summary. --keep-results @@ -229,6 +234,7 @@ function simpletest_script_parse_args() { 'class' => FALSE, 'file' => FALSE, 'color' => FALSE, + 'summary-only' => FALSE, 'verbose' => FALSE, 'keep-results' => FALSE, 'test_names' => array(), @@ -1040,15 +1046,31 @@ function simpletest_script_reporter_timer_stop() { function simpletest_script_reporter_display_results() { global $args, $test_ids, $results_map; - if ($args['verbose']) { + if (!$args['summary-only'] || $args['verbose']) { // Report results. - echo "Detailed test results\n"; - echo "---------------------\n"; - $results = Database::getConnection('default', 'test-runner') - ->query("SELECT * FROM {simpletest} WHERE test_id IN (:test_ids) ORDER BY test_class, message_id", array( - ':test_ids' => $test_ids, - )); + if ($args['verbose']) { + $results = Database::getConnection('default', 'test-runner') + ->query("SELECT * FROM {simpletest} WHERE test_id IN (:test_ids) ORDER BY test_class, message_id", array( + ':test_ids' => $test_ids, + )); + echo "Detailed test results\n"; + echo "---------------------\n"; + } + else { + $results = Database::getConnection('default', 'test-runner') + ->query("SELECT count(*) FROM {simpletest} WHERE test_id IN (:test_ids) AND status IN ('fail', 'exception') ORDER BY test_class, message_id", array( + ':test_ids' => $test_ids, + )); + if ($results->fetchColumn() > 0) { + $results = Database::getConnection('default', 'test-runner') + ->query("SELECT * FROM {simpletest} WHERE test_id IN (:test_ids) AND status IN ('fail', 'exception') ORDER BY test_class, message_id", array( + ':test_ids' => $test_ids, + )); + echo "Detailed failures and exceptions\n"; + echo "--------------------------------\n"; + } + } $test_class = ''; foreach ($results as $result) { if (isset($results_map[$result->status])) {