mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-29 19:24:29 +03:00
Added support to run unit tests in a multithreaded context
- 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 #3215.
This commit is contained in:
@@ -25,6 +25,12 @@
|
||||
|
||||
namespace modsecurity_test {
|
||||
|
||||
class UnitTestResult {
|
||||
public:
|
||||
int ret;
|
||||
std::string output;
|
||||
};
|
||||
|
||||
class UnitTest {
|
||||
public:
|
||||
static UnitTest *from_yajl_node(const yajl_val &);
|
||||
@@ -39,9 +45,8 @@ class UnitTest {
|
||||
std::string filename;
|
||||
std::string output;
|
||||
int ret;
|
||||
int obtained;
|
||||
int skipped;
|
||||
std::string obtainedOutput;
|
||||
UnitTestResult result;
|
||||
};
|
||||
|
||||
} // namespace modsecurity_test
|
||||
|
Reference in New Issue
Block a user