Handle a ctrl-c interrupt on test runner
authorJiyoung Yun <jy910.yun@samsung.com>
Fri, 27 May 2016 07:25:38 +0000 (16:25 +0900)
committerJiyoung Yun <jy910.yun@samsung.com>
Tue, 7 Jun 2016 02:53:03 +0000 (11:53 +0900)
If a ctrl-c interrupt occurs, the test runner will stop and
return the total number of failed.

Signed-off-by: Jiyoung Yun <jy910.yun@samsung.com>
Commit migrated from https://github.com/dotnet/corefx/commit/f3049c6062d09a40577ef17b2d6ba1c047e7207d

src/libraries/run-test.sh

index 4e0d3c0..1c518cb 100755 (executable)
@@ -55,6 +55,18 @@ usage()
     exit 1
 }
 
+# Handle Ctrl-C.
+function handle_ctrl_c {
+  local errorSource='handle_ctrl_c'
+
+  echo ""
+  echo "Cancelling test execution."
+  exit $TestsFailed
+}
+
+# Register the Ctrl-C handler
+trap handle_ctrl_c INT
+
 ProjectRoot="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
 # Location parameters
 # OS/ConfigurationGroup defaults