Skip to content

Commit 2aa3848

Browse files
committed
change probe expression for mocking
expression with 'IF' requires larger stack then previously used 'OR'. That is critical for overall stability, and, specifically, for stability of ubertest 294 ref: #3793
1 parent fc1e275 commit 2aa3848

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/stackmock.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,17 @@ class CreateExprStackSize_c final : public StackMeasurer_c
132132
void BuildMockExpr ( int iComplexity ) final
133133
{
134134
m_sExpr.Clear();
135-
m_sExpr << "((attr_a=0)*1)";
135+
m_sExpr << "IF(attr_a IN(0,1),10,";
136136

137-
for ( int i = 1; i<iComplexity+1; ++i ) // ((attr_a=0)*1) + ((attr_b=1)*3) + ((attr_b=2)*5) + ...
138-
m_sExpr << "+((attr_b=" << i << ")*" << i * 2+1 << ")";
137+
for ( int i = 1; i<iComplexity+1; ++i )
138+
m_sExpr << "IF(attr_a IN(" << i << "," << i+1 << ")," << (i+1)*10 << ",";
139+
m_sExpr << (iComplexity+2)*10 << ")";
140+
for ( int i = 0; i<iComplexity; ++i )
141+
m_sExpr << ")";
142+
143+
//IF(a IN(0,1),10,20)
144+
//IF(a IN(0,1),10,IF(a IN(1,2),20,30))
145+
//IF(a IN(0,1),10,IF(a IN(1,2),20,IF(a IN(2,3),30,40))) ...
139146
}
140147

141148
ATTRIBUTE_NO_SANITIZE_ADDRESS void MockParseTest () final
@@ -154,8 +161,6 @@ class CreateExprStackSize_c final : public StackMeasurer_c
154161
tAttr.m_eAttrType = SPH_ATTR_INTEGER;
155162
tAttr.m_sName = "attr_a";
156163
tParams.m_tSchema.AddAttr ( tAttr, false );
157-
tAttr.m_sName = "attr_b";
158-
tParams.m_tSchema.AddAttr ( tAttr, false );
159164

160165
tParams.m_sExpr = m_sExpr.cstr();
161166

0 commit comments

Comments
 (0)