88 mkdir tmp-sync |
88 mkdir tmp-sync |
89 mkdir tmp-sync/test4a |
89 mkdir tmp-sync/test4a |
90 mkdir tmp-sync/test4b |
90 mkdir tmp-sync/test4b |
91 |
91 |
92 # ---------------------------------------------------------------------------- |
92 # ---------------------------------------------------------------------------- |
93 # 1. test: sync executable file and check if it can be executed |
93 # test 1: sync executable file and check if it can be executed |
94 # expected result: exec works |
94 # expected result: exec works |
95 |
95 |
96 echo "#!/bin/sh" > tmp-sync/test4a/script.sh |
96 echo "#!/bin/sh" > tmp-sync/test4a/script.sh |
97 echo "echo itworks" >> tmp-sync/test4a/script.sh |
97 echo "echo itworks" >> tmp-sync/test4a/script.sh |
98 |
98 |
125 echo "script.sh has wrong output" |
125 echo "script.sh has wrong output" |
126 exit 2 |
126 exit 2 |
127 fi |
127 fi |
128 fi |
128 fi |
129 |
129 |
|
130 # ---------------------------------------------------------------------------- |
|
131 # test 2: set mtime to specific date and sync the file |
|
132 # expected result: mtime the same on both sides |
|
133 |
|
134 mkdir tmp-sync/test4a/dir1 |
|
135 |
|
136 cp synctest/file1 tmp-sync/test4a/ |
|
137 cp synctest/file2 tmp-sync/test4a/dir1/ |
|
138 |
|
139 touch -t 01011200 tmp-sync/test4a/file1 |
|
140 touch -t 02021200 tmp-sync/test4a/dir1/file2 |
|
141 |
|
142 dav_sync_push test4a "test 2: push failed" |
|
143 check_tmpout "2 files pushed" "test 2: wrong push counter" |
|
144 check_tmpout "0 conflicts" "test 2: wrong conflict counter (push)" |
|
145 check_tmpout "0 errors" "test 2: wrong error counter (push)" |
|
146 |
|
147 dav_sync_pull test4b "test 2: pull failed" |
|
148 check_tmpout "2 files pulled" "test 2: wrong pull counter" |
|
149 check_tmpout "0 conflicts" "test 2: wrong conflict counter (pull)" |
|
150 check_tmpout "0 errors" "test 2: wrong error counter (pull)" |
|
151 |
|
152 MTIMEA1=`stat -c %Y tmp-sync/test4a/file1` |
|
153 MTIMEB1=`stat -c %Y tmp-sync/test4b/file1` |
|
154 |
|
155 MTIMEA2=`stat -c %Y tmp-sync/test4a/dir1/file2` |
|
156 MTIMEB2=`stat -c %Y tmp-sync/test4b/dir1/file2` |
|
157 |
|
158 if [ $MTIMEA1 != $MTIMEB1 ]; then |
|
159 echo "file1: mtime not synced" |
|
160 exit 2 |
|
161 fi |
|
162 if [ $MTIMEA2 != $MTIMEB2 ]; then |
|
163 echo "file2: mtime not synced" |
|
164 exit 2 |
|
165 fi |
|
166 |
|
167 # ---------------------------------------------------------------------------- |
|
168 # test 3: modify file1 and push/pull |
|
169 # expected result: file content synced, mtime also synced |
|
170 |
|
171 echo "test3-mod1" >> tmp-sync/test4a/file1 |
|
172 |
|
173 dav_sync_push test4a "test 3: push failed" |
|
174 check_tmpout "1 file pushed" "test 3: wrong push counter" |
|
175 check_tmpout "0 conflicts" "test 3: wrong conflict counter (push)" |
|
176 check_tmpout "0 errors" "test 3: wrong error counter (push)" |
|
177 |
|
178 dav_sync_pull test4b "test 3: pull failed" |
|
179 check_tmpout "1 file pulled" "test 3: wrong pull counter" |
|
180 check_tmpout "0 conflicts" "test 3: wrong conflict counter (pull)" |
|
181 check_tmpout "0 errors" "test 3: wrong error counter (pull)" |
|
182 |
|
183 MTIMEA1=`stat -c %Y tmp-sync/test4a/file1` |
|
184 MTIMEB1=`stat -c %Y tmp-sync/test4b/file1` |
|
185 |
|
186 if [ $MTIMEA1 != $MTIMEB1 ]; then |
|
187 echo "file1: mtime not synced" |
|
188 exit 2 |
|
189 fi |