@@ -108,7 +108,16 @@ def requeued_tests
108108 build . requeued_tests
109109 end
110110
111+ APPLICATION_ERROR_EXIT_CODE = 42
112+ TIMED_OUT_EXIT_CODE = 43
113+ TOO_MANY_FAILED_TESTS_EXIT_CODE = 44
114+ WORKERS_DIED_EXIT_CODE = 45
115+ SUCCESS_EXIT_CODE = 0
116+ TEST_FAILURE_EXIT_CODE = 1
117+
111118 def report
119+ exit_code = TEST_FAILURE_EXIT_CODE
120+
112121 if requeued_tests . to_a . any?
113122 step ( "Requeued #{ requeued_tests . size } tests" )
114123 requeued_tests . to_a . sort . each do |test_id , count |
@@ -131,10 +140,14 @@ def report
131140 if remaining_tests . size > 10
132141 puts " ..."
133142 end
143+
144+ exit_code = TIMED_OUT_EXIT_CODE
134145 elsif supervisor . time_left_with_no_workers . to_i <= 0
135146 puts red ( "All workers died." )
147+ exit_code = WORKERS_DIED_EXIT_CODE
136148 elsif supervisor . max_test_failed?
137149 puts red ( "Encountered too many failed tests. Test run was ended early." )
150+ exit_code = TOO_MANY_FAILED_TESTS_EXIT_CODE
138151 end
139152
140153 puts
@@ -146,9 +159,10 @@ def report
146159 puts red ( "Worker #{ worker_id } crashed" )
147160 puts error
148161 puts ""
162+ exit_code = APPLICATION_ERROR_EXIT_CODE
149163 end
150164
151- success?
165+ success? ? SUCCESS_EXIT_CODE : exit_code
152166 end
153167
154168 def success?
0 commit comments