commit d8a0164: [Test] Fighting with windmills in robot
Vsevolod Stakhov
vsevolod at highsecure.ru
Wed Nov 4 13:21:06 UTC 2020
Author: Vsevolod Stakhov
Date: 2020-11-04 13:18:43 +0000
URL: https://github.com/rspamd/rspamd/commit/d8a0164440b870622636184076a73e679ce52d3d (HEAD -> master)
[Test] Fighting with windmills in robot
---
src/libserver/composites.c | 19 +++++++++++++------
test/functional/cases/109_composites.robot | 11 ++++++++++-
test/functional/configs/composites.conf | 6 +++++-
3 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/src/libserver/composites.c b/src/libserver/composites.c
index 9f7f548ab..f3c25d1bc 100644
--- a/src/libserver/composites.c
+++ b/src/libserver/composites.c
@@ -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;
diff --git a/test/functional/cases/109_composites.robot b/test/functional/cases/109_composites.robot
index 8da18fe97..4fb3aee3d 100644
--- a/test/functional/cases/109_composites.robot
+++ b/test/functional/cases/109_composites.robot
@@ -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
diff --git a/test/functional/configs/composites.conf b/test/functional/configs/composites.conf
index 932b25fc1..d57e09818 100644
--- a/test/functional/configs/composites.conf
+++ b/test/functional/configs/composites.conf
@@ -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;
}
}
More information about the Commits
mailing list