[PATCH] tests/intel/perf_pmu: Fix Test Assertion Failure for semaphore-busy test

Ravi Kumar Vodapalli ravi.kumar.vodapalli at intel.com
Tue Nov 26 14:09:13 UTC 2024


The tolerance limit exceeds the threshold values sometimes for test
igt at perf_pmu@semaphore-busy, bump up the limits slightly.
Also print the log in readable format in percentage instead of nanosec.

Signed-off-by: Ravi Kumar Vodapalli <ravi.kumar.vodapalli at intel.com>
---
 tests/intel/perf_pmu.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/tests/intel/perf_pmu.c b/tests/intel/perf_pmu.c
index bfa2d501a..7f43354fd 100644
--- a/tests/intel/perf_pmu.c
+++ b/tests/intel/perf_pmu.c
@@ -189,7 +189,7 @@
 
 IGT_TEST_DESCRIPTION("Test the i915 pmu perf interface");
 
-const double tolerance = 0.05f;
+const double tolerance = 0.1f;
 const unsigned long batch_duration_ns = 500e6;
 
 char *drpc;
@@ -287,10 +287,9 @@ static uint64_t pmu_read_multi(int fd, unsigned int num, uint64_t *val)
 #define __assert_within_epsilon(x, ref, tol_up, tol_down, debug_data) \
 	igt_assert_f((double)(x) <= (1.0 + (tol_up)) * (double)(ref) && \
 		     (double)(x) >= (1.0 - (tol_down)) * (double)(ref), \
-		     "'%s' != '%s' (%f not within +%.1f%%/-%.1f%% tolerance of %f)\n%s\n",\
-		     #x, #ref, (double)(x), \
-		     (tol_up) * 100.0, (tol_down) * 100.0, \
-		     (double)(ref), debug_data)
+		     "%.3f%% is not within tolerance limits of +%.1f%%/-%.1f%%\n%s\n", \
+		     (((double)((double)(x) - (double)(ref)) * 100.0) / (double)(ref)), \
+		     (tol_up) * 100.0, (tol_down) * 100.0, debug_data)
 
 #define assert_within_epsilon(x, ref, tolerance) \
 	__assert_within_epsilon(x, ref, tolerance, tolerance, no_debug_data)
-- 
2.25.1



More information about the igt-dev mailing list