]> source.dussan.org Git - rspamd.git/commitdiff
[Test] Fighting with windmills in robot
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 4 Nov 2020 13:18:43 +0000 (13:18 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 4 Nov 2020 13:18:43 +0000 (13:18 +0000)
src/libserver/composites.c
test/functional/cases/109_composites.robot
test/functional/configs/composites.conf

index 9f7f548ab6a4d5c73804912bde95580d07fe73ce..f3c25d1bc105130335b739ea5b69f84d976429b9 100644 (file)
@@ -460,12 +460,19 @@ rspamd_composite_process_single_symbol (struct composites_data *cd,
 
 
                        if (!found) {
-                               msg_debug_composites ("symbol %s in composite %s misses required option %s",
-                                               sym,
-                                               cd->composite->sym,
-                                               (cur_opt->type == RSPAMD_COMPOSITE_OPTION_PLAIN ?
-                                                 cur_opt->data.match :
-                                                 rspamd_regexp_get_pattern (cur_opt->data.re)));
+                               if (cur_opt->type == RSPAMD_COMPOSITE_OPTION_PLAIN) {
+                                       msg_debug_composites ("symbol %s in composite %s misses required option %s",
+                                                       sym,
+                                                       cd->composite->sym,
+                                                       cur_opt->data.match);
+                               }
+                               else {
+                                       msg_debug_composites ("symbol %s in composite %s failed to match regexp %s",
+                                                       sym,
+                                                       cd->composite->sym,
+                                                       rspamd_regexp_get_pattern (cur_opt->data.re));
+                               }
+
                                ms = NULL;
 
                                break;
index 8da18fe977bb88244d1534e6c44ddd48f7cbe483..4fb3aee3dd5c145732ad8c7bdab3c32f4bf618b6 100644 (file)
@@ -51,13 +51,22 @@ Composites - Opts RE Miss one
   Scan File  ${MESSAGE}  opts=sym1,foo1
   Expect Symbol With Score  SYMOPTS1  5.00
   Do Not Expect Symbol  SYMOPTS2
+  Do Not Expect Symbol  SYMOPTS3
 
 Composites - Opts RE Miss both
   Scan File  ${MESSAGE}  opts=sym2
   Do Not Expect Symbol  SYMOPTS1
   Do Not Expect Symbol  SYMOPTS2
+  Do Not Expect Symbol  SYMOPTS3
 
 Composites - Opts RE Hit
-  Scan File  ${MESSAGE}  opts=sym2,foo1
+  Scan File  ${MESSAGE}  opts=foo1,sym2
   Expect Symbol With Score  SYMOPTS2  6.00
   Do Not Expect Symbol  SYMOPTS1
+  Do Not Expect Symbol  SYMOPTS3
+
+Composites - Opts RE Hit 2
+  Scan File  ${MESSAGE}  opts=foo/,sym2
+  Expect Symbol With Score  SYMOPTS3  6.00
+  Do Not Expect Symbol  SYMOPTS2
+  Do Not Expect Symbol  SYMOPTS1
index 932b25fc1e41b68de5d15232d5ba853074b0b841..d57e09818d2e16ea38ce5645cdec2d2838aa0a3c 100644 (file)
@@ -73,7 +73,11 @@ composites {
     }
 
     SYMOPTS2 {
-      expression = "OPTS[/foo.*/,sym2]";
+      expression = 'OPTS[/foo[0-9]/,sym2]';
+      score = 6.0;
+    }
+    SYMOPTS3 {
+      expression = 'OPTS[sym2,/FoO\\//i]';
       score = 6.0;
     }
 }