##// END OF EJS Templates
Fixes on fuzzing tests
Alexandre Leroux -
r1328:6015d1ab6800
parent child
Show More
@@ -67,14 +67,18 void FuzzingState::synchronizeVariable(VariableId variableId, SyncGroupId syncGr
67 return;
67 return;
68 }
68 }
69
69
70 // Registers variable into sync group: if it's the first variable, sets the variable range as
70 // Registers variable into sync group
71 // the sync group range
72 auto &syncGroup = m_SyncGroupsPool.at(syncGroupId);
71 auto &syncGroup = m_SyncGroupsPool.at(syncGroupId);
72 auto &variableState = m_VariablesPool.at(variableId);
73 syncGroup.m_Variables.insert(variableId);
73 syncGroup.m_Variables.insert(variableId);
74 if (syncGroup.m_Variables.size() == 1) {
74 if (syncGroup.m_Variables.size() == 1) {
75 auto &variableState = m_VariablesPool.at(variableId);
75 // If it's the first variable, sets the variable range as the sync group range
76 syncGroup.m_Range = variableState.m_Range;
76 syncGroup.m_Range = variableState.m_Range;
77 }
77 }
78 else {
79 // If a variable is added to an existing group, sets its range to the group's range
80 variableState.m_Range = syncGroup.m_Range;
81 }
78 }
82 }
79
83
80 void FuzzingState::desynchronizeVariable(VariableId variableId, SyncGroupId syncGroupId)
84 void FuzzingState::desynchronizeVariable(VariableId variableId, SyncGroupId syncGroupId)
@@ -97,13 +101,18 void FuzzingState::updateRanges(VariableId variableId, const SqpRange &newRange)
97 auto syncGroupId = this->syncGroupId(variableId);
101 auto syncGroupId = this->syncGroupId(variableId);
98
102
99 // Retrieves the variables to update:
103 // Retrieves the variables to update:
100 // - if the variable is synchronized to others, updates all synchronized variables
104 // - if the variable is synchronized to others, updates the range of the group and of all
105 // synchronized variables
101 // - otherwise, updates only the variable
106 // - otherwise, updates only the variable
102 auto variablesToUpdate = syncGroupId.isNull() ? std::set<VariableId>{variableId}
107 if (syncGroupId.isNull()) {
103 : m_SyncGroupsPool.at(syncGroupId).m_Variables;
104
105 // Sets new range
106 for (const auto &variableId : variablesToUpdate) {
107 m_VariablesPool.at(variableId).m_Range = newRange;
108 m_VariablesPool.at(variableId).m_Range = newRange;
108 }
109 }
110 else {
111 auto &syncGroup = m_SyncGroupsPool.at(syncGroupId);
112 syncGroup.m_Range = newRange;
113
114 for (const auto &variableId : syncGroup.m_Variables) {
115 m_VariablesPool.at(variableId).m_Range = newRange;
116 }
117 }
109 }
118 }
@@ -176,6 +176,9 struct SynchronizeOperation : public IFuzzingOperation {
176
176
177 // Updates state
177 // Updates state
178 fuzzingState.synchronizeVariable(variableId, syncGroupId);
178 fuzzingState.synchronizeVariable(variableId, syncGroupId);
179
180 variableController.onRequestDataLoading({variableState.m_Variable}, variableState.m_Range,
181 false);
179 }
182 }
180 };
183 };
181
184
@@ -197,7 +200,7 struct DesynchronizeOperation : public IFuzzingOperation {
197 qCInfo(LOG_FuzzingOperations()).noquote() << "Removing" << variableState.m_Variable->name()
200 qCInfo(LOG_FuzzingOperations()).noquote() << "Removing" << variableState.m_Variable->name()
198 << "from synchronization group" << syncGroupId
201 << "from synchronization group" << syncGroupId
199 << "...";
202 << "...";
200 variableController.onAddSynchronized(variableState.m_Variable, syncGroupId);
203 variableController.desynchronize(variableState.m_Variable, syncGroupId);
201
204
202 // Updates state
205 // Updates state
203 fuzzingState.desynchronizeVariable(variableId, syncGroupId);
206 fuzzingState.desynchronizeVariable(variableId, syncGroupId);
@@ -96,7 +96,7 public:
96 auto dataHoleIt = std::adjacent_find(
96 auto dataHoleIt = std::adjacent_find(
97 dataIts.first, dataIts.second, [](const auto &it1, const auto &it2) {
97 dataIts.first, dataIts.second, [](const auto &it1, const auto &it2) {
98 /// @todo: validate resolution
98 /// @todo: validate resolution
99 return std::abs(it1.x() - it2.x()) > 2 * (LOCALHOST_SERVER_RESOLUTION - 1);
99 return std::abs(it1.x() - it2.x()) > 2 * LOCALHOST_SERVER_RESOLUTION;
100 });
100 });
101
101
102 if (dataHoleIt != dataIts.second) {
102 if (dataHoleIt != dataIts.second) {
@@ -370,6 +370,10 void TestAmdaFuzzing::testFuzzing()
370
370
371 int main(int argc, char *argv[])
371 int main(int argc, char *argv[])
372 {
372 {
373 // Increases the test function timeout (which is 5 minutes by default) to 12 hours
374 // https://stackoverflow.com/questions/42655932/setting-timeout-to-qt-test
375 qputenv("QTEST_FUNCTION_TIMEOUT", QByteArray::number(12*60*60*1000));
376
373 QLoggingCategory::setFilterRules(
377 QLoggingCategory::setFilterRules(
374 "*.warning=false\n"
378 "*.warning=false\n"
375 "*.info=false\n"
379 "*.info=false\n"
General Comments 0
You need to be logged in to leave comments. Login now