Skip to content

Commit ad13761

Browse files
jnthntatumcopybara-github
authored andcommitted
Add memory test for managed constant folding arena
PiperOrigin-RevId: 926250668
1 parent db0725c commit ad13761

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

eval/tests/memory_safety_test.cc

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,12 @@ struct TestCase {
5151
bool reference_resolver_enabled = false;
5252
};
5353

54-
enum Options { kDefault, kExhaustive, kFoldConstants };
54+
enum Options {
55+
kDefault,
56+
kExhaustive,
57+
kFoldConstants,
58+
kFoldConstantsManagedArena
59+
};
5560

5661
using ParamType = std::tuple<TestCase, Options>;
5762

@@ -68,6 +73,9 @@ std::string TestCaseName(const testing::TestParamInfo<ParamType>& param_info) {
6873
case Options::kFoldConstants:
6974
opt = "opt";
7075
break;
76+
case Options::kFoldConstantsManagedArena:
77+
opt = "opt_managed_arena";
78+
break;
7179
}
7280

7381
return absl::StrCat(std::get<0>(param).name, "_", opt);
@@ -110,6 +118,14 @@ class EvaluatorMemorySafetyTest : public testing::TestWithParam<ParamType> {
110118
options.enable_comprehension_vulnerability_check = false;
111119
options.short_circuiting = true;
112120
break;
121+
case Options::kFoldConstantsManagedArena:
122+
options.enable_regex_precompilation = true;
123+
options.constant_folding = true;
124+
options.enable_comprehension_list_append = true;
125+
options.enable_comprehension_vulnerability_check = false;
126+
options.short_circuiting = true;
127+
options.constant_arena = nullptr;
128+
break;
113129
}
114130

115131
options.enable_qualified_identifier_rewrites =
@@ -295,7 +311,8 @@ INSTANTIATE_TEST_SUITE_P(
295311
test::IsCelBool(true),
296312
}}),
297313
testing::Values(Options::kDefault, Options::kExhaustive,
298-
Options::kFoldConstants)),
314+
Options::kFoldConstants,
315+
Options::kFoldConstantsManagedArena)),
299316
&TestCaseName);
300317

301318
} // namespace

0 commit comments

Comments
 (0)