##// END OF EJS Templates
Wait for the end of an acquisition to validate an operation (3)...
Alexandre Leroux -
r1248:7541b71e5b78
parent child
Show More
@@ -1,5 +1,6
1 #include "FuzzingDefs.h"
1 #include "FuzzingDefs.h"
2
2
3 const QString ACQUISITION_TIMEOUT_PROPERTY = QStringLiteral("acquisitionTimeout");
3 const QString NB_MAX_OPERATIONS_PROPERTY = QStringLiteral("component");
4 const QString NB_MAX_OPERATIONS_PROPERTY = QStringLiteral("component");
4 const QString NB_MAX_SYNC_GROUPS_PROPERTY = QStringLiteral("nbSyncGroups");
5 const QString NB_MAX_SYNC_GROUPS_PROPERTY = QStringLiteral("nbSyncGroups");
5 const QString NB_MAX_VARIABLES_PROPERTY = QStringLiteral("nbMaxVariables");
6 const QString NB_MAX_VARIABLES_PROPERTY = QStringLiteral("nbMaxVariables");
@@ -23,6 +23,9 using Properties = QVariantHash;
23 // Constants //
23 // Constants //
24 // ///////// //
24 // ///////// //
25
25
26 /// Timeout set for data acquisition for an operation (in ms)
27 extern const QString ACQUISITION_TIMEOUT_PROPERTY;
28
26 /// Max number of operations to generate
29 /// Max number of operations to generate
27 extern const QString NB_MAX_OPERATIONS_PROPERTY;
30 extern const QString NB_MAX_OPERATIONS_PROPERTY;
28
31
@@ -60,6 +60,7 using Validators = std::vector<std::shared_ptr<IFuzzingValidator> >;
60 // ///////// //
60 // ///////// //
61
61
62 // Defaults values used when the associated properties have not been set for the test
62 // Defaults values used when the associated properties have not been set for the test
63 const auto ACQUISITION_TIMEOUT_DEFAULT_VALUE = 30000;
63 const auto NB_MAX_OPERATIONS_DEFAULT_VALUE = 100;
64 const auto NB_MAX_OPERATIONS_DEFAULT_VALUE = 100;
64 const auto NB_MAX_SYNC_GROUPS_DEFAULT_VALUE = 1;
65 const auto NB_MAX_SYNC_GROUPS_DEFAULT_VALUE = 1;
65 const auto NB_MAX_VARIABLES_DEFAULT_VALUE = 1;
66 const auto NB_MAX_VARIABLES_DEFAULT_VALUE = 1;
@@ -195,7 +196,7 public:
195 nextValidationCounter = RandomGenerator::instance().generateInt(
196 nextValidationCounter = RandomGenerator::instance().generateInt(
196 validationFrequencies().first, validationFrequencies().second);
197 validationFrequencies().first, validationFrequencies().second);
197 qCInfo(LOG_TestAmdaFuzzing()).noquote()
198 qCInfo(LOG_TestAmdaFuzzing()).noquote()
198 << "Next validation in " << nextValidationCounter << "operations...";
199 << "Next validation in " << nextValidationCounter << "operation(s)...";
199 };
200 };
200 updateValidationCounter();
201 updateValidationCounter();
201
202
@@ -218,21 +219,28 public:
218 auto variableId = variableOperation.first;
219 auto variableId = variableOperation.first;
219 auto fuzzingOperation = variableOperation.second;
220 auto fuzzingOperation = variableOperation.second;
220
221
222 auto waitAcquisition = nextValidationCounter == 0;
223
221 fuzzingOperation->execute(variableId, m_FuzzingState, m_VariableController,
224 fuzzingOperation->execute(variableId, m_FuzzingState, m_VariableController,
222 m_Properties);
225 m_Properties);
223
226
224 // Delays the next operation with a randomly generated time
227 if (waitAcquisition) {
225 auto delay = RandomGenerator::instance().generateInt(operationDelays().first,
228 qCDebug(LOG_TestAmdaFuzzing()) << "Waiting for acquisition to finish...";
226 operationDelays().second);
229 SignalWaiter{m_VariableController, SIGNAL(acquisitionFinished())}.wait(
227 qCDebug(LOG_TestAmdaFuzzing())
230 acquisitionTimeout());
228 << "Waiting " << delay << "ms before the next operation...";
229 QTest::qWait(delay);
230
231
231 // Validates variables
232 // Validates variables
232 if (nextValidationCounter == 0) {
233 validate(m_FuzzingState.m_VariablesPool, validators());
233 validate(m_FuzzingState.m_VariablesPool, validators());
234 updateValidationCounter();
234 updateValidationCounter();
235 }
235 }
236 else {
237 // Delays the next operation with a randomly generated time
238 auto delay = RandomGenerator::instance().generateInt(operationDelays().first,
239 operationDelays().second);
240 qCDebug(LOG_TestAmdaFuzzing())
241 << "Waiting " << delay << "ms before the next operation...";
242 QTest::qWait(delay);
243 }
236 }
244 }
237 else {
245 else {
238 qCInfo(LOG_TestAmdaFuzzing()).noquote()
246 qCInfo(LOG_TestAmdaFuzzing()).noquote()
General Comments 0
You need to be logged in to leave comments. Login now