~ubuntu-branches/ubuntu/saucy/clamav/saucy-backports

« back to all changes in this revision

Viewing changes to debian/patches/0002-Sebastian-Andrzej-Siewior.patch

  • Committer: Package Import Robot
  • Author(s): Scott Kitterman
  • Date: 2014-07-15 01:08:10 UTC
  • mfrom: (0.35.47 sid)
  • Revision ID: package-import@ubuntu.com-20140715010810-ru66ek4fun2iseba
Tags: 0.98.4+dfsg-2~ubuntu13.10.1
No-change backport to saucy (LP: #1341962)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
From 2493e18d6facdf0363bdb0933238e0061dacf9d5 Mon Sep 17 00:00:00 2001
2
 
From: Scott Kitterman <scott@kitterman.com>
3
 
Date: Mon, 10 Mar 2014 19:28:15 -0400
4
 
Subject: =?UTF-8?q?=20=20[=20Sebastian=20Andrzej=20Siewior=20]=0A=20=20*?=
5
 
 =?UTF-8?q?=20unit=5Ftest:=20check=5Fclamav:=20skip=20.rar=20files=20if=20?=
6
 
 =?UTF-8?q?there=20is=20no=20rar=20support=20to=20fix=0A=20=20=20=20test?=
7
 
 =?UTF-8?q?=20failure=20(and=20FTBFS)=20when=20tests=20are=20run?=
8
 
 
9
 
---
10
 
 unit_tests/check_clamav.c | 50 +++++++++++++++++++++++++++++++++++------------
11
 
 1 file changed, 37 insertions(+), 13 deletions(-)
12
 
 
13
 
diff --git a/unit_tests/check_clamav.c b/unit_tests/check_clamav.c
14
 
index 3473082..3ccd5d5 100644
15
 
--- a/unit_tests/check_clamav.c
16
 
+++ b/unit_tests/check_clamav.c
17
 
@@ -361,9 +361,24 @@ static const int expected_testfiles = 48;
18
 
 static const int expected_testfiles = 46;
19
 
 #endif
20
 
 
21
 
+static unsigned skip_unrar_files(void)
22
 
+{
23
 
+       const char *s = getenv("unrar_disabled");
24
 
+
25
 
+       if (!s)
26
 
+               return 0;
27
 
+
28
 
+       if (strcmp(s, "1"))
29
 
+               return 0;
30
 
+
31
 
+       /* number of .rar files we skipp */
32
 
+       return 2;
33
 
+}
34
 
+
35
 
 static void init_testfiles(void)
36
 
 {
37
 
     struct dirent *dirent;
38
 
+    int expect = expected_testfiles;
39
 
     unsigned i = 0;
40
 
 
41
 
     DIR *d = opendir(OBJDIR"/../test");
42
 
@@ -375,13 +390,18 @@ static void init_testfiles(void)
43
 
     while ((dirent = readdir(d))) {
44
 
        if (strncmp(dirent->d_name, "clam", 4))
45
 
            continue;
46
 
+       if (strstr(dirent->d_name, ".rar") && skip_unrar_files()) {
47
 
+               cli_dbgmsg("skipping (no unrar) %s\n", dirent->d_name);
48
 
+               continue;
49
 
+       }
50
 
        i++;
51
 
        testfiles = cli_realloc(testfiles, i*sizeof(*testfiles));
52
 
        fail_unless(!!testfiles, "cli_realloc");
53
 
        testfiles[i-1] = strdup(dirent->d_name);
54
 
     }
55
 
     testfiles_n = i;
56
 
-    fail_unless_fmt(testfiles_n == expected_testfiles, "testfiles: %d != %d", testfiles_n, expected_testfiles);
57
 
+    expect -= skip_unrar_files();
58
 
+    fail_unless_fmt(testfiles_n == expect, "testfiles: %d != %d", testfiles_n, expect);
59
 
 
60
 
     closedir(d);
61
 
 }
62
 
@@ -560,6 +580,8 @@ END_TEST
63
 
 
64
 
 static Suite *test_cl_suite(void)
65
 
 {
66
 
+    int expect = expected_testfiles;
67
 
+
68
 
     Suite *s = suite_create("cl_api");
69
 
     TCase *tc_cl = tcase_create("cl_dup");
70
 
     TCase *tc_cl_scan = tcase_create("cl_scan");
71
 
@@ -585,18 +607,20 @@ static Suite *test_cl_suite(void)
72
 
     suite_add_tcase(s, tc_cl_scan);
73
 
     tcase_add_checked_fixture (tc_cl_scan, engine_setup, engine_teardown);
74
 
 #ifdef CHECK_HAVE_LOOPS
75
 
-    tcase_add_loop_test(tc_cl_scan, test_cl_scandesc, 0, expected_testfiles);
76
 
-    tcase_add_loop_test(tc_cl_scan, test_cl_scandesc_allscan, 0, expected_testfiles);
77
 
-    tcase_add_loop_test(tc_cl_scan, test_cl_scanfile, 0, expected_testfiles);
78
 
-    tcase_add_loop_test(tc_cl_scan, test_cl_scanfile_allscan, 0, expected_testfiles);
79
 
-    tcase_add_loop_test(tc_cl_scan, test_cl_scandesc_callback, 0, expected_testfiles);
80
 
-    tcase_add_loop_test(tc_cl_scan, test_cl_scandesc_callback_allscan, 0, expected_testfiles);
81
 
-    tcase_add_loop_test(tc_cl_scan, test_cl_scanfile_callback, 0, expected_testfiles);
82
 
-    tcase_add_loop_test(tc_cl_scan, test_cl_scanfile_callback_allscan, 0, expected_testfiles);
83
 
-    tcase_add_loop_test(tc_cl_scan, test_cl_scanmap_callback_handle, 0, expected_testfiles);
84
 
-    tcase_add_loop_test(tc_cl_scan, test_cl_scanmap_callback_handle_allscan, 0, expected_testfiles);
85
 
-    tcase_add_loop_test(tc_cl_scan, test_cl_scanmap_callback_mem, 0, expected_testfiles);
86
 
-    tcase_add_loop_test(tc_cl_scan, test_cl_scanmap_callback_mem_allscan, 0, expected_testfiles);
87
 
+    expect -= skip_unrar_files();
88
 
+
89
 
+    tcase_add_loop_test(tc_cl_scan, test_cl_scandesc, 0, expect);
90
 
+    tcase_add_loop_test(tc_cl_scan, test_cl_scandesc_allscan, 0, expect);
91
 
+    tcase_add_loop_test(tc_cl_scan, test_cl_scanfile, 0, expect);
92
 
+    tcase_add_loop_test(tc_cl_scan, test_cl_scanfile_allscan, 0, expect);
93
 
+    tcase_add_loop_test(tc_cl_scan, test_cl_scandesc_callback, 0, expect);
94
 
+    tcase_add_loop_test(tc_cl_scan, test_cl_scandesc_callback_allscan, 0, expect);
95
 
+    tcase_add_loop_test(tc_cl_scan, test_cl_scanfile_callback, 0, expect);
96
 
+    tcase_add_loop_test(tc_cl_scan, test_cl_scanfile_callback_allscan, 0, expect);
97
 
+    tcase_add_loop_test(tc_cl_scan, test_cl_scanmap_callback_handle, 0, expect);
98
 
+    tcase_add_loop_test(tc_cl_scan, test_cl_scanmap_callback_handle_allscan, 0, expect);
99
 
+    tcase_add_loop_test(tc_cl_scan, test_cl_scanmap_callback_mem, 0, expect);
100
 
+    tcase_add_loop_test(tc_cl_scan, test_cl_scanmap_callback_mem_allscan, 0, expect);
101
 
 #endif
102
 
     return s;
103
 
 }