Sat, 13 Apr 2019 16:51:22 +0200
add first dav-sync binary tests
--- a/test/bin-test/Makefile Fri Apr 12 15:09:19 2019 +0200 +++ b/test/bin-test/Makefile Sat Apr 13 16:51:22 2019 +0200 @@ -1,7 +1,7 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. # -# Copyright 2018 Olaf Wintermann. All rights reserved. +# Copyright 2019 Olaf Wintermann. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: @@ -29,6 +29,14 @@ DAV = ../../build/dav DAV_SYNC = ../../build/dav-sync -all: +all: dav dav-sync + +dav: ./test-dav.sh $(DAV) +dav-sync: + ./test-dav-sync.sh $(DAV) $(DAV_SYNC) + rm -Rf .dav + rm -Rf tmp-sync + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/bin-test/dav-home/sync.xml Sat Apr 13 16:51:22 2019 +0200 @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<configuration> + <!-- + Test 1: default settings after add-directory + --> + <directory> + <name>test1a</name> + <path>$HOME/tmp-sync/test1a</path> + <repository>dav-test-repo</repository> + <collection>/sync/test1</collection> + <trash>.trash</trash> + <database>dav-sync-tests-test1a-db.xml</database> + </directory> + + <directory> + <name>test1b</name> + <path>$HOME/tmp-sync/test1b</path> + <repository>dav-test-repo</repository> + <collection>/sync/test1</collection> + <trash>.trash</trash> + <database>dav-sync-tests-test1a-db.xml</database> + </directory> +</configuration>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/bin-test/synctest/file1 Sat Apr 13 16:51:22 2019 +0200 @@ -0,0 +1,2 @@ +File 1 +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/bin-test/synctest/file2 Sat Apr 13 16:51:22 2019 +0200 @@ -0,0 +1,2 @@ +File 2 +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/bin-test/synctest/file3 Sat Apr 13 16:51:22 2019 +0200 @@ -0,0 +1,131 @@ +FILE 3 + +0000000 b974 609f 5498 f017 0334 0e59 9d30 1b0f +0000010 06a0 4970 b09b 4be4 e3ec 08e2 79f9 a9c7 +0000020 5c35 ab63 2245 58af 5848 a81f 910c dc92 +0000030 625a 10e0 ae42 4b19 7d9a 3c95 fd7d 6280 +0000040 8f4a 9f77 904b 6130 e4a7 0132 a8cf 8bb1 +0000050 1661 33a2 93d6 b57e d9eb 5600 1a89 8a2e +0000060 1791 7349 b150 a1a2 507d cebf e5df e036 +0000070 77e4 5fac d170 ce1f aeae 757c 8435 7ef6 +0000080 b94a 3d49 f25e 75f1 c21f 9fdc 135d 2545 +0000090 f4b4 2f22 8765 ddc1 d092 70a9 e356 46d7 +00000a0 8dd5 c82b 5987 c624 196c 6172 c003 772d +00000b0 24a0 e1b1 b1b4 d8d8 3877 75c4 57b9 1132 +00000c0 e4b6 8e38 b6cb 9ac9 17d9 2807 1896 d5a1 +00000d0 ecdd 23ed 0b24 ff26 c990 7163 cec5 c8c5 +00000e0 5c39 6eba 80b2 5080 18fb a9fd dc40 81e7 +00000f0 1d54 1716 c933 1e18 be2e 3f77 2697 58db +0000100 3478 6643 bcc6 29f6 a2a3 0566 9d10 7479 +0000110 39a2 1894 602e 461e 7b8f cd40 d6c0 34d4 +0000120 893b 48a3 4c0b bed2 d748 fa2f 4953 1621 +0000130 d05a a683 7048 9032 edaa 259b 1b74 7a3c +0000140 5d09 b453 1691 4c9f 9868 9305 1827 131b +0000150 5438 a8db 2982 752b b1bb d1de 9433 45e2 +0000160 194e 1256 7651 5cc7 8cce 764a adf8 768e +0000170 f9a2 6d30 2bfd fe53 ac42 116c 215d 37f7 +0000180 a0d3 147c 040b 3739 2025 a619 8f10 4b53 +0000190 b246 89dc ad17 c3e6 f6ec d770 eac2 3703 +00001a0 d176 e105 ba8b 30a2 66ef 4045 3d6c 01df +00001b0 45a3 568f 21de 85a1 8006 d066 b779 a73e +00001c0 c8fc 6459 5fc6 c25a bec8 c582 d28c a80a +00001d0 8956 adc4 5bbf 1651 54be 6d9f 4633 ed4e +00001e0 ec2e 074a 775d fdb0 fc4b 261d 42d2 b412 +00001f0 2ec9 ed24 6bf3 e0f6 af0c 2d93 8c91 fe69 +0000200 2dce f275 3245 1bbf 3130 1e41 d5b9 a3be +0000210 2aa2 a272 16cd 9413 6ad6 1fd6 8ae4 77c4 +0000220 bfbf 1914 1485 0879 e744 6a0c e2ae a644 +0000230 5be2 fb83 fa18 a91b 2a25 cef1 65eb e753 +0000240 375c 1004 787f 45fe a7df 86d8 134b d6df +0000250 d7f9 25a1 c2bf 341d a399 8ec4 ecf6 6378 +0000260 7d46 fc5f f677 1c6d 2611 d23d ec34 21a3 +0000270 9323 c247 eaa9 6e04 9210 e14e 2896 f6ef +0000280 dc06 a1c0 d65c 56a9 a0ab e8a2 ec20 0231 +0000290 8682 4773 3206 de36 8504 6858 d830 6981 +00002a0 1a2e fd6a 3d36 ed0a bd35 828b 474b be3b +00002b0 e6c6 f4a7 1c03 71ac 5d20 5b8d f64a be4d +00002c0 a6de ea7c 0600 115f 26a2 4a7c 4243 233b +00002d0 09f9 571d 1c7c 7bb8 80aa 3600 f5db 6b0b +00002e0 495d 0571 4da1 d185 08b7 d992 3d6b 5ead +00002f0 e4f6 5493 13c0 aa26 850f 11e8 0145 dbf3 +0000300 e1d4 db5a 5b59 74b1 c2e6 4d8e f267 d159 +0000310 c3b3 3a29 75da 3424 0bde 65f8 ccb0 3458 +0000320 9a26 5416 6c2b 2bdf db2d 107c 912d 664d +0000330 c379 eefb d6bf 46ea 6b3b cb1f 7e60 cc68 +0000340 e2b4 f20c 3c89 4249 a3c7 7838 0683 7595 +0000350 5523 6377 f338 e30e 9f7e 3895 e834 687d +0000360 6a0a fea1 d7bc 2185 748c 849c 2023 d08d +0000370 f4dc b5ce 5c9a e2d8 9a12 43d1 6240 46e3 +0000380 c47e 5220 1d76 fa6f b34d 372e f4d6 60ac +0000390 2b7e e4c3 845a 1719 dae0 7206 e158 3312 +00003a0 b21f 46b0 f8c2 bb80 a7bd 6cc0 d105 d536 +00003b0 156f 4105 767b 46ab 24b3 6c39 7668 8f74 +00003c0 aec2 b6ed f87b 72aa 1b41 35cb 7109 5b54 +00003d0 20c0 61ae d9d2 376c b13a 73d0 9b90 283c +00003e0 c60b c0e0 0c94 fead 1d24 2cec ac6c a9e6 +00003f0 c784 ba23 41b6 adc7 670f a838 6131 1e49 +0000400 09e8 66bb b19b d6ee 71d3 2459 7d9a 50a4 +0000410 f6b3 7097 3ae1 2a16 ce05 0005 c09f 5657 +0000420 4ce6 412a 48a6 ff29 ccf4 f912 581b 3f9d +0000430 351d 59cd 86c4 8060 2c6e c874 662d d2d5 +0000440 0ba9 bd8f 62e2 3e5b e280 062c 86d9 9483 +0000450 07cf ef37 94dc 7aca e517 b7c3 660e f0ed +0000460 3e8f f05f bdee 4756 5c9a e84a 7a15 d5ed +0000470 efeb b926 ac0b 04a6 e825 ef02 a536 ceff +0000480 51b3 3aec 5cf1 241a cda9 9696 90ba b301 +0000490 4eca 4b5f 460f 2295 89d2 4fc5 40b6 1228 +00004a0 7d77 bca9 64d2 7849 7e4c 5b46 c2bc 6434 +00004b0 0810 f5d4 3079 fdc2 38c4 09ab 7af3 0ded +00004c0 62f7 2089 3bdf f6eb dee3 3b80 efb4 3024 +00004d0 53ff 9ad7 6fb4 140b 0373 505d 3373 1631 +00004e0 2b0a caca a209 88fe 228d 7b92 3788 9d33 +00004f0 f2c6 349d 0f29 0538 4f70 d32b e655 6e52 +0000500 ada9 99b2 412e 78c8 546a cc3c 0536 fe49 +0000510 7fdd 5595 13a6 8216 877c d211 31d0 0458 +0000520 286f f619 b5de 90a2 b601 0307 2766 bef4 +0000530 8d97 d926 9f22 7f73 ecf8 54aa fc6a 7916 +0000540 6981 717c 7e75 78f4 3ccd 94b3 9518 fd56 +0000550 2bb3 f289 e32b 5477 7357 d17d 8243 c315 +0000560 5a58 1504 a7f5 ed6e 8b91 1add 5411 fa2d +0000570 a6d0 d12d 456a f492 6c64 cf5b 7b06 16e7 +0000580 fffe 875f f4b0 fc87 a361 4a71 1d1d afe1 +0000590 d7e9 96a7 4798 8110 64d4 03cb 0194 ce26 +00005a0 1bfe dfb6 e5a6 4e06 151b bf46 adce f7a5 +00005b0 2a43 b87b d3eb 1510 d33a 4763 6962 0d48 +00005c0 15b1 c5ea 0847 1ae6 f3ca 0ee2 fe95 16af +00005d0 b06b 34c6 9798 218e 1d86 2f95 ec8b 0c34 +00005e0 9daa 5b29 591a a33d 7a91 311a eae9 f2e9 +00005f0 4dd4 588e 9350 8f7d 2438 c0b7 12e6 08f0 +0000600 c451 2cf6 680d 3ff3 cb16 99ee 5274 a3fb +0000610 7ee9 2e7f 65e4 8a74 32fb d6bb 5965 3646 +0000620 8123 9293 82c3 b211 33c8 5b5f a55f ec71 +0000630 c07e c293 c7e4 9a39 9979 7e0d 2c43 5784 +0000640 82f0 3d4b 1b2a 8f93 9bf1 bb58 791b 63d0 +0000650 f01c 2ab0 9bdc d6ed c207 05ac e46b 5606 +0000660 b510 d78b 01f3 b642 ecfa 672d c200 4941 +0000670 0d08 e676 6b21 4138 765c 72fc 4497 5d84 +0000680 6463 f96d 0161 eb27 945d 1991 477b 2882 +0000690 f42f 921c 5e89 4434 2b54 4253 30a8 29e3 +00006a0 6835 f2e4 72dc 580c 1914 776e 922e a750 +00006b0 7c1d 45f8 6ab9 3f09 9dc3 214c 3008 fe16 +00006c0 ba23 8107 33d2 4534 ac8c 791b 1b3d a736 +00006d0 3289 09b4 8d5f 66d5 b0e8 d809 3e6b 9ea4 +00006e0 e985 b75a ad56 5ecb b6b1 5650 7bbd 0c6e +00006f0 fb84 9db7 3d0e 04b6 64ed 45c8 0dd4 d139 +0000700 8d28 1bd2 e6c5 aa9c 1c74 9e9d 938e a59c +0000710 b91d bb91 8fc5 cd10 1c43 d5d4 56e0 d66d +0000720 95b6 ea02 710f 1e3e aa99 f2c3 18ad 716c +0000730 52b6 3795 717e d2a6 94e8 5e55 5111 af93 +0000740 d3fe c522 58d6 bd32 5e3a 792e 2341 ca5d +0000750 adfa a533 8b32 2e7a 5d70 4873 7ca0 298c +0000760 4314 e52b 6dcb b418 ba9d d01e e3db d984 +0000770 78ed d31a 3d4b a566 a8a6 680a bfdd 2450 +0000780 b636 daa1 d741 0266 6e6e 60b0 c426 c396 +0000790 2855 2581 cae6 eed4 7a7f 9811 a8d3 a365 +00007a0 4cfd 1b76 dc5d e2fe c356 0de5 1550 2919 +00007b0 f4a9 22a1 07fa e741 441f f488 dac8 d520 +00007c0 b120 14e4 4feb 1e08 702d 4c9a 0fb0 0b38 +00007d0 c550 6db0 cd2b dc85 e7a8 fbfa 9c65 38b3 +00007e0 41af d137 17b3 e1e2 d113 2e6f b1d8 4e54 +00007f0 6f25 79da 18d5 1760 4f4e d7f5 1b96 dfc5 +0000800
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/bin-test/synctest/file4 Sat Apr 13 16:51:22 2019 +0200 @@ -0,0 +1,131 @@ +FILE 4 + +0000000 222d 53b8 add3 0d6b fb5e f6fe bb99 5323 +0000010 a423 9578 52e1 681b f806 bbd4 2f41 2b0f +0000020 d4c8 19e7 c46a 2631 bb51 3ecf ebda 1c55 +0000030 12bf d298 cc44 2586 3d12 07aa 78bc a944 +0000040 f1c7 4fbc a40a cb4a 701f 0ef2 f4ae 1d6e +0000050 7044 b838 4c75 db7e 00cc ed36 cfa5 899d +0000060 60b0 4b91 e480 4583 dc0c ee88 5f0b 24e9 +0000070 54da df75 21bc eedc ab34 bb49 8e76 df69 +0000080 6371 8a3f 6125 7f70 c15f 5511 75ca 2fe1 +0000090 380b 2b0c 3903 3218 347c f799 f409 68ea +00000a0 e3cf 65ac 8bee af4e 1c27 d6b8 bb69 d637 +00000b0 e369 3a0a a559 f0ee a680 5aa8 f741 dcb1 +00000c0 32d5 1a55 9241 78c9 a9de 8aa5 ff01 424d +00000d0 2cd6 6474 4a18 26e1 debe 3bef d862 ece4 +00000e0 0f63 fa84 3514 0734 e24e 1fa6 0b41 56c4 +00000f0 34b5 37d4 1873 ab0f 1989 398a 6b11 3705 +0000100 b06d 9d73 045f 21af ced3 dde2 235e e65e +0000110 ab0d d16a 839c 85ea a8f8 2b23 4973 6405 +0000120 128a 856e 17ab d6d6 0370 e9c1 1074 cc9a +0000130 1cad 6b14 86b4 a05c 68c8 441e a3cd 25cb +0000140 ace7 e7f3 ff45 9a57 4675 8b0c 4737 037c +0000150 2386 3234 35ba b122 a629 f2be 9ea7 77a7 +0000160 24fa 88d5 ec64 45d7 6c34 47c9 b2d5 b5fc +0000170 d48e a244 e209 7d43 92df c296 a7e2 69dc +0000180 9255 5a1a c7e3 fd71 fdbd 0933 7c8d f540 +0000190 c2d6 3388 e9d3 3e09 a877 7150 bb6f 13c6 +00001a0 87d2 4305 1241 457c 08ed f16e 6af1 efff +00001b0 cb00 5b79 25dc bd68 1d7e b2b1 d439 8832 +00001c0 e650 be97 0d5f e260 8a1b 6873 eec2 217f +00001d0 8aad b2e7 c0dd 2d1e 74a1 ae4e 2420 d5ea +00001e0 4f3c 851d 4c61 62d7 2117 f70c d2b8 fa7f +00001f0 5859 4194 efdb 5eed e6f1 f93f 8cb8 04dd +0000200 fe0d 501a 64e1 f304 3e4b 27a3 211a 92ce +0000210 1a63 1fd7 b65b 303b 2402 a76a 39a0 a8ca +0000220 ab38 13ae f964 4330 6a15 f140 615b 510c +0000230 911f 736e 375e 04c4 9c7a db29 ade9 5a40 +0000240 7b04 1a98 6a8e fb8c 07d1 bc66 f393 a990 +0000250 7b96 8bdb 3542 a07e aade 09dc 2e00 4108 +0000260 1155 65fe eac4 b64e 82e7 0807 4232 634a +0000270 ec00 5c4b 4793 411b 351f bd8c 901f d14c +0000280 73f6 7b71 3d63 b8ff 2d43 43bc 4ab0 3fd5 +0000290 63de e290 3129 6dda 8611 aa99 0b32 af97 +00002a0 7637 45a5 c23d 9f71 1e7c 5ad4 a956 77a6 +00002b0 e3e0 2a41 0e17 76ff 6c26 db7f 31a4 a306 +00002c0 5981 8b20 8c66 dd63 3eb8 e662 a0e3 04b4 +00002d0 cc78 11ef f328 06b6 4fe4 81f3 2745 0c3d +00002e0 9a02 6bfd 65c3 38e1 965b da19 6b93 9e54 +00002f0 8e87 9fee 4bd1 1b41 79a4 2588 d7c5 53db +0000300 b094 9c83 5cf6 55bf 0309 36bf f0ac 5b23 +0000310 e626 20e7 1c2b 6ba4 a8d0 09a5 42f5 4a29 +0000320 e781 26a3 4f9c b8da 023f 45d0 4d6a a86e +0000330 5985 dc30 6b47 6918 d4f3 a0b3 42df 6aad +0000340 6e89 8276 47d4 9461 16b8 cb4c 4b0f db1d +0000350 14e8 1e40 3055 4caf 96bf dd6a 374b 21ad +0000360 59fa 747e 3023 cd0d a7a3 f194 fbbf 3868 +0000370 cde0 5041 4031 9cb5 28a6 2bcc 1c84 0b1e +0000380 04a8 bd8c 110e 10ba 761b 3149 22d6 144a +0000390 525d 0318 c4b2 8d94 e2c0 470f 38a8 f7c1 +00003a0 0b0e 5210 1068 04b9 58ad c1f2 67f9 7876 +00003b0 406d 4fe3 9d12 a1c0 fcfe c1d6 ffda 2293 +00003c0 c876 acde b071 b195 c36a bf88 073f 6d01 +00003d0 eb6b 474e fa3c 9528 179a 435f 50b4 b3a9 +00003e0 9c21 20a4 798e 6587 2262 0076 283b be33 +00003f0 0738 ba0e 0175 e5b4 de41 a4ae 3bc6 644a +0000400 1c73 3065 ba1c bd34 327f 1487 0846 2ee6 +0000410 ba29 75fc 79ad 7c65 983e bc09 894d 255e +0000420 87dc c3b3 fb76 f39c 32fa e1d3 f54b cfe6 +0000430 ffb0 abdd 9362 c671 397a bbc1 8993 d7be +0000440 7fec 8f41 f0b2 283b ba8e c59a 6df9 8adf +0000450 f468 2ad7 0853 f918 45f8 9226 1698 0f91 +0000460 bed5 9ebc 108c a5ab 51fe e7d5 7fb0 f734 +0000470 2725 c11b 34a9 12db 3569 1418 8283 35e4 +0000480 c424 ffd4 bcb5 2aba 9b3e 4bdb f153 23d8 +0000490 41f8 a87a 5102 c236 2add e612 605b 65aa +00004a0 290a 80de 3b90 a7b3 d3ae b0fc 27d0 e63f +00004b0 ed88 1e99 97fa 7c39 942c 5281 4f61 ee17 +00004c0 4dd3 0a23 7886 e142 41bd 124d b764 0dfe +00004d0 a898 c8fe 9113 9971 2b24 35e4 3a7c 29ab +00004e0 94b8 769e 6fae f734 45e3 d6f5 c904 5aad +00004f0 ca84 c699 1d54 3ccb 045b f478 fab7 4e6f +0000500 03fc 655d 5af9 7698 4213 42cb 9b62 e3af +0000510 3706 0c4e 6eb1 bfef 202a d6bf d4c9 72c1 +0000520 7449 6686 1eb6 79bf 7ec1 f6ae d033 4843 +0000530 f7a3 169e fe73 14ec 32bf f270 e795 e11a +0000540 b68c 7cd3 ee52 bb9d a8a4 4b0f c1a9 0fd5 +0000550 5d26 b5f4 b776 8984 90c0 f297 04b9 4324 +0000560 44a2 b74b 7d2d ade5 2bcc 7cec 112a f48a +0000570 6a97 b8b1 59fd c658 d754 f353 b3f8 51d7 +0000580 84d8 31b9 660b 017e 825b 7d42 8cea 2f27 +0000590 3bb5 0a52 e92c e727 e6da 39c8 dcec ed83 +00005a0 157c 3451 a838 376b 027d 3fdd dcef 660d +00005b0 4165 5345 cd0e 2312 868d 2b24 5230 4780 +00005c0 1032 9e34 43ab f1b3 7417 a8e5 2d7d b14d +00005d0 7b79 eff3 1d97 d499 1e92 bb3d 92e6 23b3 +00005e0 8e2b 2af3 7ffc e711 3f2a 7150 bcea 305e +00005f0 c7d8 3641 dd0c b38d 70c8 7530 2e1a 95a8 +0000600 debd 0093 3b64 aabd f431 1fe3 a645 602b +0000610 9eaa 294c 6b74 28bd 099c fabf 1d75 a8d9 +0000620 6313 a68d c3de d42d 89e6 ae69 8b51 1f4a +0000630 b1d3 7ede be1e 8c99 a493 2d41 9e79 12b3 +0000640 2a40 d1b8 220b 62ae 080b 3293 b41d 006c +0000650 3ccb 88e9 e420 95ec 137e 620d 79a8 3ba5 +0000660 20e1 1496 b706 15df d282 9b6d c087 fa5d +0000670 03d7 2d15 bddc 76b7 8615 d1cf 9ecb 1972 +0000680 1ecd e39a c197 74ce b7e6 0016 f01b 094e +0000690 c176 ed70 b6b9 ae6d 6b59 f0d5 7e13 5775 +00006a0 ee00 2cba a59e 9521 3b75 da0a 061f aca5 +00006b0 d86c 06cd 3224 2df0 8bfe 925b f4e0 9c88 +00006c0 d6cd 99da 60c3 b9fe 95b3 4df0 7da8 924b +00006d0 7b52 ae5a 72dc cf64 d5de 6ce6 10b8 a7d0 +00006e0 4c67 369b 2bb3 b3c8 5749 24d7 929b 2087 +00006f0 92e8 01ea 09a5 e4b3 0465 a7cd fec7 f88b +0000700 6901 8eff a187 2a01 beec 0a76 5f82 740e +0000710 ef97 eb45 6027 a8e8 e5ff 4ae6 81c7 94b8 +0000720 a24b c59d 0126 4c3b 22e2 c384 4dc4 1e8a +0000730 ecd0 d0df 877f 2d92 e24b f2d2 dd89 c35a +0000740 7267 1b7e 32bc aa90 242c 0c8e 1549 c2d2 +0000750 052e 01ed 6f5d 0573 24df 6a5a efcf 16e4 +0000760 ef4f 0b37 dc13 1835 a53c 3200 44d2 6c87 +0000770 502b d1e3 6699 3dcf e015 5b4f d7e4 1227 +0000780 924d c9be b739 5d21 a48d 33ff 523e 95ff +0000790 fdae 62af 143b 812a f038 c252 5642 5196 +00007a0 b980 b19b 3311 0535 aafa ada3 c322 60ad +00007b0 ea8b 2646 c255 838b 2bb2 77ec 4c08 6737 +00007c0 3e50 1636 d297 5f48 ab97 1883 b171 e4ee +00007d0 051c f1e6 70c8 4bc7 9895 d200 e36e 9d41 +00007e0 d0f1 6649 e0db bfda 345c 05ba 85c4 d817 +00007f0 5fc2 1b16 fbea 9a08 2ae7 28a9 4f48 0a81 +0000800
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/bin-test/test-dav-sync-push1.sh Sat Apr 13 16:51:22 2019 +0200 @@ -0,0 +1,158 @@ +#!/bin/sh +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. +# +# Copyright 2019 Olaf Wintermann. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +if [ -z "$DAV_BIN" ]; +then + echo "DAV_BIN variable not set" + exit 1 +fi +if [ -z "$DAV_SYNC_BIN" ]; +then + echo "DAV_BIN variable not set" + exit 1 +fi + +# checks if tmp-sync/out.txt contains a specific text +# arg1: pattern +# arg2: errormsg +check_tmpout() +{ + TEST=`cat tmp-sync/out.txt | grep "$1"` + if [ $? -ne 0 ]; + then + echo "$2" + exit 2 + fi +} + +# do dav-sync push and check return value +# arg1: dir +# arg2: errormsg +dav_sync_push() +{ + $DAV_SYNC_BIN push $1 > tmp-sync/out.txt + if [ $? -ne 0 ]; + then + echo "$errormsg" + exit 2 + fi +} + +$DAV_BIN mkcol dav-test-repo/sync/test1 + +# 1. test +# copy to files to the test1a dir and run push +# expected result: 2 uploads, no errors or conflicts + +cp synctest/file1 tmp-sync/test1a +cp synctest/file2 tmp-sync/test1a + +OUT=`$DAV_SYNC_BIN push test1a | tail -n 1` + +TEST=`echo $OUT | grep Result` +if [ $? -ne 0 ]; +then + echo "push 1 failed" + exit 2 +fi + +TEST=`echo $OUT | grep "2 files pushed"` +if [ $? -ne 0 ]; +then + echo "wrong push counter" + exit 2 +fi + +TEST=`echo $OUT | grep "0 conflicts"` +if [ $? -ne 0 ]; +then + echo "wrong conflict counter" + exit 2 +fi + +TEST=`echo $OUT | grep "0 files deleted"` +if [ $? -ne 0 ]; +then + echo "wrong delete counter" + exit 2 +fi + +# 2. test +# do nothing +# expected result: no uploads or updates, only status line with zeros + +dav_sync_push test1a "push 2 failed" + +OUT=`wc -l < tmp-sync/out.txt` +if [ "$OUT" != "1" ]; +then + echo "push 2: number of output lines not 1" + exit 2 +fi + +check_tmpout "0 files pushed" "push 2: wrong push counter" +check_tmpout "0 errors" "push 2: wrong error counter" + +# 3. test +# add empty dir +# expected result: 1 mkcol +mkdir tmp-sync/test1a/emptydir + +dav_sync_push test1a "push 3 failed" +check_tmpout "mkcol: /emptydir" "push 3: no mkcol" + +# 4. test +# do nothing again, test if double mkcol happens +# expected result: no mkcol +dav_sync_push test1a "push 4 failed" + +OUT=`wc -l < tmp-sync/out.txt` +if [ "$OUT" != "1" ]; +then + echo "push 4: number of output lines not 1" + exit 2 +fi + +check_tmpout "0 files pushed" "push 4: wrong push counter" +check_tmpout "0 errors" "push 4: wrong error counter" + + +# 5. test +# touch file +# expected result: upload touched file +sleep 2 +touch tmp-sync/test1a/file1 + +dav_sync_push test1a "push 5 failed" +check_tmpout "put: /file1" "push 5: no put" +check_tmpout "1 file pushed" "push 5: wrong push counter" +check_tmpout "0 conflicts" "push 5: wrong conflict counter" +check_tmpout "0 files deleted" "push 5: wrong delete counter" +check_tmpout "0 errors" "push 5: wrong error counter" +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/bin-test/test-dav-sync.sh Sat Apr 13 16:51:22 2019 +0200 @@ -0,0 +1,98 @@ +#!/bin/sh +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. +# +# Copyright 2019 Olaf Wintermann. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +if [ $# -lt 2 ]; +then + echo "usage:" $0 "<dav-binary> <dav-sync-binary>" + exit 1 +fi + +# check if binaries exist +which $1 > /dev/null +if [ $? -ne 0 ]; +then + exit 1 +fi +which $2 > /dev/null +if [ $? -ne 0 ]; +then + exit 1 +fi + +DAV_BIN=$1 +DAV_SYNC_BIN=$2 +export DAV_BIN +export DAV_SYNC_BIN + +# create config +rm -Rf .dav +cp -R $HOME/.dav/ .dav/ +cp dav-home/sync.xml .dav/sync.xml +export HOME=`pwd` + +# tmp sync dir +rm -Rf tmp-sync +mkdir tmp-sync +mkdir tmp-sync/test1a +mkdir tmp-sync/test1b + +# check if config works +TEST1_DIR=`$DAV_SYNC_BIN list-dirs | grep test1a | tail -n 1` +if [ -z $TEST1_DIR ]; +then + echo "Config not working" + rm -Rf .dav + rm -Rf tmp-sync + exit 1 +fi + +# clean test repo and files +$DAV_BIN rm -N dav-test-repo/tests/ 2> /dev/null +$DAV_BIN rm -N dav-test-repo/sync/ 2> /dev/null + +do_test() +{ + printf "TEST: $1 ... " + ./$2 + if [ $? -ne 0 ]; then + rm -Rf .dav + exit 2 + fi + echo ok +} + +# +# ok, begin the tests +# +do_test "dav-sync push (1)" test-dav-sync-push1.sh + +# cleanup +rm -Rf .dav +rm -Rf tmp-sync +
--- a/test/bin-test/test-dav.sh Fri Apr 12 15:09:19 2019 +0200 +++ b/test/bin-test/test-dav.sh Sat Apr 13 16:51:22 2019 +0200 @@ -2,7 +2,7 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. # -# Copyright 2018 Olaf Wintermann. All rights reserved. +# Copyright 2019 Olaf Wintermann. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: @@ -62,7 +62,7 @@ } # clean test repo -$DAV_BIN rm -N dav-test-repo/tests/ 2> /dev/null +$DAV_BIN rm -N dav-test-repo/sync/ 2> /dev/null # # ok, begin the tests