Changeset View
Changeset View
Standalone View
Standalone View
usr.bin/env/tests/env_test.sh
| Show First 20 Lines • Show All 124 Lines • ▼ Show 20 Lines | chdir_body() | ||||
| atf_check -s exit:125 \ | atf_check -s exit:125 \ | ||||
| -e match:"cannot change directory to '${subdir}':" \ | -e match:"cannot change directory to '${subdir}':" \ | ||||
| env -C "${subdir}" pwd | env -C "${subdir}" pwd | ||||
| atf_check mkdir "${subdir}" | atf_check mkdir "${subdir}" | ||||
| atf_check -o inline:"${PWD}/${subdir}\n" \ | atf_check -o inline:"${PWD}/${subdir}\n" \ | ||||
| env -C "${subdir}" pwd | env -C "${subdir}" pwd | ||||
| } | } | ||||
| atf_test_case stdout | |||||
| stdout_head() | |||||
markj: The rest of the file puts opening braces on their own lines. | |||||
Done Inline ActionsYeah sorry this was copy-pasted from asa. des: Yeah sorry this was copy-pasted from `asa`. | |||||
| { | |||||
| atf_set descr "Failure to write to stdout" | |||||
| } | |||||
| stdout_body() | |||||
| { | |||||
| ( | |||||
Done Inline ActionsDoes it make sense to sleep for a bit first, to make sure that the other end of the pipe has time to close? Maybe I'm missing something, but this looks like it might fail only sometimes. markj: Does it make sense to sleep for a bit first, to make sure that the other end of the pipe has… | |||||
Done Inline ActionsIt works 100% of the time, we use the exact same procedure several other places (including asa which is where I copied this from). Timing doesn't matter because none of the output is consumed and the kernel doesn't buffer it. des: It works 100% of the time, we use the exact same procedure several other places (including… | |||||
| trap "" PIPE | |||||
| env 2>stderr | |||||
| echo $? >result | |||||
| ) | true | |||||
| atf_check -o inline:"1\n" cat result | |||||
| atf_check -o match:"stdout" cat stderr | |||||
| } | |||||
| atf_init_test_cases() | atf_init_test_cases() | ||||
| { | { | ||||
| atf_add_test_case basic | atf_add_test_case basic | ||||
| atf_add_test_case unset | atf_add_test_case unset | ||||
| atf_add_test_case empty | atf_add_test_case empty | ||||
| atf_add_test_case true | atf_add_test_case true | ||||
| atf_add_test_case false | atf_add_test_case false | ||||
| atf_add_test_case altpath | atf_add_test_case altpath | ||||
| atf_add_test_case equal | atf_add_test_case equal | ||||
| atf_add_test_case chdir | atf_add_test_case chdir | ||||
| atf_add_test_case stdout | |||||
| } | } | ||||
The rest of the file puts opening braces on their own lines.