2 # Copyright 2010 by Denys Vlasenko
3 # Licensed under GPLv2, see file LICENSE in this source tree.
7 # Opening quote in "omitting directory 'dir'" message:
11 rm -rf cp.testdir
>/dev
/null
16 ln -s file cp.testdir
/dir
/file_symlink
19 ln -s file cp.testdir
/file_symlink
20 ln -s dir
cp.testdir
/dir_symlink
23 # testing "test name" "command" "expected result" "file input" "stdin"
25 rm -rf cp.testdir2
>/dev
/null
&& mkdir
cp.testdir2 ||
exit 1
27 cd cp.testdir || exit 1; cp * ../cp.testdir2 2>&1; echo $?; cd ../cp.testdir2 || exit 1
28 test ! -L file && test -f file || echo BAD: file
29 test ! -L file_symlink && test -f file_symlink || echo BAD: file_symlink
30 test ! -L dir && test ! -e dir || echo BAD: dir
31 test ! -L dir_symlink && test ! -e dir_symlink || echo BAD: dir_symlink
33 cp: omitting directory ${sq}dir'
34 cp: omitting directory ${sq}dir_symlink'
38 rm -rf cp.testdir2
>/dev
/null
&& mkdir
cp.testdir2 ||
exit 1
40 cd cp.testdir || exit 1; cp -d * ../cp.testdir2 2>&1; echo $?; cd ../cp.testdir2 || exit 1
41 test ! -L file && test -f file || echo BAD: file
42 test -L file_symlink && test -f file_symlink || echo BAD: file_symlink
43 test ! -L dir && test ! -e dir || echo BAD: dir
44 test -L dir_symlink && test ! -e dir_symlink || echo BAD: dir_symlink
46 cp: omitting directory ${sq}dir'
50 rm -rf cp.testdir2
>/dev
/null
&& mkdir
cp.testdir2 ||
exit 1
52 cd cp.testdir || exit 1; cp -P * ../cp.testdir2 2>&1; echo $?; cd ../cp.testdir2 || exit 1
53 test ! -L file && test -f file || echo BAD: file
54 test -L file_symlink && test -f file_symlink || echo BAD: file_symlink
55 test ! -L dir && test ! -e dir || echo BAD: dir
56 test -L dir_symlink && test ! -e dir_symlink || echo BAD: dir_symlink
58 cp: omitting directory ${sq}dir'
62 rm -rf cp.testdir2
>/dev
/null
&& mkdir
cp.testdir2 ||
exit 1
64 cd cp.testdir || exit 1; cp -L * ../cp.testdir2 2>&1; echo $?; cd ../cp.testdir2 || exit 1
65 test ! -L file && test -f file || echo BAD: file
66 test ! -L file_symlink && test -f file_symlink || echo BAD: file_symlink
67 test ! -L dir && test ! -e dir || echo BAD: dir
68 test ! -L dir_symlink && test ! -e dir_symlink || echo BAD: dir_symlink
70 cp: omitting directory ${sq}dir'
71 cp: omitting directory ${sq}dir_symlink'
75 rm -rf cp.testdir2
>/dev
/null
&& mkdir
cp.testdir2 ||
exit 1
77 cd cp.testdir || exit 1; cp -H * ../cp.testdir2 2>&1; echo $?; cd ../cp.testdir2 || exit 1
78 test ! -L file && test -f file || echo BAD: file
79 test ! -L file_symlink && test -f file_symlink || echo BAD: file_symlink
80 test ! -L dir && test ! -e dir || echo BAD: dir
81 test ! -L dir_symlink && test ! -e dir_symlink || echo BAD: dir_symlink
83 cp: omitting directory ${sq}dir'
84 cp: omitting directory ${sq}dir_symlink'
88 rm -rf cp.testdir2
>/dev
/null
&& mkdir
cp.testdir2 ||
exit 1
90 cd cp.testdir || exit 1; cp -R * ../cp.testdir2 2>&1; echo $?; cd ../cp.testdir2 || exit 1
91 test ! -L file && test -f file || echo BAD: file
92 test -L file_symlink && test -f file_symlink || echo BAD: file_symlink
93 test ! -L dir && test -d dir || echo BAD: dir
94 test -L dir_symlink && test -d dir_symlink || echo BAD: dir_symlink
95 test ! -L dir/file && test -f dir/file || echo BAD: dir/file
96 test -L dir/file_symlink && test -f dir/file_symlink || echo BAD: dir/file_symlink
101 rm -rf cp.testdir2
>/dev
/null
&& mkdir
cp.testdir2 ||
exit 1
103 cd cp.testdir || exit 1; cp -Rd * ../cp.testdir2 2>&1; echo $?; cd ../cp.testdir2 || exit 1
104 test ! -L file && test -f file || echo BAD: file
105 test -L file_symlink && test -f file_symlink || echo BAD: file_symlink
106 test ! -L dir && test -d dir || echo BAD: dir
107 test -L dir_symlink && test -d dir_symlink || echo BAD: dir_symlink
108 test ! -L dir/file && test -f dir/file || echo BAD: dir/file
109 test -L dir/file_symlink && test -f dir/file_symlink || echo BAD: dir/file_symlink
114 rm -rf cp.testdir2
>/dev
/null
&& mkdir
cp.testdir2 ||
exit 1
116 cd cp.testdir || exit 1; cp -RP * ../cp.testdir2 2>&1; echo $?; cd ../cp.testdir2 || exit 1
117 test ! -L file && test -f file || echo BAD: file
118 test -L file_symlink && test -f file_symlink || echo BAD: file_symlink
119 test ! -L dir && test -d dir || echo BAD: dir
120 test -L dir_symlink && test -d dir_symlink || echo BAD: dir_symlink
121 test ! -L dir/file && test -f dir/file || echo BAD: dir/file
122 test -L dir/file_symlink && test -f dir/file_symlink || echo BAD: dir/file_symlink
127 rm -rf cp.testdir2
>/dev
/null
&& mkdir
cp.testdir2 ||
exit 1
129 cd cp.testdir || exit 1; cp -RL * ../cp.testdir2 2>&1; echo $?; cd ../cp.testdir2 || exit 1
130 test ! -L file && test -f file || echo BAD: file
131 test ! -L file_symlink && test -f file_symlink || echo BAD: file_symlink
132 test ! -L dir && test -d dir || echo BAD: dir
133 test ! -L dir_symlink && test -d dir_symlink || echo BAD: dir_symlink
134 test ! -L dir/file && test -f dir/file || echo BAD: dir/file
135 test ! -L dir/file_symlink && test -f dir/file_symlink || echo BAD: dir/file_symlink
140 rm -rf cp.testdir2
>/dev
/null
&& mkdir
cp.testdir2 ||
exit 1
141 # GNU coreutils 7.2 says:
142 # cp: will not create hard link `../cp.testdir2/dir_symlink' to directory `../cp.testdir2/dir'
143 test x
"$SKIP_KNOWN_BUGS" = x
"" && \
145 cd cp.testdir || exit 1; cp -RH * ../cp.testdir2 2>&1; echo $?; cd ../cp.testdir2 || exit 1
146 test ! -L file && test -f file || echo BAD: file
147 test ! -L file_symlink && test -f file_symlink || echo BAD: file_symlink
148 test ! -L dir && test -d dir || echo BAD: dir
149 test ! -L dir_symlink && test -d dir_symlink || echo BAD: dir_symlink
150 test ! -L dir/file && test -f dir/file || echo BAD: dir/file
151 test -L dir/file_symlink && test -f dir/file_symlink || echo BAD: dir/file_symlink
156 rm -rf cp.testdir2
>/dev
/null
&& mkdir
cp.testdir2 ||
exit 1
157 # GNU coreutils 7.2 says:
158 # cp: will not create hard link `../cp.testdir2/dir_symlink' to directory `../cp.testdir2/dir'
159 test x
"$SKIP_KNOWN_BUGS" = x
"" && \
161 cd cp.testdir || exit 1; cp -RHP * ../cp.testdir2 2>&1; echo $?; cd ../cp.testdir2 || exit 1
162 test ! -L file && test -f file || echo BAD: file
163 test ! -L file_symlink && test -f file_symlink || echo BAD: file_symlink
164 test ! -L dir && test -d dir || echo BAD: dir
165 test ! -L dir_symlink && test -d dir_symlink || echo BAD: dir_symlink
166 test ! -L dir/file && test -f dir/file || echo BAD: dir/file
167 test -L dir/file_symlink && test -f dir/file_symlink || echo BAD: dir/file_symlink
172 rm -rf cp.testdir2
>/dev
/null
&& mkdir
cp.testdir2 ||
exit 1
174 cd cp.testdir || exit 1; cp -RHL * ../cp.testdir2 2>&1; echo $?; cd ../cp.testdir2 || exit 1
175 test ! -L file && test -f file || echo BAD: file
176 test ! -L file_symlink && test -f file_symlink || echo BAD: file_symlink
177 test ! -L dir && test -d dir || echo BAD: dir
178 test ! -L dir_symlink && test -d dir_symlink || echo BAD: dir_symlink
179 test ! -L dir/file && test -f dir/file || echo BAD: dir/file
180 test ! -L dir/file_symlink && test -f dir/file_symlink || echo BAD: dir/file_symlink
185 rm -rf cp.testdir2
>/dev
/null
&& mkdir
cp.testdir2 ||
exit 1
186 # Wow! "cp -RLH" is not the same as "cp -RHL" (prev test)!
187 # GNU coreutils 7.2 says:
188 # cp: will not create hard link `../cp.testdir2/dir_symlink' to directory `../cp.testdir2/dir'
189 test x
"$SKIP_KNOWN_BUGS" = x
"" && \
191 cd cp.testdir || exit 1; cp -RLH * ../cp.testdir2 2>&1; echo $?; cd ../cp.testdir2 || exit 1
192 test ! -L file && test -f file || echo BAD: file
193 test ! -L file_symlink && test -f file_symlink || echo BAD: file_symlink
194 test ! -L dir && test -d dir || echo BAD: dir
195 test ! -L dir_symlink && test -d dir_symlink || echo BAD: dir_symlink
196 test ! -L dir/file && test -f dir/file || echo BAD: dir/file
197 test ! -L dir/file_symlink && test -f dir/file_symlink || echo BAD: dir/file_symlink
204 rm -rf cp.testdir
cp.testdir2
2>/dev
/null