Skip to content

Commit

Permalink
Added debugging information to os::cmd output content test
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Kuznetsov <[email protected]>
  • Loading branch information
stevekuznetsov committed Jul 14, 2016
1 parent 5d153b2 commit 69a4085
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions hack/lib/cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,16 @@ function os::cmd::internal::expect_exit_code_run_grep() {
fi
local test_succeeded=$( ${test_eval_func} "${test_result}"; echo $? )

local end_time=$(os::cmd::internal::seconds_since_epoch)
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
if (( ! test_succeeded )); then
os::text::print_blue "[DEBUG] Output content test failed. Debugging information follows:"
os::text::print_blue "[DEBUG] \${grep_args}=${grep_args}"
os::text::print_blue "[DEBUG] \${test_result}=${test_result}"
os::text::print_blue "[DEBUG] \${test_eval_func}=${test_eval_func}"
os::text::print_blue "[DEBUG] \${test_succeeded}=${test_succeeded}"
fi

local end_time=$(os::cmd::internal::seconds_since_epoch)
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

# clear the preamble so we can print out the success or error message
os::text::clear_string "${preamble}"
Expand Down

0 comments on commit 69a4085

Please sign in to comment.