Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 1 | # mv_tests.mk - Set of tests cases for busybox mv |
| 2 | # ------------- |
| 3 | # Copyright (C) 2000 Karl M. Hegbloom <karlheg@debian.org> GPL |
| 4 | # |
Erik Andersen | fac10d7 | 2000-02-07 05:29:42 +0000 | [diff] [blame] | 5 | |
| 6 | # GNU `mv' |
| 7 | GMV = /bin/mv |
| 8 | # BusyBox `mv' |
| 9 | BMV = $(shell pwd)/mv |
| 10 | |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 11 | all:: mv_tests |
| 12 | clean:: mv_clean |
| 13 | |
Erik Andersen | fac10d7 | 2000-02-07 05:29:42 +0000 | [diff] [blame] | 14 | mv_clean: |
| 15 | rm -rf mv_tests mv_*.{gnu,bb} mv |
| 16 | |
Erik Andersen | fac10d7 | 2000-02-07 05:29:42 +0000 | [diff] [blame] | 17 | mv_tests: mv_clean mv |
| 18 | @echo; |
| 19 | @echo "No output from diff means busybox mv is functioning properly."; |
| 20 | @echo; |
| 21 | @echo "No such file or directory is good; it means the old file got removed."; |
| 22 | @echo; |
| 23 | ${BMV} || true; |
| 24 | |
| 25 | @echo; |
| 26 | mkdir mv_tests; |
| 27 | |
| 28 | @echo; |
| 29 | cd mv_tests; \ |
| 30 | echo A file > afile; \ |
| 31 | ls -l afile > ../mv_afile_newname.gnu; \ |
| 32 | ${GMV} afile newname; \ |
| 33 | ls -l newname >> ../mv_afile_newname.gnu; |
| 34 | -ls -l mv_tests/afile; |
| 35 | |
| 36 | @echo; |
| 37 | rm -f mv_tests/{afile,newname}; |
| 38 | |
| 39 | @echo; |
| 40 | cd mv_tests; \ |
| 41 | echo A file > afile; \ |
| 42 | ls -l afile > ../mv_afile_newname.bb; \ |
| 43 | ${BMV} afile newname; \ |
| 44 | ls -l newname >> ../mv_afile_newname.bb; |
| 45 | -ls -l mv_tests/afile; |
| 46 | |
| 47 | @echo; |
| 48 | diff -u mv_afile_newname.gnu mv_afile_newname.bb; |
| 49 | |
| 50 | @echo; |
| 51 | rm -f mv_tests/{afile,newname}; |
| 52 | |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 53 | @echo; echo ------------------------------; |
Erik Andersen | fac10d7 | 2000-02-07 05:29:42 +0000 | [diff] [blame] | 54 | cd mv_tests; \ |
| 55 | echo A file > afile; \ |
| 56 | ln -s afile symlink; \ |
| 57 | ls -l afile symlink > ../mv_symlink_newname.gnu; \ |
| 58 | ${GMV} symlink newname; \ |
| 59 | ls -l afile newname >> ../mv_symlink_newname.gnu; |
| 60 | -ls -l mv_tests/symlink; |
| 61 | |
| 62 | @echo; |
| 63 | rm -f mv_tests/{afile,newname}; |
| 64 | |
| 65 | @echo; |
| 66 | cd mv_tests; \ |
| 67 | echo A file > afile; \ |
| 68 | ln -s afile symlink; \ |
| 69 | ls -l afile symlink > ../mv_symlink_newname.bb;\ |
| 70 | ${BMV} symlink newname; \ |
| 71 | ls -l afile newname >> ../mv_symlink_newname.bb; |
| 72 | -ls -l mv_tests/symlink; |
| 73 | |
| 74 | @echo; |
| 75 | diff -u mv_symlink_newname.gnu mv_symlink_newname.bb; |
| 76 | |
| 77 | @echo; |
| 78 | rm -rf mv_tests/*; |
| 79 | |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 80 | @echo; echo ------------------------------; |
Erik Andersen | fac10d7 | 2000-02-07 05:29:42 +0000 | [diff] [blame] | 81 | cd mv_tests; \ |
| 82 | echo A file > afile; \ |
| 83 | ln -s afile symlink; \ |
| 84 | mkdir newdir; \ |
| 85 | ls -lR > ../mv_file_symlink_dir.gnu; \ |
| 86 | ${GMV} symlink afile newdir; \ |
| 87 | ls -lR >> ../mv_file_symlink_dir.gnu; |
| 88 | -ls -l mv_tests/{symlink,afile}; |
| 89 | |
| 90 | @echo; |
| 91 | rm -rf mv_tests/* |
| 92 | |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 93 | @echo; echo ------------------------------; |
Erik Andersen | fac10d7 | 2000-02-07 05:29:42 +0000 | [diff] [blame] | 94 | cd mv_tests; \ |
| 95 | echo A file > afile; \ |
| 96 | ln -s afile symlink; \ |
| 97 | mkdir newdir; \ |
| 98 | ls -lR > ../mv_file_symlink_dir.bb; \ |
| 99 | ${BMV} symlink afile newdir; \ |
| 100 | ls -lR >> ../mv_file_symlink_dir.bb; |
| 101 | -ls -l mv_tests/{symlink,afile}; |
| 102 | |
| 103 | @echo; |
| 104 | diff -u mv_file_symlink_dir.gnu mv_file_symlink_dir.bb; |
| 105 | |
| 106 | @echo; |
| 107 | rm -rf mv_tests/*; |
| 108 | |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 109 | @echo; echo ------------------------------; |
Erik Andersen | fac10d7 | 2000-02-07 05:29:42 +0000 | [diff] [blame] | 110 | cd mv_tests; \ |
| 111 | mkdir dir{a,b}; \ |
| 112 | echo A file > dira/afile; \ |
| 113 | echo A file in dirb > dirb/afileindirb; \ |
| 114 | ln -s dira/afile dira/alinktoafile; \ |
| 115 | mkdir dira/subdir1; \ |
| 116 | echo Another file > dira/subdir1/anotherfile; \ |
| 117 | ls -lR . > ../mv_dira_dirb.gnu; \ |
| 118 | ${GMV} dira dirb; \ |
| 119 | ls -lR . >> ../mv_dira_dirb.gnu; |
| 120 | |
| 121 | # false; |
| 122 | @echo; |
| 123 | rm -rf mv_tests/dir{a,b}; |
| 124 | |
| 125 | @echo; |
| 126 | cd mv_tests; \ |
| 127 | mkdir dir{a,b}; \ |
| 128 | echo A file > dira/afile; \ |
| 129 | echo A file in dirb > dirb/afileindirb; \ |
| 130 | ln -s dira/afile dira/alinktoafile; \ |
| 131 | mkdir dira/subdir1; \ |
| 132 | echo Another file > dira/subdir1/anotherfile; \ |
| 133 | ls -lR . > ../mv_dira_dirb.bb; \ |
| 134 | ${BMV} dira dirb; \ |
| 135 | ls -lR . >> ../mv_dira_dirb.bb; |
| 136 | |
| 137 | @echo; |
| 138 | diff -u mv_dira_dirb.gnu mv_dira_dirb.bb; |
| 139 | |
| 140 | # false; |
| 141 | @echo; |
| 142 | rm -rf mv_tests/dir{a,b}; |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 143 | |
| 144 | @echo; echo ------------------------------; |
| 145 | @echo There should be an error message about cannot mv a dir to a subdir of itself. |
| 146 | cd mv_tests; \ |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 147 | mkdir adir; \ |
Eric Andersen | 59ec601 | 2000-12-11 17:33:08 +0000 | [diff] [blame] | 148 | touch -r . a b c adir; \ |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 149 | ls -lR . > ../mv_a_star_adir.gnu; \ |
| 150 | ${GMV} * adir; \ |
| 151 | ls -lR . >> ../mv_a_star_adir.gnu; |
| 152 | |
| 153 | @echo |
| 154 | @echo There should be an error message about cannot mv a dir to a subdir of itself. |
| 155 | cd mv_tests; \ |
Eric Andersen | 59ec601 | 2000-12-11 17:33:08 +0000 | [diff] [blame] | 156 | rm -rf a b c adir; \ |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 157 | mkdir adir; \ |
Eric Andersen | 59ec601 | 2000-12-11 17:33:08 +0000 | [diff] [blame] | 158 | touch -r . a b c adir; \ |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 159 | ls -lR . > ../mv_a_star_adir.bb; \ |
| 160 | ${BMV} * adir; \ |
| 161 | ls -lR . >> ../mv_a_star_adir.bb; |
| 162 | |
| 163 | @echo; |
| 164 | diff -u mv_a_star_adir.gnu mv_a_star_adir.bb; |
| 165 | |
| 166 | @echo; |
| 167 | rm -rf mv_test/*; |