source: MondoRescue/branches/3.2/mindi-busybox/testsuite/cp.tests@ 3232

Last change on this file since 3232 was 2725, checked in by Bruno Cornec, 13 years ago
  • Update mindi-busybox to 1.18.3 to avoid problems with the tar command which is now failing on recent versions with busybox 1.7.3
  • Property svn:executable set to *
File size: 9.0 KB
Line 
1#!/bin/sh
2# Copyright 2010 by Denys Vlasenko
3# Licensed under GPLv2, see file LICENSE in this source tree.
4
5. ./testing.sh
6
7# Opening quote in "omitting directory 'dir'" message:
8sq='`' # GNU cp: `
9sq="'" # bbox cp: '
10
11rm -rf cp.testdir >/dev/null
12
13mkdir cp.testdir
14mkdir cp.testdir/dir
15> cp.testdir/dir/file
16ln -s file cp.testdir/dir/file_symlink
17
18> cp.testdir/file
19ln -s file cp.testdir/file_symlink
20ln -s dir cp.testdir/dir_symlink
21
22
23# testing "test name" "command" "expected result" "file input" "stdin"
24
25rm -rf cp.testdir2 >/dev/null && mkdir cp.testdir2 || exit 1
26testing "cp" '\
27cd cp.testdir || exit 1; cp * ../cp.testdir2 2>&1; echo $?; cd ../cp.testdir2 || exit 1
28test ! -L file && test -f file || echo BAD: file
29test ! -L file_symlink && test -f file_symlink || echo BAD: file_symlink
30test ! -L dir && test ! -e dir || echo BAD: dir
31test ! -L dir_symlink && test ! -e dir_symlink || echo BAD: dir_symlink
32' "\
33cp: omitting directory ${sq}dir'
34cp: omitting directory ${sq}dir_symlink'
351
36" "" ""
37
38rm -rf cp.testdir2 >/dev/null && mkdir cp.testdir2 || exit 1
39testing "cp -d" '\
40cd cp.testdir || exit 1; cp -d * ../cp.testdir2 2>&1; echo $?; cd ../cp.testdir2 || exit 1
41test ! -L file && test -f file || echo BAD: file
42test -L file_symlink && test -f file_symlink || echo BAD: file_symlink
43test ! -L dir && test ! -e dir || echo BAD: dir
44test -L dir_symlink && test ! -e dir_symlink || echo BAD: dir_symlink
45' "\
46cp: omitting directory ${sq}dir'
471
48" "" ""
49
50rm -rf cp.testdir2 >/dev/null && mkdir cp.testdir2 || exit 1
51testing "cp -P" '\
52cd cp.testdir || exit 1; cp -P * ../cp.testdir2 2>&1; echo $?; cd ../cp.testdir2 || exit 1
53test ! -L file && test -f file || echo BAD: file
54test -L file_symlink && test -f file_symlink || echo BAD: file_symlink
55test ! -L dir && test ! -e dir || echo BAD: dir
56test -L dir_symlink && test ! -e dir_symlink || echo BAD: dir_symlink
57' "\
58cp: omitting directory ${sq}dir'
591
60" "" ""
61
62rm -rf cp.testdir2 >/dev/null && mkdir cp.testdir2 || exit 1
63testing "cp -L" '\
64cd cp.testdir || exit 1; cp -L * ../cp.testdir2 2>&1; echo $?; cd ../cp.testdir2 || exit 1
65test ! -L file && test -f file || echo BAD: file
66test ! -L file_symlink && test -f file_symlink || echo BAD: file_symlink
67test ! -L dir && test ! -e dir || echo BAD: dir
68test ! -L dir_symlink && test ! -e dir_symlink || echo BAD: dir_symlink
69' "\
70cp: omitting directory ${sq}dir'
71cp: omitting directory ${sq}dir_symlink'
721
73" "" ""
74
75rm -rf cp.testdir2 >/dev/null && mkdir cp.testdir2 || exit 1
76testing "cp -H" '\
77cd cp.testdir || exit 1; cp -H * ../cp.testdir2 2>&1; echo $?; cd ../cp.testdir2 || exit 1
78test ! -L file && test -f file || echo BAD: file
79test ! -L file_symlink && test -f file_symlink || echo BAD: file_symlink
80test ! -L dir && test ! -e dir || echo BAD: dir
81test ! -L dir_symlink && test ! -e dir_symlink || echo BAD: dir_symlink
82' "\
83cp: omitting directory ${sq}dir'
84cp: omitting directory ${sq}dir_symlink'
851
86" "" ""
87
88rm -rf cp.testdir2 >/dev/null && mkdir cp.testdir2 || exit 1
89testing "cp -R" '\
90cd cp.testdir || exit 1; cp -R * ../cp.testdir2 2>&1; echo $?; cd ../cp.testdir2 || exit 1
91test ! -L file && test -f file || echo BAD: file
92test -L file_symlink && test -f file_symlink || echo BAD: file_symlink
93test ! -L dir && test -d dir || echo BAD: dir
94test -L dir_symlink && test -d dir_symlink || echo BAD: dir_symlink
95test ! -L dir/file && test -f dir/file || echo BAD: dir/file
96test -L dir/file_symlink && test -f dir/file_symlink || echo BAD: dir/file_symlink
97' "\
980
99" "" ""
100
101rm -rf cp.testdir2 >/dev/null && mkdir cp.testdir2 || exit 1
102testing "cp -Rd" '\
103cd cp.testdir || exit 1; cp -Rd * ../cp.testdir2 2>&1; echo $?; cd ../cp.testdir2 || exit 1
104test ! -L file && test -f file || echo BAD: file
105test -L file_symlink && test -f file_symlink || echo BAD: file_symlink
106test ! -L dir && test -d dir || echo BAD: dir
107test -L dir_symlink && test -d dir_symlink || echo BAD: dir_symlink
108test ! -L dir/file && test -f dir/file || echo BAD: dir/file
109test -L dir/file_symlink && test -f dir/file_symlink || echo BAD: dir/file_symlink
110' "\
1110
112" "" ""
113
114rm -rf cp.testdir2 >/dev/null && mkdir cp.testdir2 || exit 1
115testing "cp -RP" '\
116cd cp.testdir || exit 1; cp -RP * ../cp.testdir2 2>&1; echo $?; cd ../cp.testdir2 || exit 1
117test ! -L file && test -f file || echo BAD: file
118test -L file_symlink && test -f file_symlink || echo BAD: file_symlink
119test ! -L dir && test -d dir || echo BAD: dir
120test -L dir_symlink && test -d dir_symlink || echo BAD: dir_symlink
121test ! -L dir/file && test -f dir/file || echo BAD: dir/file
122test -L dir/file_symlink && test -f dir/file_symlink || echo BAD: dir/file_symlink
123' "\
1240
125" "" ""
126
127rm -rf cp.testdir2 >/dev/null && mkdir cp.testdir2 || exit 1
128testing "cp -RL" '\
129cd cp.testdir || exit 1; cp -RL * ../cp.testdir2 2>&1; echo $?; cd ../cp.testdir2 || exit 1
130test ! -L file && test -f file || echo BAD: file
131test ! -L file_symlink && test -f file_symlink || echo BAD: file_symlink
132test ! -L dir && test -d dir || echo BAD: dir
133test ! -L dir_symlink && test -d dir_symlink || echo BAD: dir_symlink
134test ! -L dir/file && test -f dir/file || echo BAD: dir/file
135test ! -L dir/file_symlink && test -f dir/file_symlink || echo BAD: dir/file_symlink
136' "\
1370
138" "" ""
139
140rm -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'
143test x"$SKIP_KNOWN_BUGS" = x"" && \
144testing "cp -RH" '\
145cd cp.testdir || exit 1; cp -RH * ../cp.testdir2 2>&1; echo $?; cd ../cp.testdir2 || exit 1
146test ! -L file && test -f file || echo BAD: file
147test ! -L file_symlink && test -f file_symlink || echo BAD: file_symlink
148test ! -L dir && test -d dir || echo BAD: dir
149test ! -L dir_symlink && test -d dir_symlink || echo BAD: dir_symlink
150test ! -L dir/file && test -f dir/file || echo BAD: dir/file
151test -L dir/file_symlink && test -f dir/file_symlink || echo BAD: dir/file_symlink
152' "\
1530
154" "" ""
155
156rm -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'
159test x"$SKIP_KNOWN_BUGS" = x"" && \
160testing "cp -RHP" '\
161cd cp.testdir || exit 1; cp -RHP * ../cp.testdir2 2>&1; echo $?; cd ../cp.testdir2 || exit 1
162test ! -L file && test -f file || echo BAD: file
163test ! -L file_symlink && test -f file_symlink || echo BAD: file_symlink
164test ! -L dir && test -d dir || echo BAD: dir
165test ! -L dir_symlink && test -d dir_symlink || echo BAD: dir_symlink
166test ! -L dir/file && test -f dir/file || echo BAD: dir/file
167test -L dir/file_symlink && test -f dir/file_symlink || echo BAD: dir/file_symlink
168' "\
1690
170" "" ""
171
172rm -rf cp.testdir2 >/dev/null && mkdir cp.testdir2 || exit 1
173testing "cp -RHL" '\
174cd cp.testdir || exit 1; cp -RHL * ../cp.testdir2 2>&1; echo $?; cd ../cp.testdir2 || exit 1
175test ! -L file && test -f file || echo BAD: file
176test ! -L file_symlink && test -f file_symlink || echo BAD: file_symlink
177test ! -L dir && test -d dir || echo BAD: dir
178test ! -L dir_symlink && test -d dir_symlink || echo BAD: dir_symlink
179test ! -L dir/file && test -f dir/file || echo BAD: dir/file
180test ! -L dir/file_symlink && test -f dir/file_symlink || echo BAD: dir/file_symlink
181' "\
1820
183" "" ""
184
185rm -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'
189test x"$SKIP_KNOWN_BUGS" = x"" && \
190testing "cp -RLH" '\
191cd cp.testdir || exit 1; cp -RLH * ../cp.testdir2 2>&1; echo $?; cd ../cp.testdir2 || exit 1
192test ! -L file && test -f file || echo BAD: file
193test ! -L file_symlink && test -f file_symlink || echo BAD: file_symlink
194test ! -L dir && test -d dir || echo BAD: dir
195test ! -L dir_symlink && test -d dir_symlink || echo BAD: dir_symlink
196test ! -L dir/file && test -f dir/file || echo BAD: dir/file
197test ! -L dir/file_symlink && test -f dir/file_symlink || echo BAD: dir/file_symlink
198' "\
1990
200" "" ""
201
202
203# Clean up
204rm -rf cp.testdir cp.testdir2 2>/dev/null
205
206exit $FAILCOUNT
Note: See TracBrowser for help on using the repository browser.