Fix test for kill(1)
Closed this issue · 0 comments
shivansh commented
atf_test_case invalid_usage
invalid_usage_head()
{
atf_set "descr" "Verify that an invalid usage with a supported option " \
"produces a valid error message"
}
invalid_usage_body()
{
atf_check -s not-exit:0 -e inline:"kill: option requires an argument -- s
usage: kill [-s signal_name] pid ...
kill -l [exit_status]
kill -signal_name pid ...
kill -signal_number pid ...
" kill -s
atf_check -s not-exit:0 -e inline:"HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM URG
STOP TSTP CONT CHLD TTIN TTOU IO XCPU XFSZ VTALRM PROF WINCH INFO USR1 USR2
" kill -l
atf_check -s not-exit:0 -e inline:"kill: unknown signal Ar; valid signals:
HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM URG
STOP TSTP CONT CHLD TTIN TTOU IO XCPU XFSZ VTALRM PROF WINCH INFO USR1 USR2
" kill -Ar
atf_check -s not-exit:0 -e inline:"kill: unknown signal Ar; valid signals:
HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM URG
STOP TSTP CONT CHLD TTIN TTOU IO XCPU XFSZ VTALRM PROF WINCH INFO USR1 USR2
" kill -Ar
}
atf_test_case no_arguments
no_arguments_head()
{
atf_set "descr" "Verify that kill(1) fails and generates a valid usage " \
"message when no arguments are supplied"
}
no_arguments_body()
{
atf_check -s not-exit:0 -e match:"$usage_output" kill
}
atf_init_test_cases()
{
atf_add_test_case invalid_usage
atf_add_test_case no_arguments
}