test/bin-test/test-dav-sync-metadata3.sh

changeset 677
5a4002f8d258
parent 675
a8117c4feaad
child 770
fcb243cb9950
equal deleted inserted replaced
676:fb466ba2edc5 677:5a4002f8d258
161 # test 2: copy file (without xattr and tags) and sync 161 # test 2: copy file (without xattr and tags) and sync
162 # expected result: WebDAV COPY, but metadata adjusted 162 # expected result: WebDAV COPY, but metadata adjusted
163 163
164 cp tmp-sync/test4a/file1 tmp-sync/test4a/copy1 164 cp tmp-sync/test4a/file1 tmp-sync/test4a/copy1
165 165
166 ../../xattrtool remove tmp-sync/test4a/copy1 tags > /dev/null 2>&1 166 $XATTR remove tmp-sync/test4a/copy1 tags > /dev/null 2>&1
167 ../../xattrtool remove tmp-sync/test4a/copy1 attr1 > /dev/null 2>&1 167 $XATTR remove tmp-sync/test4a/copy1 attr1 > /dev/null 2>&1
168 168
169 chmod -x tmp-sync/test4a/copy1 169 chmod -x tmp-sync/test4a/copy1
170 170
171 touch tmp-sync/test4a/copy1 171 touch tmp-sync/test4a/copy1
172 172
237 if [ $LN -ne 1 ]; then 237 if [ $LN -ne 1 ]; then
238 echo "test 4: wrong line count" 238 echo "test 4: wrong line count"
239 exit 2 239 exit 2
240 fi 240 fi
241 241
242
243 # ----------------------------------------------------------------------------
244 # test 5: move file1
245 # expected result: file moved, metadata unchanged
246
247 mv tmp-sync/test4a/file1 tmp-sync/test4a/move1
248
249 dav_sync_push test4a "test 5: push failed"
250 check_tmpout "1 file pushed" "test 5: wrong push counter"
251 check_tmpout "0 conflicts" "test 5: wrong conflict counter (push)"
252 check_tmpout "0 errors" "test 5: wrong error counter (push)"
253 check_tmpout "move" "test 5: no move (push)"
254
255 dav_sync_pull test4b "test 5: pull failed"
256 check_tmpout "1 file pulled" "test 5: wrong pull counter"
257 check_tmpout "0 conflicts" "test 5: wrong conflict counter (pull)"
258 check_tmpout "0 errors" "test 5: wrong error counter (pull)"
259 check_tmpout "move" "test 5: no move (pull)"
260
261 # check metadata
262 MTIMEA1=`stat -c %Y tmp-sync/test4a/move1 2> /dev/null`
263 MTIMEB1=`stat -c %Y tmp-sync/test4b/move1 2> /dev/null`
264
265 if [ $MTIMEA1 -ne $MTIMEB1 ]; then
266 echo "test 5: mtime not synced"
267 exit 2
268 fi
269
270 TAGS=`$DAV_SYNC_BIN list-tags -s test4b tmp-sync/test4b/move1 > tmp-sync/out.txt 2> /dev/null`
271 if [ $? -ne 0 ]; then
272 echo "test 2: list-tags failed"
273 exit 2
274 fi
275 check_tmpout "mytag" "test 5: tag mytag missing"
276 check_tmpout "test1" "test 5: tag test1 missing"
277
278 OUT=`../../build/xattrtool get tmp-sync/test4b/move1 attr1 2> /dev/null`
279 if [ "$OUT" != "testvalue" ]; then
280 echo "test 5: xattr not synced"
281 exit 2
282 fi
283
284
285 # ----------------------------------------------------------------------------
286 # test 6: remove metadata, move file move1 and sync
287 # expected result: file moved, no tags/xattr
288
289 $DAV_SYNC_BIN remove-tag -s test4a tmp-sync/test4a/move1 test1
290 $DAV_SYNC_BIN remove-tag -s test4a tmp-sync/test4a/move1 mytag
291
292 $XATTR remove tmp-sync/test4a/move1 attr1
293
294 mv tmp-sync/test4a/move1 tmp-sync/test4a/move_noxattr
295
296 dav_sync_push test4a "test 6: push failed"
297 check_tmpout "1 file pushed" "test 6: wrong push counter"
298 check_tmpout "0 conflicts" "test 6: wrong conflict counter (push)"
299 check_tmpout "0 errors" "test 6: wrong error counter (push)"
300 check_tmpout "move" "test 6: no move (push)"
301
302 dav_sync_pull test4b "test 6: pull failed"
303 check_tmpout "1 file pulled" "test 6: wrong pull counter"
304 check_tmpout "0 conflicts" "test 6: wrong conflict counter (pull)"
305 check_tmpout "0 errors" "test 6: wrong error counter (pull)"
306 check_tmpout "move" "test 6: no move (pull)"
307
308 # check metadata
309 MTIMEA1=`stat -c %Y tmp-sync/test4a/move_noxattr 2> /dev/null`
310 MTIMEB1=`stat -c %Y tmp-sync/test4b/move_noxattr 2> /dev/null`
311
312 if [ $MTIMEA1 -ne $MTIMEB1 ]; then
313 echo "test 6: mtime not synced"
314 exit 2
315 fi
316
317 OUT=`../../build/xattrtool get tmp-sync/test4b/move1 attr1 2> /dev/null`
318 if [ "$OUT" = "testvalue" ]; then
319 echo "test 6: xattr not synced"
320 exit 2
321 fi
322
323 TAGS=`$DAV_SYNC_BIN list-tags -s test4b tmp-sync/test4b/move_noxattr | wc -l`
324 if [ $TAGS -ne 0 ]; then
325 echo "test 6: tags not removed"
326 exit 2
327 fi
328
329
330 # ----------------------------------------------------------------------------
331 # test 7: create dir and add xattr and tags, sync
332 # expected result: dir with all metadata synced
333
334 mkdir tmp-sync/test4a/newdir1
335
336 $XATTR set tmp-sync/test4a/newdir1 dirattribute1 "test7attribute"
337 $XATTR set tmp-sync/test4a/newdir1 dirattribute2 "directory"
338
339 $DAV_SYNC_BIN add-tag -s test4a tmp-sync/test4a/newdir1 "test7"
340
341 dav_sync_push test4a "test 7: push failed"
342 check_tmpout "0 conflicts" "test 7: wrong conflict counter (push)"
343 check_tmpout "0 errors" "test 7: wrong error counter (push)"
344 check_tmpout "mkcol" "test 7: no mkcol (push)"
345
346 dav_sync_pull test4b "test 7: pull failed"
347 check_tmpout "0 conflicts" "test 7: wrong conflict counter (pull)"
348 check_tmpout "0 errors" "test 7: wrong error counter (pull)"
349
350 # check metadata
351 OUT=`../../build/xattrtool get tmp-sync/test4b/newdir1 dirattribute1 2> /dev/null`
352 if [ "$OUT" != "test7attribute" ]; then
353 echo "test 7: xattr 1 not synced"
354 exit 2
355 fi
356 OUT=`../../build/xattrtool get tmp-sync/test4b/newdir1 dirattribute2 2> /dev/null`
357 if [ "$OUT" != "directory" ]; then
358 echo "test 7: xattr 1 not synced"
359 exit 2
360 fi
361
362 TAGS=`$DAV_SYNC_BIN list-tags -s test4b tmp-sync/test4b/newdir1 > tmp-sync/out.txt 2> /dev/null`
363 if [ $? -ne 0 ]; then
364 echo "test 7: list-tags failed"
365 exit 2
366 fi
367 check_tmpout "test7" "test 7: tag test7 missing"
368
369
370 # ----------------------------------------------------------------------------
371 # test 8: sync again
372 # expected result: no update for newdir1
373
374 dav_sync_push test4a "test 8: push failed"
375 check_tmpout "0 conflicts" "test 8: wrong conflict counter (push)"
376 check_tmpout "0 errors" "test 8: wrong error counter (push)"
377 LN=`cat tmp-sync/out.txt | wc -l 2> /dev/null`
378 if [ $LN -ne 1 ]; then
379 echo "test 8 wrong line count"
380 exit 2
381 fi
382
383 dav_sync_pull test4b "test 8: pull failed"
384 check_tmpout "0 conflicts" "test 8: wrong conflict counter (pull)"
385 check_tmpout "0 errors" "test 8: wrong error counter (pull)"
386 LN=`cat tmp-sync/out.txt | wc -l 2> /dev/null`
387 if [ $LN -ne 1 ]; then
388 echo "test 8 wrong line count"
389 exit 2
390 fi
391
392
393 # ----------------------------------------------------------------------------
394 # test 9: change newdir1 metadata and sync
395 # expected result: update
396
397 $XATTR set tmp-sync/test4a/newdir1 dirattribute1 "test9attribute"
398 $XATTR set tmp-sync/test4a/newdir1 new "hello"
399
400 $DAV_SYNC_BIN add-tag -s test4a tmp-sync/test4a/newdir1 "test9"
401
402 dav_sync_push test4a "test 9: push failed"
403 check_tmpout "0 conflicts" "test 9: wrong conflict counter (push)"
404 check_tmpout "0 errors" "test 9: wrong error counter (push)"
405 check_tmpout "update" "test 9: no mkcol (push)"
406
407 dav_sync_pull test4b "test 9: pull failed"
408 check_tmpout "0 conflicts" "test 9: wrong conflict counter (pull)"
409 check_tmpout "0 errors" "test 9: wrong error counter (pull)"
410 check_tmpout "update" "test 9: no mkcol (oull)"
411
412 # check metadata
413 OUT=`../../build/xattrtool get tmp-sync/test4b/newdir1 dirattribute1 2> /dev/null`
414 if [ "$OUT" != "test9attribute" ]; then
415 echo "test 9: xattr 1 not synced"
416 exit 2
417 fi
418 OUT=`../../build/xattrtool get tmp-sync/test4b/newdir1 dirattribute2 2> /dev/null`
419 if [ "$OUT" != "directory" ]; then
420 echo "test 9: xattr 2 not synced"
421 exit 2
422 fi
423 OUT=`../../build/xattrtool get tmp-sync/test4b/newdir1 new 2> /dev/null`
424 if [ "$OUT" != "hello" ]; then
425 echo "test 9: xattr 3 not synced"
426 exit 2
427 fi
428
429 TAGS=`$DAV_SYNC_BIN list-tags -s test4b tmp-sync/test4b/newdir1 > tmp-sync/out.txt 2> /dev/null`
430 if [ $? -ne 0 ]; then
431 echo "test 9: list-tags failed"
432 exit 2
433 fi
434 check_tmpout "test9" "test 9: tag test9 missing"
435
436
437 # ----------------------------------------------------------------------------
438 # test 10: sync again
439 # expected result: no update for newdir1
440
441 dav_sync_push test4a "test 10: push failed"
442 check_tmpout "0 conflicts" "test 10: wrong conflict counter (push)"
443 check_tmpout "0 errors" "test 10: wrong error counter (push)"
444 LN=`cat tmp-sync/out.txt | wc -l 2> /dev/null`
445 if [ $LN -ne 1 ]; then
446 echo "test 10 wrong line count"
447 exit 2
448 fi
449
450 dav_sync_pull test4b "test 10: pull failed"
451 check_tmpout "0 conflicts" "test 10: wrong conflict counter (pull)"
452 check_tmpout "0 errors" "test 10: wrong error counter (pull)"
453 LN=`cat tmp-sync/out.txt | wc -l 2> /dev/null`
454 if [ $LN -ne 1 ]; then
455 echo "test 10 wrong line count"
456 exit 2
457 fi

mercurial