Skip to content

Commit 298f8a7

Browse files
committed
test: Print the seed for each iteration in failing tests or info prints
Change-Id: I706ffb9c8b19c9afbb378accbfa88e2a807867ee Signed-off-by: Gunes Bayir <gunes.bayir@arm.com>
1 parent 4c5773f commit 298f8a7

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

tests/framework/Framework.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,11 @@ void Framework::set_seed(unsigned int seed)
745745
{
746746
_seed = seed;
747747
}
748+
749+
unsigned int Framework::get_seed() const
750+
{
751+
return _seed;
752+
}
748753
} // namespace framework
749754
} // namespace test
750755
} // namespace arm_compute

tests/framework/Framework.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,12 @@ class Framework final
350350
*/
351351
void set_seed(unsigned int seed);
352352

353+
/** Get the seed set by the framework.
354+
*
355+
* @return the seed
356+
*/
357+
unsigned int get_seed() const;
358+
353359
private:
354360
Framework();
355361
~Framework() = default;

tests/validation/Validation.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,12 @@ void validate(const IAccessor &tensor,
498498
ARM_COMPUTE_TEST_INFO(num_mismatches << " values (" << std::fixed << std::setprecision(2) << percent_mismatches
499499
<< "%) mismatched (maximum tolerated " << std::setprecision(2)
500500
<< tolerance_number * 100 << "%)");
501+
if (framework::Framework::get().num_iterations() > 1)
502+
{
503+
// If number of test iterations > 1, the initially printed seed is dynamic.
504+
// Print the seed for each failing test/information printout.
505+
ARM_COMPUTE_TEST_INFO("Seed: " << framework::Framework::get().get_seed());
506+
}
501507
ARM_COMPUTE_EXPECT(num_mismatches <= absolute_tolerance_number, framework::LogLevel::ERRORS);
502508
}
503509
}

0 commit comments

Comments
 (0)