Lines Matching +full:- +full:rf
3 [ -f testing.sh ] && . testing.sh
15 testing "-missing source [fail]" "cp missing two 2>/dev/null || echo yes" \
17 testing "file->file" "cp random two && cmp random two && echo yes" \
22 testing "file->dir" "cp random two && cmp random two/random && echo yes" \
25 testing "file->dir/file" \
28 testing "-r dir->missing" \
29 "cp -r two three && cmp random three/random && echo yes" \
32 testing "-r dir->file [fail]" \
33 "cp -r two walrus 2>/dev/null || echo yes" "yes\n" "" ""
35 testing "-r dir hits file." \
36 "cp -r three two 2>/dev/null || echo yes" "yes\n" "" ""
37 rm -rf two three walrus
41 skipnot [ $(id -u) -ne 0 ] # Root doesn't count.
42 testing "file->inaccessible [fail]" \
44 rm -f two
48 skipnot [ $(id -u) -ne 0 ] # Root doesn't count.
49 testing "-f file->inaccessible" \
50 "cp -f random two && cmp random two && echo yes" "yes\n" "" ""
53 skipnot [ $(id -u) -ne 0 ] # Root doesn't count.
54 testing "file->inaccessible_dir [fail]" \
59 # This test fails because our -rf deletes existing target files without
65 #testing "-rf dir file [fail]" "cp -rf dir file 2>/dev/null || echo yes" \
67 #rm -rf dir file
75 testing "-rf dir file missing [fail]" \
83 rm -rf dir
85 mkdir -p one/two/three/four
87 testing "-r /abspath dest" \
88 "cp -r \"$(readlink -f one)\" dir && diff -r one dir && echo yes" \
90 testing "-r dir again" "cp -r one/. dir && diff -r one dir && echo yes" \
93 testing "-r dir1/* dir2" \
94 "cp -r one/* dir2 && diff -r one dir2 && echo yes" "yes\n" "" ""
95 rm -rf one dir dir2
98 cp -pr one/ one_ # Succeeds twice in a row
99 testing "-pr dir/." "cp -pr one/. one_ && echo yes" "yes\n" "" ""
100 rm -rf one one_
101 mkdir one; touch one/two; ln -s two one/three
102 cp -pr one/ one_ # First time ok, second mustn't fail with "File exists"
103 testing "-pr dir/. symlink child" "cp -pr one/. one_ && echo yes" "yes\n" "" ""
104 rm -rf one one_
108 ln -s walrus woot
109 testing "symlink dest permissions" "cp woot carpenter && stat -c %A carpenter" \
110 "-rw-r--r--\n" "" ""
111 testing "duplicated --preserve options" \
112 "cp --preserve=mode,mode walrus walrus2 2>&1 || echo bad" "" "" ""
113 rm -rf walrus woot carpenter
118 testing "-T file" "cp -T b file && cat file" "b\n" "" ""
119 testing "-T dir" "cp -T b dir 2>/dev/null || echo expected" "expected\n" "" ""
122 mkdir -p b/c/d/ a/
124 testing "--parents b/c/d/file a/" "cp --parents b/c/d/file a/ && cat a/b/c/d/file" "a\n" "" ""
125 rm -rf a/ b/
128 testing "-P file" "cp -P file fdst && stat -c %F fdst" "regular file\n" "" ""
129 ln -s file lnk
130 testing "-P symlink" "cp -P lnk ldst && stat -c %F ldst" "symbolic link\n" "" ""
131 testing "follow symlink" "cp lnk ldst2 && stat -c %F ldst2" "regular file\n" "" ""
135 testing "-t one arg" 'cp -t sub/ input && cat sub/input' 'yes\n' 'yes\n' ''
136 toyonly testing "-Dt" 'cp -Dt sub2 input && cat sub2/input' 'and\n' 'and\n' ''
137 rm -rf sub sub2
139 testing '-u1' 'echo one>one; sleep .1; echo two>two; cp -u one two; cat two' \
141 testing '-u2' 'echo two>two; sleep .1; echo one>one; cp -u one two; cat two' \
148 testing '-i' 'cp -ri a/. b/. 2>/dev/null; cmp -s a/one b/one || cmp -s a/one b/two && echo yes' \
150 rm -rf one two a b
152 # cp -r ../source destdir
153 # cp -r one/two/three missing
154 # cp -r one/two/three two
156 # cp file1 missing file2 -> dir
159 # copy with -d at top level, with -d in directory, without -d at top level,
160 # without -d in directory