From ee15efddb4185c9365f982d15168b37f5916610e Mon Sep 17 00:00:00 2001 From: Vic Yang Date: Fri, 14 Mar 2014 00:59:55 +0800 Subject: Measure speed gain in utils test only on device When measuring speed gain of mem*() in utils test on host, there are too many reasons that the results may be fluctuate. This gets even worse when the unit tests run on buildbots. Let's only check for speed gain on device. BUG=chromium:351870 TEST=Check the speed gain check assertion is not compiled. BRANCH=None Change-Id: I0369d07d1da8cbb469d3a2a9d846406415c06745 Signed-off-by: Vic Yang Reviewed-on: https://chromium-review.googlesource.com/189804 Reviewed-by: Daisuke Nojiri Reviewed-by: Vincent Palatin --- test/utils.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/test/utils.c b/test/utils.c index e60198225e..abc33c8d69 100644 --- a/test/utils.c +++ b/test/utils.c @@ -97,8 +97,11 @@ static int test_memmove(void) TEST_ASSERT_ARRAY_EQ(buf + 100, buf, len); /* Expected about 4x speed gain. Use 3x because it fluctuates */ -#ifndef TEST_COVERAGE - /* Measuring coverage makes it fluctuate even more, so skip it. */ +#ifndef EMU_BUILD + /* + * The speed gain is too unpredictable on host, especially on + * buildbots. Skip it if we are running in the emulator. + */ TEST_ASSERT((t1.val-t0.val) > (unsigned)(t3.val-t2.val) * 3); #endif @@ -145,7 +148,13 @@ static int test_memcpy(void) TEST_ASSERT_ARRAY_EQ(buf + dest_offset, buf, len); /* Expected about 4x speed gain. Use 3x because it fluctuates */ +#ifndef EMU_BUILD + /* + * The speed gain is too unpredictable on host, especially on + * buildbots. Skip it if we are running in the emulator. + */ TEST_ASSERT((t1.val-t0.val) > (unsigned)(t3.val-t2.val) * 3); +#endif memcpy(buf + dest_offset + 1, buf + 1, len - 1); TEST_ASSERT_ARRAY_EQ(buf + dest_offset + 1, buf + 1, len - 1); @@ -201,7 +210,13 @@ static int test_memset(void) ccprintf(" %d us) ", t3.val-t2.val); /* Expected about 4x speed gain. Use 3x because it fluctuates */ +#ifndef EMU_BUILD + /* + * The speed gain is too unpredictable on host, especially on + * buildbots. Skip it if we are running in the emulator. + */ TEST_ASSERT((t1.val-t0.val) > (unsigned)(t3.val-t2.val) * 3); +#endif memset(buf, 128, len); TEST_ASSERT_MEMSET(buf, (char)128, len); -- cgit v1.2.1