Changeset View
Changeset View
Standalone View
Standalone View
sbin/ping/tests/ping_test.sh
- This file was added.
atf_test_case ping_c3_s56 | |||||
ping_c3_s56_head() { | |||||
atf_set "descr" "Stop after receiving 3 ECHO_RESPONSE packets" | |||||
} | |||||
ping_c3_s56_body() { | |||||
if ! getaddrinfo -f inet localhost 1>/dev/null 2>&1; then | |||||
atf_skip "IPv4 is not configured" | |||||
fi | |||||
atf_check -s exit:0 -o save:std.out -e empty \ | |||||
ping -c 3 -s 56 localhost | |||||
check_ping_statistics std.out $(atf_get_srcdir)/ping_c3_s56.out | |||||
} | |||||
atf_init_test_cases() { | |||||
atf_add_test_case ping_c3_s56 | |||||
} | |||||
check_ping_statistics() { | |||||
sed -e 's/0.[0-9]\{3\}//g' \ | |||||
-e 's/[1-9][0-9]*.[0-9]\{3\}//g' \ | |||||
-e 's/localhost ([0-9]\{1,3\}\(\.[0-9]\{1,3\}\)\{1,3\})/localhost/' \ | |||||
-e 's/from [0-9]\{1,3\}\(\.[0-9]\{1,3\}\)\{1,3\}/from/' \ | |||||
-e 's/ttl=[0-9][0-9]*/ttl=/' \ | |||||
"$1" >"$1".filtered | |||||
atf_check -s exit:0 diff -u "$1".filtered "$2" | |||||
asomers: What does this output look like on a failure? Would it be more readable if you added `-u`? | |||||
Done Inline ActionsThe output looks like:
atf-sh doesn't recognize -u option but I think the question was about specifying a reason. I'm afraid that this won't make the output more readable because there are too much information included in it to be described by a single message. jansucan: The output looks like:
> ping_test:ping_c3 -> failed: atf-check failed; see the output of the… | |||||
Done Inline ActionsI meant atf_check instead of atf-sh. jansucan: I meant `atf_check` instead of `atf-sh`. | |||||
Not Done Inline ActionsI meant adding -u as an option to diff. asomers: I meant adding `-u` as an option to `diff`. | |||||
} |
What does this output look like on a failure? Would it be more readable if you added -u?