Browse code

avoid misleading message when unit tests are disabled (bb #1090) fix some compiler warnings

git-svn: trunk@3933

Török Edvin authored on 2008/07/10 22:29:32
Showing 5 changed files
... ...
@@ -1,3 +1,9 @@
1
+Thu Jul 10 16:02:50 EEST 2008 (edwin)
2
+------------------------------------
3
+ * unit_tests/:
4
+	avoid misleading message when unit tests are disabled (bb #1090)
5
+	fix some compiler warnings
6
+
1 7
 Tue Jul  8 21:33:32 EEST 2008 (edwin)
2 8
 -------------------------------------
3 9
   * libclamav/Makefile.am, libclamav/jsparse, unit_test/:
... ...
@@ -7,8 +7,9 @@
7 7
 #ifndef HAVE_CHECK
8 8
 int main(int argc, char **argv)
9 9
 {
10
-    printf("Unit tests disabled in build\n");
11
-    return 0;
10
+    puts("\n*** Unit tests disabled in this build\n*** Use ./configure --enable-check to enable them\n");
11
+    /* tell automake the test was skipped */
12
+    return 77;
12 13
 }
13 14
 #else
14 15
 
... ...
@@ -19,6 +20,7 @@ int main(int argc, char **argv)
19 19
 #include "../libclamav/clamav.h"
20 20
 #include "../libclamav/others.h"
21 21
 #include "../libclamav/matcher.h"
22
+#include "checks.h"
22 23
 
23 24
 /* extern void cl_free(struct cl_engine *engine); */
24 25
 START_TEST (test_cl_free)
... ...
@@ -307,7 +309,6 @@ int main(int argc, char **argv)
307 307
     srunner_run_all(sr, CK_NORMAL);
308 308
     nf = srunner_ntests_failed(sr);
309 309
     srunner_free(sr);
310
-
311 310
     return (nf == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
312 311
 }
313 312
 
... ...
@@ -16,6 +16,7 @@
16 16
 #include "../libclamav/jsparse/textbuf.h"
17 17
 #include "../libclamav/jsparse/generated/keywords.h"
18 18
 #include "../libclamav/jsparse/generated/operators.h"
19
+#include "checks.h"
19 20
 
20 21
 struct test {
21 22
 	const char *str;
... ...
@@ -150,8 +151,6 @@ START_TEST (test_init_parse_destroy)
150 150
 }
151 151
 END_TEST
152 152
 
153
-
154
-Suite *test_jsnorm_suite(void);
155 153
 Suite *test_jsnorm_suite(void)
156 154
 {
157 155
     Suite *s = suite_create("jsnorm");
... ...
@@ -13,6 +13,7 @@
13 13
 #include "../libclamav/others.h"
14 14
 #include "../libclamav/str.h"
15 15
 #include "../libclamav/jsparse/textbuf.h"
16
+#include "checks.h"
16 17
 
17 18
 START_TEST (test_unescape_simple)
18 19
 {
... ...
@@ -120,7 +121,6 @@ START_TEST (test_normalize)
120 120
 }
121 121
 END_TEST
122 122
 
123
-Suite *test_str_suite(void);
124 123
 Suite *test_str_suite(void)
125 124
 {
126 125
     Suite *s = suite_create("str");
127 126
new file mode 100644
... ...
@@ -0,0 +1,5 @@
0
+#ifndef CHECKS_H
1
+#define CHECKS_H
2
+Suite *test_jsnorm_suite(void);
3
+Suite *test_str_suite(void);
4
+#endif