mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-30 03:34: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:
@@ -34,12 +34,13 @@ template <class T> class ModSecurityTest :
|
||||
ModSecurityTest()
|
||||
: m_test_number(0),
|
||||
m_automake_output(false),
|
||||
m_count_all(false) { }
|
||||
m_count_all(false),
|
||||
m_test_multithreaded(false) { }
|
||||
|
||||
std::string header();
|
||||
void cmd_options(int, char **);
|
||||
std::pair<std::string, std::vector<T *>>* load_tests();
|
||||
std::pair<std::string, std::vector<T *>>* load_tests(const std::string &path);
|
||||
void load_tests();
|
||||
void load_tests(const std::string &path);
|
||||
bool load_test_json(const std::string &file);
|
||||
|
||||
std::string target;
|
||||
@@ -48,6 +49,7 @@ template <class T> class ModSecurityTest :
|
||||
int m_test_number;
|
||||
bool m_automake_output;
|
||||
bool m_count_all;
|
||||
bool m_test_multithreaded;
|
||||
};
|
||||
|
||||
} // namespace modsecurity_test
|
||||
|
Reference in New Issue
Block a user