@@ -9,7 +9,7 const QString INITIAL_RANGE_PROPERTY = QStringLiteral("initialRange"); | |||
|
9 | 9 | const QString MAX_RANGE_PROPERTY = QStringLiteral("maxRange"); |
|
10 | 10 | const QString METADATA_POOL_PROPERTY = QStringLiteral("metadataPool"); |
|
11 | 11 | const QString PROVIDER_PROPERTY = QStringLiteral("provider"); |
|
12 | const QString OPERATION_DELAY_PROPERTY = QStringLiteral("operationDelay"); | |
|
12 | const QString OPERATION_DELAY_BOUNDS_PROPERTY = QStringLiteral("operationDelays"); | |
|
13 | 13 | const QString VALIDATORS_PROPERTY = QStringLiteral("validators"); |
|
14 | 14 | |
|
15 | 15 | // //////////// // |
@@ -50,8 +50,8 extern const QString METADATA_POOL_PROPERTY; | |||
|
50 | 50 | /// Provider used to retrieve data |
|
51 | 51 | extern const QString PROVIDER_PROPERTY; |
|
52 | 52 | |
|
53 |
/// |
|
|
54 | extern const QString OPERATION_DELAY_PROPERTY; | |
|
53 | /// Min/max times left for an operation to execute | |
|
54 | extern const QString OPERATION_DELAY_BOUNDS_PROPERTY; | |
|
55 | 55 | |
|
56 | 56 | /// Validators used to validate an operation |
|
57 | 57 | extern const QString VALIDATORS_PROPERTY; |
@@ -54,8 +54,8 const auto AVAILABLE_OPERATIONS_DEFAULT_VALUE = QVariant::fromValue(WeightedOper | |||
|
54 | 54 | {FuzzingOperationType::DESYNCHRONIZE, 0.4}}); |
|
55 | 55 | const auto CACHE_TOLERANCE_DEFAULT_VALUE = 0.2; |
|
56 | 56 | |
|
57 |
/// |
|
|
58 | const auto OPERATION_DELAY_DEFAULT_VALUE = 3000; | |
|
57 | /// Min/max delays between each operation (in ms) | |
|
58 | const auto OPERATION_DELAY_BOUNDS_DEFAULT_VALUE = QVariant::fromValue(std::make_pair(100, 3000)); | |
|
59 | 59 | |
|
60 | 60 | /// Validators for the tests (executed in the order in which they're defined) |
|
61 | 61 | const auto VALIDATORS_DEFAULT_VALUE = QVariant::fromValue( |
@@ -184,7 +184,13 public: | |||
|
184 | 184 | |
|
185 | 185 | fuzzingOperation->execute(variableId, m_FuzzingState, m_VariableController, |
|
186 | 186 | m_Properties); |
|
187 | QTest::qWait(operationDelay()); | |
|
187 | ||
|
188 | // Delays the next operation with a randomly generated time | |
|
189 | auto delay = RandomGenerator::instance().generateInt(operationDelays().first, | |
|
190 | operationDelays().second); | |
|
191 | qCDebug(LOG_TestAmdaFuzzing()) | |
|
192 | << "Waiting " << delay << "ms before the next operation..."; | |
|
193 | QTest::qWait(delay); | |
|
188 | 194 | |
|
189 | 195 | // Validates variables |
|
190 | 196 | validate(m_FuzzingState.m_VariablesPool, validators()); |
@@ -222,10 +228,12 private: | |||
|
222 | 228 | return result; |
|
223 | 229 | } |
|
224 | 230 | |
|
225 | int operationDelay() const | |
|
231 | std::pair<int, int> operationDelays() const | |
|
226 | 232 | { |
|
227 | 233 | static auto result |
|
228 | = m_Properties.value(OPERATION_DELAY_PROPERTY, OPERATION_DELAY_DEFAULT_VALUE).toInt(); | |
|
234 | = m_Properties | |
|
235 | .value(OPERATION_DELAY_BOUNDS_PROPERTY, OPERATION_DELAY_BOUNDS_DEFAULT_VALUE) | |
|
236 | .value<std::pair<int, int> >(); | |
|
229 | 237 | return result; |
|
230 | 238 | } |
|
231 | 239 |
General Comments 0
You need to be logged in to leave comments.
Login now