Index: usr.bin/tail/tests/tail_test.sh =================================================================== --- usr.bin/tail/tests/tail_test.sh +++ usr.bin/tail/tests/tail_test.sh @@ -333,7 +333,7 @@ atf_test_case follow_rename follow_rename_head() { - atf_set "descr" "Verify that -F works" + atf_set "descr" "Verify that -F works through rename" } follow_rename_body() { @@ -346,8 +346,42 @@ seq 4 5 > infile_new atf_check mv infile infile_old atf_check mv infile_new infile - # tail -F polls for a new file every 1s. - sleep 2 + # tail -F polls for a new file every 1s, wait for it to finish + for i in `jot 20`; do + if [ $(stat -f%z outfile) -ge 10 ]; then + break + fi + sleep 0.1 + done + atf_check cmp expectfile outfile + atf_check kill $pid +} + +atf_test_case follow_rotate +follow_rotate_head() +{ + atf_set "descr" "Verify that -F works through rotation" +} +follow_rotate_body() +{ + local pid + + cat > tail_newsyslog.conf < expectfile + seq 1 3 > infile + tail -F infile > outfile & + pid=$! + atf_check newsyslog -r -F -d . -f tail_newsyslog.conf + seq 4 5 > infile + # tail -F polls for a new file every 1s, wait for it to finish + for i in `jot 20`; do + if [ $(stat -f%z outfile) -ge 10 ]; then + break + fi + sleep 0.1 + done atf_check cmp expectfile outfile atf_check kill $pid } @@ -372,4 +406,5 @@ atf_add_test_case follow atf_add_test_case follow_stdin atf_add_test_case follow_rename + atf_add_test_case follow_rotate }