summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2017-11-22 19:42:15 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2017-11-23 07:25:57 +0000
commitfe9cf277f0975c9b5dceb83190a21535eb381903 (patch)
tree4b38e14f72b89e8d9d641b917761a3a3018cf78f /tests
parent6de721fee2066fef59f77c705e8163594066b31a (diff)
igt/perf_pmu: Protect macro args
In particular we fix the evaluation of "(double)x" when x is a compound. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/perf_pmu.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c
index 34f10a3c..5258f4ce 100644
--- a/tests/perf_pmu.c
+++ b/tests/perf_pmu.c
@@ -99,10 +99,10 @@ static void pmu_read_multi(int fd, unsigned int num, uint64_t *val)
}
#define assert_within_epsilon(x, ref, tolerance) \
- igt_assert_f((double)(x) <= (1.0 + tolerance) * (double)ref && \
- (double)(x) >= (1.0 - tolerance) * (double)ref, \
+ igt_assert_f((double)(x) <= (1.0 + (tolerance)) * (double)(ref) && \
+ (double)(x) >= (1.0 - (tolerance)) * (double)(ref), \
"'%s' != '%s' (%f not within %f%% tolerance of %f)\n",\
- #x, #ref, (double)x, tolerance * 100.0, (double)ref)
+ #x, #ref, (double)(x), (tolerance) * 100.0, (double)ref)
/*
* Helper for cases where we assert on time spent sleeping (directly or