check_csync_exclude.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. /*
  2. * libcsync -- a library to sync a directory with another
  3. *
  4. * Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org>
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with this library; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #include "config_csync.h"
  21. #include <string.h>
  22. #include <time.h>
  23. #include <sys/time.h>
  24. #define CSYNC_TEST 1
  25. #include "csync_exclude.cpp"
  26. #include "torture.h"
  27. #define EXCLUDE_LIST_FILE SOURCEDIR"/../../sync-exclude.lst"
  28. static int setup(void **state) {
  29. CSYNC *csync;
  30. csync = new CSYNC("/tmp/check_csync1", "");
  31. *state = csync;
  32. return 0;
  33. }
  34. static int setup_init(void **state) {
  35. CSYNC *csync;
  36. int rc;
  37. csync = new CSYNC("/tmp/check_csync1", "");
  38. rc = csync_exclude_load(EXCLUDE_LIST_FILE, &(csync->excludes));
  39. assert_int_equal(rc, 0);
  40. /* and add some unicode stuff */
  41. rc = _csync_exclude_add(&(csync->excludes), "*.💩");
  42. assert_int_equal(rc, 0);
  43. rc = _csync_exclude_add(&(csync->excludes), "пятницы.*");
  44. assert_int_equal(rc, 0);
  45. rc = _csync_exclude_add(&(csync->excludes), "*/*.out");
  46. assert_int_equal(rc, 0);
  47. rc = _csync_exclude_add(&(csync->excludes), "latex*/*.run.xml");
  48. assert_int_equal(rc, 0);
  49. rc = _csync_exclude_add(&(csync->excludes), "latex/*/*.tex.tmp");
  50. assert_int_equal(rc, 0);
  51. *state = csync;
  52. return 0;
  53. }
  54. static int teardown(void **state) {
  55. CSYNC *csync = (CSYNC*)*state;
  56. int rc;
  57. delete csync;
  58. rc = system("rm -rf /tmp/check_csync1");
  59. assert_int_equal(rc, 0);
  60. rc = system("rm -rf /tmp/check_csync2");
  61. assert_int_equal(rc, 0);
  62. *state = NULL;
  63. return 0;
  64. }
  65. static void check_csync_exclude_add(void **state)
  66. {
  67. CSYNC *csync = (CSYNC*)*state;
  68. _csync_exclude_add(&(csync->excludes), "/tmp/check_csync1/*");
  69. assert_string_equal(csync->excludes->vector[0], "/tmp/check_csync1/*");
  70. }
  71. static void check_csync_exclude_load(void **state)
  72. {
  73. CSYNC *csync = (CSYNC*)*state;
  74. int rc;
  75. rc = csync_exclude_load(EXCLUDE_LIST_FILE, &(csync->excludes) );
  76. assert_int_equal(rc, 0);
  77. assert_string_equal(csync->excludes->vector[0], "*~");
  78. assert_int_not_equal(csync->excludes->count, 0);
  79. }
  80. static void check_csync_excluded(void **state)
  81. {
  82. CSYNC *csync = (CSYNC*)*state;
  83. int rc;
  84. rc = csync_excluded_no_ctx(csync->excludes, "", CSYNC_FTW_TYPE_FILE);
  85. assert_int_equal(rc, CSYNC_NOT_EXCLUDED);
  86. rc = csync_excluded_no_ctx(csync->excludes, "/", CSYNC_FTW_TYPE_FILE);
  87. assert_int_equal(rc, CSYNC_NOT_EXCLUDED);
  88. rc = csync_excluded_no_ctx(csync->excludes, "krawel_krawel", CSYNC_FTW_TYPE_FILE);
  89. assert_int_equal(rc, CSYNC_NOT_EXCLUDED);
  90. rc = csync_excluded_no_ctx(csync->excludes, ".kde/share/config/kwin.eventsrc", CSYNC_FTW_TYPE_FILE);
  91. assert_int_equal(rc, CSYNC_NOT_EXCLUDED);
  92. rc = csync_excluded_no_ctx(csync->excludes, ".directory/cache-maximegalon/cache1.txt", CSYNC_FTW_TYPE_FILE);
  93. assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
  94. rc = csync_excluded_no_ctx(csync->excludes, "mozilla/.directory", CSYNC_FTW_TYPE_DIR);
  95. assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
  96. /*
  97. * Test for patterns in subdirs. '.beagle' is defined as a pattern and has
  98. * to be found in top dir as well as in directories underneath.
  99. */
  100. rc = csync_excluded_no_ctx(csync->excludes, ".apdisk", CSYNC_FTW_TYPE_DIR);
  101. assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
  102. rc = csync_excluded_no_ctx(csync->excludes, "foo/.apdisk", CSYNC_FTW_TYPE_DIR);
  103. assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
  104. rc = csync_excluded_no_ctx(csync->excludes, "foo/bar/.apdisk", CSYNC_FTW_TYPE_DIR);
  105. assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
  106. rc = csync_excluded_no_ctx(csync->excludes, ".java", CSYNC_FTW_TYPE_FILE);
  107. assert_int_equal(rc, CSYNC_NOT_EXCLUDED);
  108. /* Files in the ignored dir .java will also be ignored. */
  109. rc = csync_excluded_no_ctx(csync->excludes, ".apdisk/totally_amazing.jar", CSYNC_FTW_TYPE_FILE);
  110. assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
  111. /* and also in subdirs */
  112. rc = csync_excluded_no_ctx(csync->excludes, "projects/.apdisk/totally_amazing.jar", CSYNC_FTW_TYPE_FILE);
  113. assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
  114. /* csync-journal is ignored in general silently. */
  115. rc = csync_excluded_no_ctx(csync->excludes, ".csync_journal.db", CSYNC_FTW_TYPE_FILE);
  116. assert_int_equal(rc, CSYNC_FILE_SILENTLY_EXCLUDED);
  117. rc = csync_excluded_no_ctx(csync->excludes, ".csync_journal.db.ctmp", CSYNC_FTW_TYPE_FILE);
  118. assert_int_equal(rc, CSYNC_FILE_SILENTLY_EXCLUDED);
  119. rc = csync_excluded_no_ctx(csync->excludes, "subdir/.csync_journal.db", CSYNC_FTW_TYPE_FILE);
  120. assert_int_equal(rc, CSYNC_FILE_SILENTLY_EXCLUDED);
  121. /* also the new form of the database name */
  122. rc = csync_excluded_no_ctx(csync->excludes, "._sync_5bdd60bdfcfa.db", CSYNC_FTW_TYPE_FILE);
  123. assert_int_equal(rc, CSYNC_FILE_SILENTLY_EXCLUDED);
  124. rc = csync_excluded_no_ctx(csync->excludes, "._sync_5bdd60bdfcfa.db.ctmp", CSYNC_FTW_TYPE_FILE);
  125. assert_int_equal(rc, CSYNC_FILE_SILENTLY_EXCLUDED);
  126. rc = csync_excluded_no_ctx(csync->excludes, "._sync_5bdd60bdfcfa.db-shm", CSYNC_FTW_TYPE_FILE);
  127. assert_int_equal(rc, CSYNC_FILE_SILENTLY_EXCLUDED);
  128. rc = csync_excluded_no_ctx(csync->excludes, "subdir/._sync_5bdd60bdfcfa.db", CSYNC_FTW_TYPE_FILE);
  129. assert_int_equal(rc, CSYNC_FILE_SILENTLY_EXCLUDED);
  130. rc = csync_excluded_no_ctx(csync->excludes, ".sync_5bdd60bdfcfa.db", CSYNC_FTW_TYPE_FILE);
  131. assert_int_equal(rc, CSYNC_FILE_SILENTLY_EXCLUDED);
  132. rc = csync_excluded_no_ctx(csync->excludes, ".sync_5bdd60bdfcfa.db.ctmp", CSYNC_FTW_TYPE_FILE);
  133. assert_int_equal(rc, CSYNC_FILE_SILENTLY_EXCLUDED);
  134. rc = csync_excluded_no_ctx(csync->excludes, ".sync_5bdd60bdfcfa.db-shm", CSYNC_FTW_TYPE_FILE);
  135. assert_int_equal(rc, CSYNC_FILE_SILENTLY_EXCLUDED);
  136. rc = csync_excluded_no_ctx(csync->excludes, "subdir/.sync_5bdd60bdfcfa.db", CSYNC_FTW_TYPE_FILE);
  137. assert_int_equal(rc, CSYNC_FILE_SILENTLY_EXCLUDED);
  138. /* pattern ]*.directory - ignore and remove */
  139. rc = csync_excluded_no_ctx(csync->excludes, "my.~directory", CSYNC_FTW_TYPE_FILE);
  140. assert_int_equal(rc, CSYNC_FILE_EXCLUDE_AND_REMOVE);
  141. rc = csync_excluded_no_ctx(csync->excludes, "/a_folder/my.~directory", CSYNC_FTW_TYPE_FILE);
  142. assert_int_equal(rc, CSYNC_FILE_EXCLUDE_AND_REMOVE);
  143. /* Not excluded because the pattern .netscape/cache requires directory. */
  144. rc = csync_excluded_no_ctx(csync->excludes, ".netscape/cache", CSYNC_FTW_TYPE_FILE);
  145. assert_int_equal(rc, CSYNC_NOT_EXCLUDED);
  146. /* Not excluded */
  147. rc = csync_excluded_no_ctx(csync->excludes, "unicode/中文.hé", CSYNC_FTW_TYPE_FILE);
  148. assert_int_equal(rc, CSYNC_NOT_EXCLUDED);
  149. /* excluded */
  150. rc = csync_excluded_no_ctx(csync->excludes, "unicode/пятницы.txt", CSYNC_FTW_TYPE_FILE);
  151. assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
  152. rc = csync_excluded_no_ctx(csync->excludes, "unicode/中文.💩", CSYNC_FTW_TYPE_FILE);
  153. assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
  154. /* path wildcards */
  155. rc = csync_excluded_no_ctx(csync->excludes, "foobar/my_manuscript.out", CSYNC_FTW_TYPE_FILE);
  156. assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
  157. rc = csync_excluded_no_ctx(csync->excludes, "latex_tmp/my_manuscript.run.xml", CSYNC_FTW_TYPE_FILE);
  158. assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
  159. rc = csync_excluded_no_ctx(csync->excludes, "word_tmp/my_manuscript.run.xml", CSYNC_FTW_TYPE_FILE);
  160. assert_int_equal(rc, CSYNC_NOT_EXCLUDED);
  161. rc = csync_excluded_no_ctx(csync->excludes, "latex/my_manuscript.tex.tmp", CSYNC_FTW_TYPE_FILE);
  162. assert_int_equal(rc, CSYNC_NOT_EXCLUDED);
  163. rc = csync_excluded_no_ctx(csync->excludes, "latex/songbook/my_manuscript.tex.tmp", CSYNC_FTW_TYPE_FILE);
  164. assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
  165. #ifdef _WIN32
  166. rc = csync_excluded_no_ctx(csync->excludes, "file_trailing_space ", CSYNC_FTW_TYPE_FILE);
  167. assert_int_equal(rc, CSYNC_FILE_EXCLUDE_TRAILING_SPACE);
  168. rc = csync_excluded_no_ctx(csync->excludes, "file_trailing_dot.", CSYNC_FTW_TYPE_FILE);
  169. assert_int_equal(rc, CSYNC_FILE_EXCLUDE_INVALID_CHAR);
  170. rc = csync_excluded_no_ctx(csync->excludes, "AUX", CSYNC_FTW_TYPE_FILE);
  171. assert_int_equal(rc, CSYNC_FILE_EXCLUDE_INVALID_CHAR);
  172. rc = csync_excluded_no_ctx(csync->excludes, "file_invalid_char<", CSYNC_FTW_TYPE_FILE);
  173. assert_int_equal(rc, CSYNC_FILE_EXCLUDE_INVALID_CHAR);
  174. #endif
  175. }
  176. static void check_csync_excluded_traversal(void **state)
  177. {
  178. CSYNC *csync = (CSYNC*)*state;
  179. int rc;
  180. _csync_exclude_add( &(csync->excludes), "/exclude" );
  181. /* Check toplevel dir, the pattern only works for toplevel dir. */
  182. rc = csync_excluded_traversal(csync->excludes, "/exclude", CSYNC_FTW_TYPE_DIR);
  183. assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
  184. rc = csync_excluded_traversal(csync->excludes, "/foo/exclude", CSYNC_FTW_TYPE_DIR);
  185. assert_int_equal(rc, CSYNC_NOT_EXCLUDED);
  186. /* check for a file called exclude. Must still work */
  187. rc = csync_excluded_traversal(csync->excludes, "/exclude", CSYNC_FTW_TYPE_FILE);
  188. assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
  189. rc = csync_excluded_traversal(csync->excludes, "/foo/exclude", CSYNC_FTW_TYPE_FILE);
  190. assert_int_equal(rc, CSYNC_NOT_EXCLUDED);
  191. /* Add an exclude for directories only: excl/ */
  192. _csync_exclude_add( &(csync->excludes), "excl/" );
  193. rc = csync_excluded_traversal(csync->excludes, "/excl", CSYNC_FTW_TYPE_DIR);
  194. assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
  195. rc = csync_excluded_traversal(csync->excludes, "meep/excl", CSYNC_FTW_TYPE_DIR);
  196. assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
  197. rc = csync_excluded_traversal(csync->excludes, "meep/excl/file", CSYNC_FTW_TYPE_FILE);
  198. assert_int_equal(rc, CSYNC_NOT_EXCLUDED); // because leading dirs aren't checked!
  199. rc = csync_excluded_traversal(csync->excludes, "/excl", CSYNC_FTW_TYPE_FILE);
  200. assert_int_equal(rc, CSYNC_NOT_EXCLUDED);
  201. _csync_exclude_add(&csync->excludes, "/excludepath/withsubdir");
  202. rc = csync_excluded_traversal(csync->excludes, "/excludepath/withsubdir", CSYNC_FTW_TYPE_DIR);
  203. assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
  204. rc = csync_excluded_traversal(csync->excludes, "/excludepath/withsubdir", CSYNC_FTW_TYPE_FILE);
  205. assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
  206. rc = csync_excluded_traversal(csync->excludes, "/excludepath/withsubdir2", CSYNC_FTW_TYPE_DIR);
  207. assert_int_equal(rc, CSYNC_NOT_EXCLUDED);
  208. rc = csync_excluded_traversal(csync->excludes, "/excludepath/withsubdir/foo", CSYNC_FTW_TYPE_DIR);
  209. assert_int_equal(rc, CSYNC_NOT_EXCLUDED); // because leading dirs aren't checked!
  210. }
  211. static void check_csync_pathes(void **state)
  212. {
  213. CSYNC *csync = (CSYNC*)*state;
  214. int rc;
  215. _csync_exclude_add( &(csync->excludes), "/exclude" );
  216. /* Check toplevel dir, the pattern only works for toplevel dir. */
  217. rc = csync_excluded_no_ctx(csync->excludes, "/exclude", CSYNC_FTW_TYPE_DIR);
  218. assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
  219. rc = csync_excluded_no_ctx(csync->excludes, "/foo/exclude", CSYNC_FTW_TYPE_DIR);
  220. assert_int_equal(rc, CSYNC_NOT_EXCLUDED);
  221. /* check for a file called exclude. Must still work */
  222. rc = csync_excluded_no_ctx(csync->excludes, "/exclude", CSYNC_FTW_TYPE_FILE);
  223. assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
  224. rc = csync_excluded_no_ctx(csync->excludes, "/foo/exclude", CSYNC_FTW_TYPE_FILE);
  225. assert_int_equal(rc, CSYNC_NOT_EXCLUDED);
  226. /* Add an exclude for directories only: excl/ */
  227. _csync_exclude_add( &(csync->excludes), "excl/" );
  228. rc = csync_excluded_no_ctx(csync->excludes, "/excl", CSYNC_FTW_TYPE_DIR);
  229. assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
  230. rc = csync_excluded_no_ctx(csync->excludes, "meep/excl", CSYNC_FTW_TYPE_DIR);
  231. assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
  232. rc = csync_excluded_no_ctx(csync->excludes, "meep/excl/file", CSYNC_FTW_TYPE_FILE);
  233. assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
  234. rc = csync_excluded_no_ctx(csync->excludes, "/excl", CSYNC_FTW_TYPE_FILE);
  235. assert_int_equal(rc, CSYNC_NOT_EXCLUDED);
  236. _csync_exclude_add(&csync->excludes, "/excludepath/withsubdir");
  237. rc = csync_excluded_no_ctx(csync->excludes, "/excludepath/withsubdir", CSYNC_FTW_TYPE_DIR);
  238. assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
  239. rc = csync_excluded_no_ctx(csync->excludes, "/excludepath/withsubdir", CSYNC_FTW_TYPE_FILE);
  240. assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
  241. rc = csync_excluded_no_ctx(csync->excludes, "/excludepath/withsubdir2", CSYNC_FTW_TYPE_DIR);
  242. assert_int_equal(rc, CSYNC_NOT_EXCLUDED);
  243. rc = csync_excluded_no_ctx(csync->excludes, "/excludepath/withsubdir/foo", CSYNC_FTW_TYPE_DIR);
  244. assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
  245. }
  246. static void check_csync_is_windows_reserved_word(void **) {
  247. assert_true(csync_is_windows_reserved_word("CON"));
  248. assert_true(csync_is_windows_reserved_word("con"));
  249. assert_true(csync_is_windows_reserved_word("CON."));
  250. assert_true(csync_is_windows_reserved_word("con."));
  251. assert_true(csync_is_windows_reserved_word("CON.ference"));
  252. assert_false(csync_is_windows_reserved_word("CONference"));
  253. assert_false(csync_is_windows_reserved_word("conference"));
  254. assert_false(csync_is_windows_reserved_word("conf.erence"));
  255. assert_false(csync_is_windows_reserved_word("co"));
  256. assert_true(csync_is_windows_reserved_word("A:"));
  257. assert_true(csync_is_windows_reserved_word("a:"));
  258. assert_true(csync_is_windows_reserved_word("z:"));
  259. assert_true(csync_is_windows_reserved_word("Z:"));
  260. assert_true(csync_is_windows_reserved_word("M:"));
  261. assert_true(csync_is_windows_reserved_word("m:"));
  262. }
  263. static void check_csync_excluded_performance(void **state)
  264. {
  265. CSYNC *csync = (CSYNC*)*state;
  266. const int N = 10000;
  267. int totalRc = 0;
  268. int i = 0;
  269. // Being able to use QElapsedTimer for measurement would be nice...
  270. {
  271. struct timeval before, after;
  272. gettimeofday(&before, 0);
  273. for (i = 0; i < N; ++i) {
  274. totalRc += csync_excluded_no_ctx(csync->excludes, "/this/is/quite/a/long/path/with/many/components", CSYNC_FTW_TYPE_DIR);
  275. totalRc += csync_excluded_no_ctx(csync->excludes, "/1/2/3/4/5/6/7/8/9/10/11/12/13/14/15/16/17/18/19/20/21/22/23/24/25/26/27/29", CSYNC_FTW_TYPE_FILE);
  276. }
  277. assert_int_equal(totalRc, CSYNC_NOT_EXCLUDED); // mainly to avoid optimization
  278. gettimeofday(&after, 0);
  279. const double total = (after.tv_sec - before.tv_sec)
  280. + (after.tv_usec - before.tv_usec) / 1.0e6;
  281. const double perCallMs = total / 2 / N * 1000;
  282. printf("csync_excluded: %f ms per call\n", perCallMs);
  283. }
  284. {
  285. struct timeval before, after;
  286. gettimeofday(&before, 0);
  287. for (i = 0; i < N; ++i) {
  288. totalRc += csync_excluded_traversal(csync->excludes, "/this/is/quite/a/long/path/with/many/components", CSYNC_FTW_TYPE_DIR);
  289. totalRc += csync_excluded_traversal(csync->excludes, "/1/2/3/4/5/6/7/8/9/10/11/12/13/14/15/16/17/18/19/20/21/22/23/24/25/26/27/29", CSYNC_FTW_TYPE_FILE);
  290. }
  291. assert_int_equal(totalRc, CSYNC_NOT_EXCLUDED); // mainly to avoid optimization
  292. gettimeofday(&after, 0);
  293. const double total = (after.tv_sec - before.tv_sec)
  294. + (after.tv_usec - before.tv_usec) / 1.0e6;
  295. const double perCallMs = total / 2 / N * 1000;
  296. printf("csync_excluded_traversal: %f ms per call\n", perCallMs);
  297. }
  298. }
  299. static void check_csync_exclude_expand_escapes(void **state)
  300. {
  301. (void)state;
  302. const char *str = csync_exclude_expand_escapes(
  303. "keep \\' \\\" \\? \\\\ \\a \\b \\f \\n \\r \\t \\v \\z \\#");
  304. assert_true(0 == strcmp(
  305. str, "keep ' \" ? \\ \a \b \f \n \r \t \v \\z #"));
  306. SAFE_FREE(str);
  307. str = csync_exclude_expand_escapes("");
  308. assert_true(0 == strcmp(str, ""));
  309. SAFE_FREE(str);
  310. str = csync_exclude_expand_escapes("\\");
  311. assert_true(0 == strcmp(str, "\\"));
  312. SAFE_FREE(str);
  313. }
  314. int torture_run_tests(void)
  315. {
  316. const struct CMUnitTest tests[] = {
  317. cmocka_unit_test_setup_teardown(check_csync_exclude_add, setup, teardown),
  318. cmocka_unit_test_setup_teardown(check_csync_exclude_load, setup, teardown),
  319. cmocka_unit_test_setup_teardown(check_csync_excluded, setup_init, teardown),
  320. cmocka_unit_test_setup_teardown(check_csync_excluded_traversal, setup_init, teardown),
  321. cmocka_unit_test_setup_teardown(check_csync_pathes, setup_init, teardown),
  322. cmocka_unit_test_setup_teardown(check_csync_is_windows_reserved_word, setup_init, teardown),
  323. cmocka_unit_test_setup_teardown(check_csync_excluded_performance, setup_init, teardown),
  324. cmocka_unit_test(check_csync_exclude_expand_escapes),
  325. };
  326. return cmocka_run_group_tests(tests, NULL, NULL);
  327. }