diff options
author | Vic Yang <victoryang@chromium.org> | 2014-03-14 00:59:55 +0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-03-13 23:22:25 +0000 |
commit | ee15efddb4185c9365f982d15168b37f5916610e (patch) | |
tree | d9495dcc2d2b1e7d99a59bc168b7c78797c03395 /test | |
parent | 344c2fb865620f149dc16ed26fafcb882b958653 (diff) | |
download | chrome-ec-ee15efddb4185c9365f982d15168b37f5916610e.tar.gz |
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 <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/189804
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/utils.c | 19 |
1 files 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); |