@@ -1,5 +1,6 | |||
|
1 | 1 | #include "FuzzingDefs.h" |
|
2 | 2 | |
|
3 | const QString ACQUISITION_TIMEOUT_PROPERTY = QStringLiteral("acquisitionTimeout"); | |
|
3 | 4 | const QString NB_MAX_OPERATIONS_PROPERTY = QStringLiteral("component"); |
|
4 | 5 | const QString NB_MAX_SYNC_GROUPS_PROPERTY = QStringLiteral("nbSyncGroups"); |
|
5 | 6 | const QString NB_MAX_VARIABLES_PROPERTY = QStringLiteral("nbMaxVariables"); |
@@ -23,6 +23,9 using Properties = QVariantHash; | |||
|
23 | 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 | 29 | /// Max number of operations to generate |
|
27 | 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 | 62 | // Defaults values used when the associated properties have not been set for the test |
|
63 | const auto ACQUISITION_TIMEOUT_DEFAULT_VALUE = 30000; | |
|
63 | 64 | const auto NB_MAX_OPERATIONS_DEFAULT_VALUE = 100; |
|
64 | 65 | const auto NB_MAX_SYNC_GROUPS_DEFAULT_VALUE = 1; |
|
65 | 66 | const auto NB_MAX_VARIABLES_DEFAULT_VALUE = 1; |
@@ -195,7 +196,7 public: | |||
|
195 | 196 | nextValidationCounter = RandomGenerator::instance().generateInt( |
|
196 | 197 | validationFrequencies().first, validationFrequencies().second); |
|
197 | 198 | qCInfo(LOG_TestAmdaFuzzing()).noquote() |
|
198 | << "Next validation in " << nextValidationCounter << "operations..."; | |
|
199 | << "Next validation in " << nextValidationCounter << "operation(s)..."; | |
|
199 | 200 | }; |
|
200 | 201 | updateValidationCounter(); |
|
201 | 202 | |
@@ -218,21 +219,28 public: | |||
|
218 | 219 | auto variableId = variableOperation.first; |
|
219 | 220 | auto fuzzingOperation = variableOperation.second; |
|
220 | 221 | |
|
222 | auto waitAcquisition = nextValidationCounter == 0; | |
|
223 | ||
|
221 | 224 | fuzzingOperation->execute(variableId, m_FuzzingState, m_VariableController, |
|
222 | 225 | m_Properties); |
|
223 | 226 | |
|
224 | // Delays the next operation with a randomly generated time | |
|
225 | auto delay = RandomGenerator::instance().generateInt(operationDelays().first, | |
|
226 | operationDelays().second); | |
|
227 | qCDebug(LOG_TestAmdaFuzzing()) | |
|
228 | << "Waiting " << delay << "ms before the next operation..."; | |
|
229 | QTest::qWait(delay); | |
|
227 | if (waitAcquisition) { | |
|
228 | qCDebug(LOG_TestAmdaFuzzing()) << "Waiting for acquisition to finish..."; | |
|
229 | SignalWaiter{m_VariableController, SIGNAL(acquisitionFinished())}.wait( | |
|
230 | acquisitionTimeout()); | |
|
230 | 231 | |
|
231 | // Validates variables | |
|
232 | if (nextValidationCounter == 0) { | |
|
232 | // Validates variables | |
|
233 | 233 | validate(m_FuzzingState.m_VariablesPool, validators()); |
|
234 | 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 | 245 | else { |
|
238 | 246 | qCInfo(LOG_TestAmdaFuzzing()).noquote() |
General Comments 0
You need to be logged in to leave comments.
Login now