summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYicheng Li <yichengli@chromium.org>2020-06-11 18:50:52 -0700
committerCommit Bot <commit-bot@chromium.org>2020-06-17 17:28:09 +0000
commitd2a554aef40c9adf120a7641c398d99fade50b76 (patch)
treee0d73d73c2cc079c8e9a786384e49653f2f5e992
parent035d11fc5d215010b14f0c7dad041ad1c3425c50 (diff)
downloadchrome-ec-d2a554aef40c9adf120a7641c398d99fade50b76.tar.gz
test: Correct memset speed expectation for stm32f412
On STM32F4, the speed gain of memset is slightly above 2x. Set this expectation explicitly. BRANCH=none BUG=b:155230812 TEST=verified that test_memset passes on nucleo-f412zg Signed-off-by: Yicheng Li <yichengli@chromium.org> Change-Id: Icb9951732fb03296007ceeca5f83ac26f7e0e709 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2242355 Tested-by: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Commit-Queue: Tom Hughes <tomhughes@chromium.org>
-rw-r--r--test/utils.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/test/utils.c b/test/utils.c
index c46b6ab192..5b76ab8de5 100644
--- a/test/utils.c
+++ b/test/utils.c
@@ -157,14 +157,23 @@ static int test_memset(void)
TEST_ASSERT_MEMSET(buf, (char)1, len);
ccprintf(" %" PRId64 " 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.
+ * Expected about 4x speed gain. Use smaller value since it
+ * fluctuates.
*/
- TEST_ASSERT((t1.val-t0.val) > (unsigned)(t3.val-t2.val) * 3);
-#endif
+ if (!IS_ENABLED(EMU_BUILD)) {
+ /*
+ * The speed gain is too unpredictable on host, especially on
+ * buildbots. Skip it if we are running in the emulator.
+ */
+ int expected_speedup = 3;
+
+ if (IS_ENABLED(CHIP_FAMILY_STM32F4))
+ expected_speedup = 2;
+
+ TEST_ASSERT((t1.val - t0.val) >
+ (unsigned int)(t3.val - t2.val) * expected_speedup);
+ }
memset(buf, 128, len);
TEST_ASSERT_MEMSET(buf, (char)128, len);