Changeset View
Changeset View
Standalone View
Standalone View
bin/ls/tests/ls_tests.sh
| Show First 20 Lines • Show All 470 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| b_flag_body() | b_flag_body() | ||||
| { | { | ||||
| atf_check -e empty -o empty -s exit:0 touch "$(printf "y\013z")" | atf_check -e empty -o empty -s exit:0 touch "$(printf "y\013z")" | ||||
| atf_check -e empty -o match:'y\\vz' -s exit:0 ls -b | atf_check -e empty -o match:'y\\vz' -s exit:0 ls -b | ||||
| } | } | ||||
| atf_test_case childerr cleanup | |||||
| childerr_head() | |||||
| { | |||||
| atf_set "descr" "Verify that fts_children() in pre-order errors are checked" | |||||
| atf_set "require.user" "unprivileged" | |||||
| } | |||||
| childerr_body() | |||||
| { | |||||
| mkdir -p root/dir root/edir | |||||
| touch root/c | |||||
| # Check that listing an empty directory hasn't regressed into being | |||||
| # called an error. | |||||
| atf_check -o match:"total 0" -e empty ls -l root/dir | |||||
| atf_check chmod 0 root/dir | |||||
| # If we did not abort after fts_children() properly, then stdout would | |||||
| # have an output of the total files enumerated (0). Thus, assert that | |||||
| # it's empty and that we see the correct error on stderr. | |||||
| atf_check -o empty -e match:"Permission denied" -s not-exit:0 \ | |||||
| ls -l root/dir | |||||
| # Now ensure that we didn't just stop there, we printed out a directory | |||||
| # that would've been enumerated later. | |||||
| atf_check -o save:ls.out -e save:ls.err -s not-exit:0 ls -lR root | |||||
des: why not simply use `-o match` and `-e match` here? | |||||
kevansAuthorUnsubmitted Done Inline ActionsIncorporated along with other discussed improvements kevans: Incorporated along with other discussed improvements | |||||
| atf_check grep -q 'root/edir:' ls.out | |||||
| atf_check grep -Eq 'ls.+Permission denied' ls.err | |||||
| } | |||||
| atf_test_case d_flag | atf_test_case d_flag | ||||
| d_flag_head() | d_flag_head() | ||||
| { | { | ||||
| atf_set "descr" "Verify that -d doesn't descend down directories" | atf_set "descr" "Verify that -d doesn't descend down directories" | ||||
| } | } | ||||
| d_flag_body() | d_flag_body() | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 479 Lines • ▼ Show 20 Lines | atf_init_test_cases() | ||||
| atf_add_test_case R_flag | atf_add_test_case R_flag | ||||
| atf_add_test_case S_flag | atf_add_test_case S_flag | ||||
| atf_add_test_case T_flag | atf_add_test_case T_flag | ||||
| #atf_add_test_case U_flag | #atf_add_test_case U_flag | ||||
| #atf_add_test_case W_flag | #atf_add_test_case W_flag | ||||
| #atf_add_test_case Z_flag | #atf_add_test_case Z_flag | ||||
| atf_add_test_case a_flag | atf_add_test_case a_flag | ||||
| atf_add_test_case b_flag | atf_add_test_case b_flag | ||||
| atf_add_test_case childerr | |||||
| #atf_add_test_case c_flag | #atf_add_test_case c_flag | ||||
| atf_add_test_case d_flag | atf_add_test_case d_flag | ||||
| atf_add_test_case f_flag | atf_add_test_case f_flag | ||||
| atf_add_test_case g_flag | atf_add_test_case g_flag | ||||
| atf_add_test_case h_flag | atf_add_test_case h_flag | ||||
| atf_add_test_case i_flag | atf_add_test_case i_flag | ||||
| atf_add_test_case k_flag | atf_add_test_case k_flag | ||||
| atf_add_test_case l_flag | atf_add_test_case l_flag | ||||
| Show All 16 Lines | |||||
why not simply use -o match and -e match here?