185 |
188 |
186 if [ $MTIMEA1 != $MTIMEB1 ]; then |
189 if [ $MTIMEA1 != $MTIMEB1 ]; then |
187 echo "file1: mtime not synced" |
190 echo "file1: mtime not synced" |
188 exit 2 |
191 exit 2 |
189 fi |
192 fi |
|
193 |
|
194 |
|
195 # ---------------------------------------------------------------------------- |
|
196 # test 4: add xattr to files, push/pull |
|
197 # expected result: xattr synced |
|
198 |
|
199 # test if xattr are supported |
|
200 ../../build/xattrtool set tmp-sync/test4a/file1 attr1 testv 2> /dev/null |
|
201 ATTR_TEST=`../../build/xattrtool get tmp-sync/test4a/file1 attr1 2> /dev/null` |
|
202 if [ $ATTR_TEST != "testv" ]; then |
|
203 echo "xattr unsupported, skip" |
|
204 exit 2 |
|
205 fi |
|
206 |
|
207 sleep 2 |
|
208 |
|
209 # add xattr to file without content modification |
|
210 $XATTR set tmp-sync/test4a/file1 attr2 value2 |
|
211 $XATTR set tmp-sync/test4a/file1 attr3 hello |
|
212 $XATTR set tmp-sync/test4a/file1 attr4 hello |
|
213 touch tmp-sync/test4a/file1 |
|
214 |
|
215 # modify file and add xattr |
|
216 echo "test4-mod1" >> tmp-sync/test4a/dir1/file2 |
|
217 $XATTR set tmp-sync/test4a/dir1/file2 msg helloworld |
|
218 |
|
219 # create new file with extended attributes |
|
220 echo "newfile" > tmp-sync/test4a/file3 |
|
221 $XATTR set tmp-sync/test4a/file3 msg helloworld |
|
222 |
|
223 dav_sync_push test4a "test 4: push failed" |
|
224 check_tmpout "0 conflicts" "test 4: wrong conflict counter (push)" |
|
225 check_tmpout "0 errors" "test 4: wrong error counter (push)" |
|
226 check_tmpout "put: /file3" "test 4: file 3 not pushed" |
|
227 check_tmpout "put: /dir1/file2" "test 4: file 2 not pushed" |
|
228 check_tmpout "update: /file1" "test 4: file 1 not pushed" |
|
229 |
|
230 dav_sync_pull test4b "test 4: pull failed" |
|
231 check_tmpout "0 conflicts" "test 4: wrong conflict counter (pull)" |
|
232 check_tmpout "0 errors" "test 4: wrong error counter (pull)" |
|
233 check_tmpout "get: /file3" "test 4: file 3 not pulled" |
|
234 check_tmpout "get: /dir1/file2" "test 4: file 2 not pulled" |
|
235 check_tmpout "update: /file1" "test 4: file 1 not pulled" |
|
236 |
|
237 FILE1_ATTR2=`$XATTR get tmp-sync/test4b/file1 attr2 2> /dev/null` |
|
238 FILE1_ATTR3=`$XATTR get tmp-sync/test4b/file1 attr3 2> /dev/null` |
|
239 FILE1_ATTR4=`$XATTR get tmp-sync/test4b/file1 attr4 2> /dev/null` |
|
240 |
|
241 FILE2_ATTR0=`$XATTR get tmp-sync/test4b/dir1/file2 msg 2> /dev/null` |
|
242 |
|
243 FILE3_ATTR0=`$XATTR get tmp-sync/test4b/file3 msg 2> /dev/null` |
|
244 |
|
245 |
|
246 if [ "$FILE1_ATTR2" != "value2" ]; then |
|
247 echo "file1 attr2 has wrong value: $FILE1_ATTR2" |
|
248 exit 2 |
|
249 fi |
|
250 if [ "$FILE1_ATTR3" != "hello" ]; then |
|
251 echo "file1 attr3 has wrong value: $FILE1_ATTR3" |
|
252 exit 2 |
|
253 fi |
|
254 if [ "$FILE1_ATTR4" != "hello" ]; then |
|
255 echo "file1 attr4 has wrong value: $FILE1_ATTR4" |
|
256 exit 2 |
|
257 fi |
|
258 |
|
259 if [ "$FILE2_ATTR0" != "helloworld" ]; then |
|
260 echo "file2 attr has wrong value: $FILE2_ATTR0" |
|
261 exit 2 |
|
262 fi |
|
263 |
|
264 if [ "$FILE3_ATTR0" != "helloworld" ]; then |
|
265 echo "file3 attr has wrong value: $FILE3_ATTR0" |
|
266 exit 2 |
|
267 fi |
|
268 |
|
269 |
|
270 # ---------------------------------------------------------------------------- |
|
271 # test 5: do nothing, push/pull |
|
272 # expected result: no update, no files pushed/pulled |
|
273 |
|
274 sleep 2 |
|
275 |
|
276 dav_sync_push test4a "test 5: push failed" |
|
277 check_tmpout "0 files pushed" "test 5: wrong push counter" |
|
278 check_tmpout "0 conflicts" "test 5: wrong conflict counter (push)" |
|
279 check_tmpout "0 errors" "test 5: wrong error counter (push)" |
|
280 LN=`cat tmp-sync/out.txt | wc -l` |
|
281 if [ "$LN" != "1" ]; then |
|
282 echo "test 5: wrong output (push)" |
|
283 exit 2 |
|
284 fi |
|
285 |
|
286 dav_sync_pull test4b "test 5: pull failed" |
|
287 check_tmpout "0 files pulled" "test 5: wrong pull counter" |
|
288 check_tmpout "0 conflicts" "test 5: wrong conflict counter (pull)" |
|
289 check_tmpout "0 errors" "test 5: wrong error counter (pull)" |
|
290 LN=`cat tmp-sync/out.txt | wc -l` |
|
291 if [ "$LN" != "1" ]; then |
|
292 echo "test 5: wrong output (pull)" |
|
293 exit 2 |
|
294 fi |
|
295 |
|
296 |
|
297 # ---------------------------------------------------------------------------- |
|
298 # test 6: add additional xattr to files, push/pull |
|
299 # expected result: xattr synced |
|
300 |
|
301 sleep 2 |
|
302 |
|
303 $XATTR set tmp-sync/test4a/file1 test5 f1value5 |
|
304 |
|
305 echo "test6-mod1" >> tmp-sync/test4a/file3 |
|
306 $XATTR set tmp-sync/test4a/file3 test5 f3value5 |
|
307 |
|
308 dav_sync_push test4a "test 6: push failed" |
|
309 check_tmpout "0 conflicts" "test 6: wrong conflict counter (push)" |
|
310 check_tmpout "0 errors" "test 6: wrong error counter (push)" |
|
311 check_tmpout "put: /file3" "test 6: file 3 not pushed" |
|
312 check_tmpout "update: /file1" "test 6: file 1 not pushed" |
|
313 |
|
314 dav_sync_pull test4b "test 6: pull failed" |
|
315 check_tmpout "0 conflicts" "test 6: wrong conflict counter (pull)" |
|
316 check_tmpout "0 errors" "test 6: wrong error counter (pull)" |
|
317 check_tmpout "get: /file3" "test 6: file 3 not pulled" |
|
318 check_tmpout "update: /file1" "test 6: file 1 not pulled" |
|
319 |
|
320 TEST5=`$XATTR get tmp-sync/test4b/file1 test5 2> /dev/null` |
|
321 if [ "$TEST5" != "f1value5" ]; then |
|
322 echo "test 6: file1 attr has wrong value" |
|
323 exit 2 |
|
324 fi |
|
325 TEST5=`$XATTR get tmp-sync/test4b/file3 test5 2> /dev/null` |
|
326 if [ "$TEST5" != "f3value5" ]; then |
|
327 echo "test 6: file3 attr has wrong value" |
|
328 exit 2 |
|
329 fi |
|
330 |
|
331 |
|
332 # ---------------------------------------------------------------------------- |
|
333 # test 7: do nothing, push/pull |
|
334 # expected result: no update, no files pushed/pulled |
|
335 |
|
336 sleep 2 |
|
337 |
|
338 dav_sync_push test4a "test 7: push failed" |
|
339 check_tmpout "0 files pushed" "test 7: wrong push counter" |
|
340 check_tmpout "0 conflicts" "test 7: wrong conflict counter (push)" |
|
341 check_tmpout "0 errors" "test 7: wrong error counter (push)" |
|
342 LN=`cat tmp-sync/out.txt | wc -l` |
|
343 if [ "$LN" != "1" ]; then |
|
344 echo "test 7: wrong output (push)" |
|
345 exit 2 |
|
346 fi |
|
347 |
|
348 dav_sync_pull test4b "test 7: pull failed" |
|
349 check_tmpout "0 files pulled" "test 7: wrong pull counter" |
|
350 check_tmpout "0 conflicts" "test 7: wrong conflict counter (pull)" |
|
351 check_tmpout "0 errors" "test 7: wrong error counter (pull)" |
|
352 LN=`cat tmp-sync/out.txt | wc -l` |
|
353 if [ "$LN" != "1" ]; then |
|
354 echo "test 7: wrong output (pull)" |
|
355 exit 2 |
|
356 fi |
|
357 |
|
358 |
|
359 # ---------------------------------------------------------------------------- |
|
360 # test 8: remove xattr |
|
361 # expected result: xattr removed in test4b |
|
362 |
|
363 $XATTR remove tmp-sync/test4a/dir1/file2 msg |
|
364 if [ $? -ne 0 ]; then |
|
365 echo "test 8: xattrtool remove failed" |
|
366 exit 2 |
|
367 fi |
|
368 |
|
369 touch tmp-sync/test4a/dir1/file2 |
|
370 |
|
371 dav_sync_push test4a "test 8: push failed" |
|
372 check_tmpout "0 conflicts" "test 8: wrong conflict counter (push)" |
|
373 check_tmpout "0 errors" "test 8: wrong error counter (push)" |
|
374 check_tmpout "update: /dir1/file2" "test 8: file 1 not pushed" |
|
375 |
|
376 dav_sync_pull test4b "test 8: pull failed" |
|
377 check_tmpout "0 conflicts" "test 8: wrong conflict counter (pull)" |
|
378 check_tmpout "0 errors" "test 8: wrong error counter (pull)" |
|
379 check_tmpout "update: /dir1/file2" "test 8: file 1 not pulled" |
|
380 |
|
381 TEST6=`$XATTR get tmp-sync/test4b/dir1/file2 msg 2> /dev/null` |
|
382 if [ "$TEST6" != "" ]; then |
|
383 echo "test 8: xattr msg not removed" |
|
384 exit 2 |
|
385 fi |
|
386 |
|
387 |
|
388 # ---------------------------------------------------------------------------- |
|
389 # test 9: do nothing, push/pull |
|
390 # expected result: no update, no files pushed/pulled |
|
391 |
|
392 sleep 2 |
|
393 |
|
394 dav_sync_push test4a "test 9: push failed" |
|
395 check_tmpout "0 files pushed" "test 9: wrong push counter" |
|
396 check_tmpout "0 conflicts" "test 9: wrong conflict counter (push)" |
|
397 check_tmpout "0 errors" "test 9: wrong error counter (push)" |
|
398 LN=`cat tmp-sync/out.txt | wc -l` |
|
399 if [ "$LN" != "1" ]; then |
|
400 echo "test 7: wrong output (push)" |
|
401 exit 2 |
|
402 fi |
|
403 |
|
404 dav_sync_pull test4b "test 9: pull failed" |
|
405 check_tmpout "0 files pulled" "test 9: wrong pull counter" |
|
406 check_tmpout "0 conflicts" "test 9: wrong conflict counter (pull)" |
|
407 check_tmpout "0 errors" "test 9: wrong error counter (pull)" |
|
408 LN=`cat tmp-sync/out.txt | wc -l` |
|
409 if [ "$LN" != "1" ]; then |
|
410 echo "test 9: wrong output (pull)" |
|
411 exit 2 |
|
412 fi |
|
413 |
|
414 |
|
415 |