1 #include <check.h>
2 #include <stdlib.h>
3 #include "test.h"
4
5 #if defined(HAVE_WIN32)
6 #define main UtestMain
7 #endif
main(int argc,char * argv[],char * envp[])8 int main(int argc, char *argv[], char *envp[])
9 {
10 int number_failed;
11 SRunner *sr;
12 #ifdef HAVE_NCURSES
13 int valgrind=0;
14
15 for(char **env=envp; *env; env++)
16 {
17 if(strstr(*env, "valgrind"))
18 {
19 valgrind=1;
20 break;
21 }
22 }
23 #endif
24
25 sr=srunner_create(NULL);
26
27 srunner_add_suite(sr, suite_alloc());
28 srunner_add_suite(sr, suite_base64());
29 #ifdef HAVE_ACL
30 #ifndef HAVE_DARWIN_OS
31 srunner_add_suite(sr, suite_client_acl());
32 #endif
33 #endif
34 srunner_add_suite(sr, suite_client_auth());
35 #ifdef HAVE_ACL
36 srunner_add_suite(sr, suite_client_extra_comms());
37 #ifdef HAVE_XATTR
38 srunner_add_suite(sr, suite_client_extrameta());
39 #endif
40 #endif
41 srunner_add_suite(sr, suite_client_monitor_lline());
42 #ifdef HAVE_XATTR
43 srunner_add_suite(sr, suite_client_protocol2_rabin_read());
44 srunner_add_suite(sr, suite_client_xattr());
45 #endif
46 srunner_add_suite(sr, suite_cmd());
47 srunner_add_suite(sr, suite_conf());
48 srunner_add_suite(sr, suite_fzp());
49 srunner_add_suite(sr, suite_hexmap());
50 srunner_add_suite(sr, suite_pathcmp());
51 srunner_add_suite(sr, suite_protocol1_handy());
52 srunner_add_suite(sr, suite_protocol1_rs_buf());
53 srunner_add_suite(sr, suite_protocol2_blist());
54 srunner_add_suite(sr, suite_protocol2_blk());
55 srunner_add_suite(sr, suite_protocol2_rabin_rabin());
56 srunner_add_suite(sr, suite_protocol2_rabin_rconf());
57 srunner_add_suite(sr, suite_protocol2_rabin_win());
58 srunner_add_suite(sr, suite_protocol2_sbuf_protocol2());
59 srunner_add_suite(sr, suite_slist());
60 srunner_add_suite(sr, suite_times());
61
62 #ifndef HAVE_WIN32
63 // These do not compile for Windows.
64 srunner_add_suite(sr, suite_client_delete());
65 srunner_add_suite(sr, suite_client_find());
66 #ifdef HAVE_NCURSES
67 if(!valgrind)
68 {
69 // These tests are unstable with valgrind. I think it is a
70 // race condition revealed by valgrind slowing things down.
71 srunner_add_suite(sr, suite_client_monitor_status_client_ncurses());
72 }
73 #endif
74 srunner_add_suite(sr, suite_client_monitor_json_input());
75 srunner_add_suite(sr, suite_lock());
76
77 // These compile for Windows, but do not run correctly and the whole
78 // utest process crashes out.
79 srunner_add_suite(sr, suite_asfd());
80 srunner_add_suite(sr, suite_client_monitor());
81 srunner_add_suite(sr, suite_client_protocol1_backup_phase2());
82 srunner_add_suite(sr, suite_client_protocol2_backup_phase2());
83 srunner_add_suite(sr, suite_client_restore());
84
85 // These compile for Windows, but have an error.
86 srunner_add_suite(sr, suite_attribs());
87 srunner_add_suite(sr, suite_conffile());
88
89 // These are server side only, so do not want to run them on Windows.
90 srunner_add_suite(sr, suite_server_auth());
91 srunner_add_suite(sr, suite_server_autoupgrade());
92 srunner_add_suite(sr, suite_server_ca());
93 srunner_add_suite(sr, suite_server_backup_phase3());
94 srunner_add_suite(sr, suite_server_bu_get());
95 srunner_add_suite(sr, suite_server_delete());
96 srunner_add_suite(sr, suite_server_extra_comms());
97 srunner_add_suite(sr, suite_server_list());
98 srunner_add_suite(sr, suite_server_manio());
99 srunner_add_suite(sr, suite_server_monitor_browse());
100 srunner_add_suite(sr, suite_server_monitor_cache());
101 srunner_add_suite(sr, suite_server_monitor_cstat());
102 srunner_add_suite(sr, suite_server_monitor_json_output());
103 srunner_add_suite(sr, suite_server_monitor_status_server());
104 srunner_add_suite(sr, suite_server_protocol1_backup_phase2());
105 srunner_add_suite(sr, suite_server_protocol1_backup_phase4());
106 srunner_add_suite(sr, suite_server_protocol1_bedup());
107 srunner_add_suite(sr, suite_server_protocol1_blocklen());
108 srunner_add_suite(sr, suite_server_protocol1_dpth());
109 srunner_add_suite(sr, suite_server_protocol1_fdirs());
110 srunner_add_suite(sr, suite_server_protocol1_restore());
111 srunner_add_suite(sr, suite_server_protocol2_backup_phase2());
112 srunner_add_suite(sr, suite_server_protocol2_backup_phase4());
113 srunner_add_suite(sr, suite_server_protocol2_bsparse());
114 srunner_add_suite(sr, suite_server_protocol2_champ_chooser_champ_chooser());
115 srunner_add_suite(sr,
116 suite_server_protocol2_champ_chooser_champ_server());
117 srunner_add_suite(sr, suite_server_protocol2_champ_chooser_dindex());
118 srunner_add_suite(sr, suite_server_protocol2_champ_chooser_hash());
119 srunner_add_suite(sr, suite_server_protocol2_champ_chooser_scores());
120 srunner_add_suite(sr, suite_server_protocol2_champ_chooser_sparse());
121 srunner_add_suite(sr, suite_server_protocol2_dpth());
122 srunner_add_suite(sr, suite_server_restore());
123 srunner_add_suite(sr, suite_server_resume());
124 srunner_add_suite(sr, suite_server_run_action());
125 srunner_add_suite(sr, suite_server_sdirs());
126 srunner_add_suite(sr, suite_server_timer());
127 #endif
128
129 srunner_run_all(sr, CK_ENV);
130 number_failed = srunner_ntests_failed(sr);
131 srunner_free(sr);
132 return number_failed == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
133 }
134