X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=example%2Fdiameter%2Flauncher%2Ftesting%2FTestManager.cpp;fp=example%2Fdiameter%2Flauncher%2Ftesting%2FTestManager.cpp;h=ea340b9be60a02bea193aa04782dece5fa4c9da9;hb=f9534159f3b43cbf74eccf88723ee740c69eb204;hp=da9010749121b8438bc3d6b129b10ad30e8fa950;hpb=e3f60b6b4a178c63ebd6f8915431bfa485a2e601;p=anna.git diff --git a/example/diameter/launcher/testing/TestManager.cpp b/example/diameter/launcher/testing/TestManager.cpp index da90107..ea340b9 100644 --- a/example/diameter/launcher/testing/TestManager.cpp +++ b/example/diameter/launcher/testing/TestManager.cpp @@ -36,7 +36,8 @@ TestManager::TestManager() : a_dumpReports = false; a_dumpHexMessages = false; a_synchronousAmount = 1; - a_poolRepeat = false; + a_poolRepeats = 0; // repeat disabled by default + a_poolCycle = 1; a_inProgressCount = 0; a_inProgressLimit = UINT_MAX; // no limit a_clock = NULL; @@ -135,7 +136,7 @@ bool TestManager::configureTTPS(int testTicksPerSecond) throw() { a_synchronousAmount = 1; if (admlTimeInterval < anna::Millisecond(1)) { - LOGWARNING(anna::Logger::warning("Not allowed to configure more than 1000 events per second for the time trigger testing system", ANNA_FILE_LOCATION)); + LOGWARNING(anna::Logger::warning("Not allowed to configure more than 1000 events per second for for triggering testing system", ANNA_FILE_LOCATION)); return false; } @@ -209,6 +210,7 @@ bool TestManager::clearPool() throw() { a_testPool.clear(); a_sessionIdTestCaseMap.clear(); a_currentTestIt = a_testPool.end(); + a_poolCycle = 1; configureTTPS(0); // stop return true; } @@ -261,16 +263,21 @@ bool TestManager::nextTestCase() throw() { // Completed: if (a_currentTestIt == a_testPool.end()) { - if (a_poolRepeat) { - LOGWARNING(anna::Logger::warning("Testing pool cycle completed. Repeat mode on. Restarting", ANNA_FILE_LOCATION)); + if ((a_poolCycle > a_poolRepeats) && (a_poolRepeats != -1)) { + LOGWARNING(anna::Logger::warning("Testing pool cycle completed. No remaining repeat cycles left. Suspending", ANNA_FILE_LOCATION)); + a_poolCycle = 1; + return false; + } + else { + LOGWARNING( + std::string nolimit = (a_poolRepeats != -1) ? "":" [no limit]"; + anna::Logger::warning(anna::functions::asString("Testing pool cycle %d completed (repeats configured: %d%s). Restarting for the %s cycle", a_poolCycle, a_poolRepeats, nolimit.c_str(), (a_poolRepeats == a_poolCycle) ? "last":"next"), ANNA_FILE_LOCATION); + ); + a_poolCycle++; //a_currentTestIt = a_testPool.begin(); return true; // avoids infinite loop: if the cycle takes less time than test cases completion, below reset never will turns state // into Initialized and this while will be infinite. It is preferable to wait one tick when the cycle is completed. } - else { - LOGWARNING(anna::Logger::warning("Testing pool cycle completed. Repeat mode off. Suspending", ANNA_FILE_LOCATION)); - return false; - } } // Soft reset to initialize already finished (in previous cycle) test cases: @@ -378,7 +385,9 @@ throw() { int poolSize = a_testPool.size(); result->createAttribute("NumberOfTestCases", poolSize); - result->createAttribute("PoolRepeat", (a_poolRepeat ? "yes":"no")); + if (a_poolRepeats) result->createAttribute("PoolRepeats", a_poolRepeats); + else result->createAttribute("PoolRepeats", "disabled"); + result->createAttribute("PoolCycle", a_poolCycle); result->createAttribute("InProgressCount", a_inProgressCount); if (a_inProgressLimit == UINT_MAX) result->createAttribute("InProgressLimit", "");