diff options
Diffstat (limited to 'tests/cp_tests.mk')
| -rw-r--r-- | tests/cp_tests.mk | 270 |
1 files changed, 270 insertions, 0 deletions
diff --git a/tests/cp_tests.mk b/tests/cp_tests.mk new file mode 100644 index 000000000..e14262ac1 --- /dev/null +++ b/tests/cp_tests.mk | |||
| @@ -0,0 +1,270 @@ | |||
| 1 | # This is a -*- makefile -*- | ||
| 2 | |||
| 3 | # GNU `cp' | ||
| 4 | GCP = /bin/cp | ||
| 5 | # BusyBox `cp' | ||
| 6 | BCP = $(shell pwd)/cp | ||
| 7 | |||
| 8 | .PHONY: cp_clean | ||
| 9 | cp_clean: | ||
| 10 | rm -rf cp_tests cp_*.{gnu,bb} cp | ||
| 11 | |||
| 12 | .PHONY: cp_tests | ||
| 13 | cp_tests: cp_clean cp | ||
| 14 | @echo; | ||
| 15 | @echo "No output from diff means busybox cp is functioning properly."; | ||
| 16 | |||
| 17 | @echo; | ||
| 18 | ${BCP} || true; | ||
| 19 | |||
| 20 | @echo; | ||
| 21 | mkdir cp_tests; | ||
| 22 | |||
| 23 | @echo; | ||
| 24 | cd cp_tests; \ | ||
| 25 | echo A file > afile; \ | ||
| 26 | ls -l afile > ../cp_afile_afilecopy.gnu; \ | ||
| 27 | ${GCP} afile afilecopy; \ | ||
| 28 | ls -l afile afilecopy >> ../cp_afile_afilecopy.gnu; | ||
| 29 | |||
| 30 | @echo; | ||
| 31 | rm -f cp_tests/afile*; | ||
| 32 | |||
| 33 | @echo; | ||
| 34 | cd cp_tests; \ | ||
| 35 | echo A file > afile; \ | ||
| 36 | ls -l afile > ../cp_afile_afilecopy.bb; \ | ||
| 37 | ${BCP} afile afilecopy; \ | ||
| 38 | ls -l afile afilecopy >> ../cp_afile_afilecopy.bb; | ||
| 39 | |||
| 40 | @echo; | ||
| 41 | diff -u cp_afile_afilecopy.gnu cp_afile_afilecopy.bb; | ||
| 42 | |||
| 43 | @echo; | ||
| 44 | rm -f cp_tests/afile*; | ||
| 45 | |||
| 46 | @echo; echo; | ||
| 47 | cd cp_tests; \ | ||
| 48 | mkdir there there1; \ | ||
| 49 | cd there; \ | ||
| 50 | ln -s ../afile .; | ||
| 51 | |||
| 52 | @echo; | ||
| 53 | cd cp_tests; \ | ||
| 54 | echo A file > afile; \ | ||
| 55 | ls -l afile > ../cp_symlink.gnu; \ | ||
| 56 | ${GCP} there/afile there1/; \ | ||
| 57 | ls -l afile there/afile there1/afile >> ../cp_symlink.gnu; | ||
| 58 | |||
| 59 | @echo; | ||
| 60 | rm -f cp_tests/afile cp_tests/there1/afile; | ||
| 61 | |||
| 62 | @echo; | ||
| 63 | cd cp_tests; \ | ||
| 64 | echo A file > afile; \ | ||
| 65 | ls -l afile > ../cp_symlink.bb; \ | ||
| 66 | ${BCP} there/afile there1/; \ | ||
| 67 | ls -l afile there/afile there1/afile >> ../cp_symlink.bb; | ||
| 68 | |||
| 69 | @echo; | ||
| 70 | diff -u cp_symlink.gnu cp_symlink.bb; | ||
| 71 | |||
| 72 | @echo; | ||
| 73 | rm -f cp_tests/afile cp_tests/there1/afile; | ||
| 74 | |||
| 75 | @echo; echo; | ||
| 76 | cd cp_tests; \ | ||
| 77 | echo A file > afile; \ | ||
| 78 | ls -l afile > ../cp_a_symlink.gnu; \ | ||
| 79 | ${GCP} -a there/afile there1/; \ | ||
| 80 | ls -l afile there/afile there1/afile >> ../cp_a_symlink.gnu; | ||
| 81 | |||
| 82 | @echo; | ||
| 83 | rm -f cp_tests/afile cp_tests/there1/afile; | ||
| 84 | |||
| 85 | @echo; | ||
| 86 | cd cp_tests; \ | ||
| 87 | echo A file > afile; \ | ||
| 88 | ls -l afile > ../cp_a_symlink.bb; \ | ||
| 89 | ${BCP} -a there/afile there1/; \ | ||
| 90 | ls -l afile there/afile there1/afile >> ../cp_a_symlink.bb; | ||
| 91 | |||
| 92 | @echo; | ||
| 93 | diff -u cp_a_symlink.gnu cp_a_symlink.bb; | ||
| 94 | |||
| 95 | @echo; | ||
| 96 | rm -f cp_tests/afile | ||
| 97 | rm -rf cp_tests/there{,1}; | ||
| 98 | |||
| 99 | @echo; echo; | ||
| 100 | cd cp_tests; \ | ||
| 101 | echo A file > there/afile; \ | ||
| 102 | mkdir there/adir; \ | ||
| 103 | touch there/adir/afileinadir; \ | ||
| 104 | ln -s $(shell pwd) there/alink; | ||
| 105 | |||
| 106 | @echo; | ||
| 107 | cd cp_tests; \ | ||
| 108 | ${GCP} -a there/ there1/; \ | ||
| 109 | ls -lR there/ there1/ > ../cp_a_dir_dir.gnu; | ||
| 110 | |||
| 111 | @echo; | ||
| 112 | rm -rf cp_tests/there1; | ||
| 113 | |||
| 114 | @echo; | ||
| 115 | cd cp_tests; \ | ||
| 116 | ${BCP} -a there/ there1/; \ | ||
| 117 | ls -lR there/ there1/ > ../cp_a_dir_dir.bb; | ||
| 118 | |||
| 119 | @echo; | ||
| 120 | diff -u cp_a_dir_dir.gnu cp_a_dir_dir.bb; | ||
| 121 | |||
| 122 | @echo; | ||
| 123 | rm -rf cp_tests/there1/; | ||
| 124 | |||
| 125 | @echo; echo; | ||
| 126 | cd cp_tests; \ | ||
| 127 | echo A file number one > afile1; \ | ||
| 128 | echo A file number two, blah. > afile2; \ | ||
| 129 | ln -s afile1 symlink1; \ | ||
| 130 | mkdir there1; \ | ||
| 131 | ${GCP} afile1 afile2 symlink1 there1/; \ | ||
| 132 | ls -lR > ../cp_files_dir.gnu; | ||
| 133 | |||
| 134 | @echo; | ||
| 135 | rm -rf cp_tests/{afile{1,2},symlink1,there1}; | ||
| 136 | |||
| 137 | @echo; | ||
| 138 | cd cp_tests; \ | ||
| 139 | echo A file number one > afile1; \ | ||
| 140 | echo A file number two, blah. > afile2; \ | ||
| 141 | ln -s afile1 symlink1; \ | ||
| 142 | mkdir there1; \ | ||
| 143 | ${BCP} afile1 afile2 symlink1 there1/; \ | ||
| 144 | ls -lR > ../cp_files_dir.bb; | ||
| 145 | |||
| 146 | @echo; | ||
| 147 | diff -u cp_files_dir.gnu cp_files_dir.bb; | ||
| 148 | |||
| 149 | @echo; | ||
| 150 | rm -rf cp_tests/{afile{1,2},symlink1,there1}; | ||
| 151 | |||
| 152 | @echo; echo; | ||
| 153 | cd cp_tests; \ | ||
| 154 | echo A file number one > afile1; \ | ||
| 155 | echo A file number two, blah. > afile2; \ | ||
| 156 | ln -s afile1 symlink1; \ | ||
| 157 | mkdir there1; \ | ||
| 158 | ${GCP} -d afile1 afile2 symlink1 there1/; \ | ||
| 159 | ls -lR > ../cp_d_files_dir.gnu; | ||
| 160 | |||
| 161 | @echo; | ||
| 162 | rm -rf cp_tests/{afile{1,2},symlink1,there1}; | ||
| 163 | |||
| 164 | @echo; | ||
| 165 | cd cp_tests; \ | ||
| 166 | echo A file number one > afile1; \ | ||
| 167 | echo A file number two, blah. > afile2; \ | ||
| 168 | ln -s afile1 symlink1; \ | ||
| 169 | mkdir there1; \ | ||
| 170 | ${BCP} -d afile1 afile2 symlink1 there1/; \ | ||
| 171 | ls -lR > ../cp_d_files_dir.bb; | ||
| 172 | |||
| 173 | @echo; | ||
| 174 | diff -u cp_d_files_dir.gnu cp_d_files_dir.bb; | ||
| 175 | |||
| 176 | @echo; | ||
| 177 | rm -rf cp_tests/{afile{1,2},symlink1,there1}; | ||
| 178 | |||
| 179 | @echo; echo; | ||
| 180 | cd cp_tests; \ | ||
| 181 | echo A file number one > afile1; \ | ||
| 182 | echo A file number two, blah. > afile2; \ | ||
| 183 | touch --date='Sat Jan 29 21:24:08 PST 2000' afile1; \ | ||
| 184 | ln -s afile1 symlink1; \ | ||
| 185 | mkdir there1; \ | ||
| 186 | ${GCP} -p afile1 afile2 symlink1 there1/; \ | ||
| 187 | ls -lR > ../cp_p_files_dir.gnu; | ||
| 188 | |||
| 189 | @echo; | ||
| 190 | rm -rf cp_tests/{afile{1,2},symlink1,there1}; | ||
| 191 | |||
| 192 | @echo; | ||
| 193 | cd cp_tests; \ | ||
| 194 | echo A file number one > afile1; \ | ||
| 195 | echo A file number two, blah. > afile2; \ | ||
| 196 | touch --date='Sat Jan 29 21:24:08 PST 2000' afile1; \ | ||
| 197 | ln -s afile1 symlink1; \ | ||
| 198 | mkdir there1; \ | ||
| 199 | ${BCP} -p afile1 afile2 symlink1 there1/; \ | ||
| 200 | ls -lR > ../cp_p_files_dir.bb; | ||
| 201 | |||
| 202 | @echo; | ||
| 203 | diff -u cp_p_files_dir.gnu cp_p_files_dir.bb; | ||
| 204 | |||
| 205 | @echo; | ||
| 206 | rm -rf cp_tests/{afile{1,2},symlink1,there1}; | ||
| 207 | |||
| 208 | @echo; echo; | ||
| 209 | cd cp_tests; \ | ||
| 210 | echo A file number one > afile1; \ | ||
| 211 | echo A file number two, blah. > afile2; \ | ||
| 212 | touch --date='Sat Jan 29 21:24:08 PST 2000' afile1; \ | ||
| 213 | ln -s afile1 symlink1; \ | ||
| 214 | mkdir there1; \ | ||
| 215 | ${GCP} -p -d afile1 afile2 symlink1 there1/; \ | ||
| 216 | ls -lR > ../cp_pd_files_dir.gnu; | ||
| 217 | |||
| 218 | @echo; | ||
| 219 | rm -rf cp_tests/{afile{1,2},symlink1,there1}; | ||
| 220 | |||
| 221 | @echo; | ||
| 222 | cd cp_tests; \ | ||
| 223 | echo A file number one > afile1; \ | ||
| 224 | echo A file number two, blah. > afile2; \ | ||
| 225 | touch --date='Sat Jan 29 21:24:08 PST 2000' afile1; \ | ||
| 226 | ln -s afile1 symlink1; \ | ||
| 227 | mkdir there1; \ | ||
| 228 | ${BCP} -p -d afile1 afile2 symlink1 there1/; \ | ||
| 229 | ls -lR > ../cp_pd_files_dir.bb; | ||
| 230 | |||
| 231 | @echo; | ||
| 232 | diff -u cp_pd_files_dir.gnu cp_pd_files_dir.bb; | ||
| 233 | |||
| 234 | @echo; | ||
| 235 | rm -rf cp_tests/{afile{1,2},symlink1,there1}; | ||
| 236 | |||
| 237 | @echo; echo; | ||
| 238 | cd cp_tests; \ | ||
| 239 | mkdir dir{a,b}; \ | ||
| 240 | echo A file > dira/afile; \ | ||
| 241 | echo A file in dirb > dirb/afileindirb; \ | ||
| 242 | ln -s dira/afile dira/alinktoafile; \ | ||
| 243 | mkdir dira/subdir1; \ | ||
| 244 | echo Another file > dira/subdir1/anotherfile; \ | ||
| 245 | ls -lR . > ../cp_a_dira_dirb.gnu; \ | ||
| 246 | ${GCP} -a dira dirb; \ | ||
| 247 | ls -lR . >> ../cp_a_dira_dirb.gnu; | ||
| 248 | |||
| 249 | # false; | ||
| 250 | @echo; | ||
| 251 | rm -rf cp_tests/dir{a,b}; | ||
| 252 | |||
| 253 | @echo; | ||
| 254 | cd cp_tests; \ | ||
| 255 | mkdir dir{a,b}; \ | ||
| 256 | echo A file > dira/afile; \ | ||
| 257 | echo A file in dirb > dirb/afileindirb; \ | ||
| 258 | ln -s dira/afile dira/alinktoafile; \ | ||
| 259 | mkdir dira/subdir1; \ | ||
| 260 | echo Another file > dira/subdir1/anotherfile; \ | ||
| 261 | ls -lR . > ../cp_a_dira_dirb.bb; \ | ||
| 262 | ${BCP} -a dira dirb; \ | ||
| 263 | ls -lR . >> ../cp_a_dira_dirb.bb; | ||
| 264 | |||
| 265 | @echo; | ||
| 266 | diff -u cp_a_dira_dirb.gnu cp_a_dira_dirb.bb; | ||
| 267 | |||
| 268 | # false; | ||
| 269 | @echo; | ||
| 270 | rm -rf cp_tests/dir{a,b}; | ||
