From 29ed01b27b7c2b250aa5413d33471ac860b64dcc Mon Sep 17 00:00:00 2001 From: Gunes Bayir Date: Mon, 8 Dec 2025 11:44:20 +0000 Subject: [PATCH] test: Print the seed for each iteration in failing tests or info prints Change-Id: I706ffb9c8b19c9afbb378accbfa88e2a807867ee Signed-off-by: Gunes Bayir --- tests/framework/Framework.cpp | 5 +++++ tests/framework/Framework.h | 6 ++++++ tests/validation/Validation.h | 6 ++++++ 3 files changed, 17 insertions(+) diff --git a/tests/framework/Framework.cpp b/tests/framework/Framework.cpp index d9d257d9ff..9db3e9e03d 100644 --- a/tests/framework/Framework.cpp +++ b/tests/framework/Framework.cpp @@ -745,6 +745,11 @@ void Framework::set_seed(unsigned int seed) { _seed = seed; } + +unsigned int Framework::get_seed() const +{ + return _seed; +} } // namespace framework } // namespace test } // namespace arm_compute diff --git a/tests/framework/Framework.h b/tests/framework/Framework.h index c284f6008e..4bebc4fb55 100644 --- a/tests/framework/Framework.h +++ b/tests/framework/Framework.h @@ -350,6 +350,12 @@ class Framework final */ void set_seed(unsigned int seed); + /** Get the seed set by the framework. + * + * @return the seed + */ + unsigned int get_seed() const; + private: Framework(); ~Framework() = default; diff --git a/tests/validation/Validation.h b/tests/validation/Validation.h index dbb6754c9b..79c9c78e4b 100644 --- a/tests/validation/Validation.h +++ b/tests/validation/Validation.h @@ -498,6 +498,12 @@ void validate(const IAccessor &tensor, ARM_COMPUTE_TEST_INFO(num_mismatches << " values (" << std::fixed << std::setprecision(2) << percent_mismatches << "%) mismatched (maximum tolerated " << std::setprecision(2) << tolerance_number * 100 << "%)"); + if (framework::Framework::get().num_iterations() > 1) + { + // If number of test iterations > 1, the initially printed seed is dynamic. + // Print the seed for each failing test/information printout. + ARM_COMPUTE_TEST_INFO("Seed: " << framework::Framework::get().get_seed()); + } ARM_COMPUTE_EXPECT(num_mismatches <= absolute_tolerance_number, framework::LogLevel::ERRORS); } }