diff options
author | Yi Chou <yich@google.com> | 2023-05-08 11:15:51 +0800 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-05-16 12:34:53 +0000 |
commit | 9ab5743831f081d1b4d161fe28be711ef2d01d4c (patch) | |
tree | 2f5afe516090f4be9e69eb9b9d8228538b664dac | |
parent | 9383e02903200b02b312967c1517a3a0c5221f2b (diff) | |
download | chrome-ec-9ab5743831f081d1b4d161fe28be711ef2d01d4c.tar.gz |
test_util.h: Add TEST_ASSERT_ARRAY_NE
BUG=b:248508087
make runhosttests -j200 >/dev/null
Change-Id: I7fa48a68bc8a56fb94649a4a0930ce83df6d9a84
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4506541
Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Commit-Queue: Yi Chou <yich@google.com>
Tested-by: Yi Chou <yich@google.com>
-rw-r--r-- | include/test_util.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/test_util.h b/include/test_util.h index 4f9869ab61..54da6a1d6c 100644 --- a/include/test_util.h +++ b/include/test_util.h @@ -19,6 +19,7 @@ extern "C" { #include "ec_commands.h" #include "math_util.h" #include "stack_trace.h" +#include "string.h" #ifdef CONFIG_ZTEST #include "ec_tasks.h" @@ -115,6 +116,19 @@ extern "C" { } \ } while (0) +#define TEST_ASSERT_ARRAY_NE(s, d, n) \ + do { \ + if (n < 0) \ + return EC_ERROR_UNKNOWN; \ + \ + if (memcmp(&s[0], &d[0], n) == 0) { \ + ccprintf("%s:%d: ASSERT_ARRAY_NE failed\n", __FILE__, \ + __LINE__); \ + task_dump_trace(); \ + return EC_ERROR_UNKNOWN; \ + } \ + } while (0) + #define TEST_ASSERT_MEMSET(d, c, n) \ do { \ if (n < 0) \ |