Browse code

Added debugging information to os::cmd output content test

Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>

Steve Kuznetsov authored on 2016/07/08 04:37:43
Showing 1 changed files
... ...
@@ -198,8 +198,16 @@ function os::cmd::internal::expect_exit_code_run_grep() {
198 198
 	fi
199 199
 	local test_succeeded=$( ${test_eval_func} "${test_result}"; echo $? )
200 200
 
201
-	local end_time=$(os::cmd::internal::seconds_since_epoch)
202
-	local time_elapsed=$(echo "scale=3; ${end_time} - ${start_time}" | bc | xargs printf '%5.3f') # in decimal seconds, we need leading zeroes for parsing later
201
+    if (( ! test_succeeded )); then
202
+        os::text::print_blue "[DEBUG] Output content test failed. Debugging information follows:"
203
+        os::text::print_blue "[DEBUG] \${grep_args}=${grep_args}"
204
+        os::text::print_blue "[DEBUG] \${test_result}=${test_result}"
205
+        os::text::print_blue "[DEBUG] \${test_eval_func}=${test_eval_func}"
206
+        os::text::print_blue "[DEBUG] \${test_succeeded}=${test_succeeded}"
207
+    fi
208
+
209
+    local end_time=$(os::cmd::internal::seconds_since_epoch)
210
+    local time_elapsed=$(echo "scale=3; ${end_time} - ${start_time}" | bc | xargs printf '%5.3f') # in decimal seconds, we need leading zeroes for parsing later
203 211
 
204 212
     # clear the preamble so we can print out the success or error message
205 213
 	os::text::clear_string "${preamble}"