From 74d2937c1de63bb550bfb4bf32b97389050ecbb0 Mon Sep 17 00:00:00 2001
From: Nathaniel Catchpole <catch@35733.no-reply.drupal.org>
Date: Thu, 11 Aug 2016 11:49:54 +0100
Subject: [PATCH] Issue #2776071 by damiankloip, neclimdul, Mixologic:
 run-tests.sh does not return a non zero status when tests fail with exception

---
 core/scripts/run-tests.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/core/scripts/run-tests.sh b/core/scripts/run-tests.sh
index 15e6e809497e..a981c25aa626 100755
--- a/core/scripts/run-tests.sh
+++ b/core/scripts/run-tests.sh
@@ -647,6 +647,10 @@ function simpletest_script_execute_batch($test_classes) {
         elseif ($status['exitcode']) {
           $message = 'FATAL ' . $child['class'] . ': test runner returned a non-zero error code (' . $status['exitcode'] . ').';
           echo $message . "\n";
+          // @todo Return SIMPLETEST_SCRIPT_EXIT_EXCEPTION instead, when
+          // DrupalCI supports this.
+          // @see https://www.drupal.org/node/2780087
+          $total_status = max(SIMPLETEST_SCRIPT_EXIT_FAILURE, $total_status);
           // Insert a fail for xml results.
           TestBase::insertAssert($child['test_id'], $child['class'], FALSE, $message, 'run-tests.sh check');
           // Ensure that an error line is displayed for the class.
-- 
GitLab