From: Sebastian Andrzej Siewior <[email protected]> Otherwise the testsuite will fail because we failed to detect the infected files hidden in .rar files. This patch removes .rar files from beeing scanned and decreases the number of files (currently we have two .rar files) which will be found/tested.
Signed-off-by: Sebastian Andrzej Siewior <[email protected]> --- unit_tests/check_clamav.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/unit_tests/check_clamav.c b/unit_tests/check_clamav.c index a44b001..8963cf4 100644 --- a/unit_tests/check_clamav.c +++ b/unit_tests/check_clamav.c @@ -384,6 +384,20 @@ static const int expected_testfiles = 48; static const int expected_testfiles = 46; #endif +static unsigned skip_unrar_files(void) +{ + const char *s = getenv("unrar_disabled"); + + if (!s) + return 0; + + if (strcmp(s, "1")) + return 0; + + /* number of .rar files we skipp */ + return 2; +} + static void init_testfiles(void) { struct dirent *dirent; @@ -399,6 +413,11 @@ static void init_testfiles(void) while ((dirent = readdir(d))) { if (strncmp(dirent->d_name, "clam", 4)) continue; + if (strstr(dirent->d_name, ".rar") && skip_unrar_files()) { + cli_dbgmsg("skipping (no unrar) %s\n", dirent->d_name); + continue; + } + i++; testfiles = cli_realloc(testfiles, i*sizeof(*testfiles)); fail_unless(!!testfiles, "cli_realloc"); @@ -407,6 +426,8 @@ static void init_testfiles(void) testfiles_n = i; if (get_fpu_endian() == FPU_ENDIAN_UNKNOWN) expect--; + expect -= skip_unrar_files(); + fail_unless_fmt(testfiles_n == expect, "testfiles: %d != %d", testfiles_n, expect); closedir(d); @@ -622,6 +643,8 @@ static Suite *test_cl_suite(void) #ifdef CHECK_HAVE_LOOPS if (get_fpu_endian() == FPU_ENDIAN_UNKNOWN) expect--; + expect -= skip_unrar_files(); + tcase_add_loop_test(tc_cl_scan, test_cl_scandesc, 0, expect); tcase_add_loop_test(tc_cl_scan, test_cl_scandesc_allscan, 0, expect); tcase_add_loop_test(tc_cl_scan, test_cl_scanfile, 0, expect); -- 1.7.10.4 _______________________________________________ http://lurker.clamav.net/list/clamav-devel.html Please submit your patches to our Bugzilla: http://bugs.clamav.net
