Add support to run unit tests in a multithreaded context - #3221
Conversation
|
All operator & transformation unit tests were executed using this feature and no issue was detected. NOTE: This doesn't guarantee that there's no multithreading issue lurking in there, though. |
7a6052a to
b67bc19
Compare
- This is controlled by specifying the 'mtstress' argument when running
`unit_test`.
- The goal is to detect if the operator/transformation fails in this
context.
- In this mode, the test will be executed 5'000 times in 50 threads
concurrently.
- Allocation & initialization of the operator/transformation is
performed once in the main thread, while the evaluation is executed in
the threads.
- This is consistent with the library's support for multithreading,
where initialization and loading of rules is expected to run once.
See issue owasp-modsecurity#3215.
b67bc19 to
ee5f95e
Compare
|
|
Thanks, @eduar-hte! A reminder to me: 11 tests are failed, I have to check the reason. |
I think you're referring to these unit tests: I remember looking into this while working on the Windows port (PR #3132), because when I run These tests were added to in owasp-modsecurity/secrules-language-tests@a3d4405 and are related to PR #2387, which I understand is a v3.1 feature. |
yes, exactly.
yes, I also wondered why this haven't appeared yet
ah, thanks - I hadn't time to review the history, but yes, this explains the behavior. Seems like the tests had already added but the transformation not. I think we can remove this test file. Thanks for helping discovery the situation. |
If you don't want to remove it, you could update the submodule reference in |
Submitted PR owasp-modsecurity/secrules-language-tests#10 to remove the tests associated to this missing transformation. |



what
The
unit_testprogram has been updated to accept themtstressargument to run operator/transformation tests in a multithreaded context.why
The goal is to detect if the operator/transformation fails in this context.
misc
references
This work is related to #3215, to check whether the optional mutex on the Pm operator to access
acmptrees is needed.This was introduced in commit 119a6fc & 7d786b3 likely because of issue #1573. This option is off by default and it's not clear whether it's necessary, as stated here.