This is an automated email from the ASF dual-hosted git repository.
mochen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new e09e8312a4 Use single regex match for regression tests (#12587)
e09e8312a4 is described below
commit e09e8312a483261bdefa219641529e42ee5dfd24
Author: Mo Chen <[email protected]>
AuthorDate: Mon Oct 20 17:26:15 2025 -0500
Use single regex match for regression tests (#12587)
This use case requires matching a single regex. DFA is meant for multiple
regex matching.
---
include/tscore/Regression.h | 2 +-
src/tscore/Regression.cc | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/tscore/Regression.h b/include/tscore/Regression.h
index a7350a2484..87e334403f 100644
--- a/include/tscore/Regression.h
+++ b/include/tscore/Regression.h
@@ -76,7 +76,7 @@ struct RegressionTest {
static int final_status;
static int ran_tests;
- static DFA dfa;
+ static Regex regex;
static RegressionTest *current;
static int run(const char *name, int regression_level);
static void list();
diff --git a/src/tscore/Regression.cc b/src/tscore/Regression.cc
index 9954dd777e..b3aeb2a877 100644
--- a/src/tscore/Regression.cc
+++ b/src/tscore/Regression.cc
@@ -40,7 +40,7 @@ static RegressionTest *exclusive_test = nullptr;
RegressionTest *RegressionTest::current = nullptr;
int RegressionTest::ran_tests = 0;
-DFA RegressionTest::dfa;
+Regex RegressionTest::regex;
int RegressionTest::final_status = REGRESSION_TEST_PASSED;
static const char *
@@ -94,15 +94,15 @@ int
RegressionTest::run(const char *atest, int regression_level)
{
if (atest) {
- dfa.compile(atest);
+ regex.compile(atest);
} else {
- dfa.compile(".*");
+ regex.compile(".*");
}
fprintf(stderr, "REGRESSION_TEST initialization begun\n");
// start the non exclusive tests
for (RegressionTest *t = test; t; t = t->next) {
- if ((dfa.match(t->name) >= 0)) {
+ if (regex.exec(t->name, RE_ANCHORED)) {
int res = start_test(t, regression_level);
if (res == REGRESSION_TEST_FAILED) {
final_status = REGRESSION_TEST_FAILED;
@@ -153,7 +153,7 @@ RegressionTest::run_some(int regression_level)
}
for (; current; current = current->next) {
- if ((dfa.match(current->name) >= 0)) {
+ if (regex.exec(current->name, RE_ANCHORED)) {
int res = start_test(current, regression_level);
if (res == REGRESSION_TEST_INPROGRESS) {
return res;