Browse code

Unit-tests need to call cl_init, otherwise mkdir can fail randomly.

Török Edvin authored on 2009/10/27 02:01:56
Showing 2 changed files
... ...
@@ -31,6 +31,7 @@ static char *dir;
31 31
 
32 32
 static void htmlnorm_setup(void)
33 33
 {
34
+        cl_init(CL_INIT_DEFAULT);
34 35
 	dconf_setup();
35 36
 	dir = cli_gentemp(NULL);
36 37
 	fail_unless(!!dir, "cli_gentemp failed");
... ...
@@ -31,6 +31,7 @@
31 31
 #include <check.h>
32 32
 #include <fcntl.h>
33 33
 #include <ctype.h>
34
+#include <errno.h>
34 35
 #include "../libclamav/clamav.h"
35 36
 #include "../libclamav/others.h"
36 37
 #include "../libclamav/dconf.h"
... ...
@@ -207,11 +208,12 @@ static char *tmpdir = NULL;
207 207
 
208 208
 static void jstest_setup(void)
209 209
 {
210
+        cl_init(CL_INIT_DEFAULT);
210 211
 	state = cli_js_init();
211 212
 	fail_unless(!!state, "js init");
212 213
 	tmpdir = cli_gentemp(NULL);
213 214
 	fail_unless(!!tmpdir,"js tmp dir");
214
-	fail_unless(mkdir(tmpdir, 0700) == 0, "tempdir mkdir");
215
+	fail_unless_fmt(mkdir(tmpdir, 0700) == 0, "tempdir mkdir of %s failed: %s", tmpdir, strerror(errno));
215 216
 }
216 217
 
217 218
 static void jstest_teardown(void)