Changeset View
Changeset View
Standalone View
Standalone View
bin/cp/tests/cp_test.sh
| Show First 20 Lines • Show All 803 Lines • ▼ Show 20 Lines | unrdir_body() | ||||
| for d in a b c ; do | for d in a b c ; do | ||||
| mkdir -p src/$d | mkdir -p src/$d | ||||
| echo "$d" >src/$d/f | echo "$d" >src/$d/f | ||||
| done | done | ||||
| chmod 0 src/b | chmod 0 src/b | ||||
| atf_check \ | atf_check \ | ||||
| -s exit:1 \ | -s exit:1 \ | ||||
| -e match:"^cp: src/b: Permission denied" \ | -e match:"^cp: src/b: Permission denied" \ | ||||
| cp -R src dst | cp -R --sort src dst | ||||
| atf_check test -d dst/a | atf_check test -d dst/a | ||||
| atf_check cmp src/a/f dst/a/f | atf_check cmp src/a/f dst/a/f | ||||
| atf_check test -d dst/b | atf_check test -d dst/b | ||||
| atf_check test ! -e dst/b/f | atf_check test ! -e dst/b/f | ||||
| atf_check test -d dst/c | atf_check test -d dst/c | ||||
| atf_check cmp src/c/f dst/c/f | atf_check cmp src/c/f dst/c/f | ||||
| } | } | ||||
| atf_test_case unrfile | atf_test_case unrfile | ||||
| unrfile_head() | unrfile_head() | ||||
| { | { | ||||
| atf_set "descr" "Test handling of unreadable files" | atf_set "descr" "Test handling of unreadable files" | ||||
| atf_set "require.user" "unprivileged" | atf_set "require.user" "unprivileged" | ||||
| } | } | ||||
| unrfile_body() | unrfile_body() | ||||
| { | { | ||||
| mkdir src | mkdir src | ||||
| for d in a b c ; do | for d in a b c ; do | ||||
| echo "$d" >src/$d | echo "$d" >src/$d | ||||
| done | done | ||||
| chmod 0 src/b | chmod 0 src/b | ||||
| atf_check \ | atf_check \ | ||||
| -s exit:1 \ | -s exit:1 \ | ||||
| -e match:"^cp: src/b: Permission denied" \ | -e match:"^cp: src/b: Permission denied" \ | ||||
| cp -R src dst | cp -R --sort src dst | ||||
| atf_check test -d dst | atf_check test -d dst | ||||
| atf_check cmp src/a dst/a | atf_check cmp src/a dst/a | ||||
| atf_check test ! -e dst/b | atf_check test ! -e dst/b | ||||
| atf_check cmp src/c dst/c | atf_check cmp src/c dst/c | ||||
| } | } | ||||
| atf_test_case nopermute | atf_test_case nopermute | ||||
| nopermute_head() | nopermute_head() | ||||
| ▲ Show 20 Lines • Show All 56 Lines • Show Last 20 Lines | |||||