summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuval Peress <peress@google.com>2022-09-01 12:04:38 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-09-01 19:09:49 +0000
commitea341c40ed59ebf53e982790d4bc9f60105afcac (patch)
tree60aacc3e3a366179422904df753a624276fd4b0c
parent542d8b8db1fefbd07a0754199dfef7bfa04ce5a1 (diff)
downloadchrome-ec-ea341c40ed59ebf53e982790d4bc9f60105afcac.tar.gz
gitlabl: Fix warnings that are causing the gitlab breaks
1. Fix the formatting string used to print the command for md.c 2. Remove non-standard use of strcasecmp (not in the C spec) so this was causing a failure in the GitLab environment. BRANCH=none BUG=none TEST=twister -T zephyr/test/drivers/ Signed-off-by: Yuval Peress <peress@google.com> Change-Id: Ifdbc86b2c7265fdc4df21f699671cf6c905b627d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3869002 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/md.c16
-rw-r--r--zephyr/test/drivers/default/src/power_common.c8
2 files changed, 16 insertions, 8 deletions
diff --git a/zephyr/test/drivers/default/src/console_cmd/md.c b/zephyr/test/drivers/default/src/console_cmd/md.c
index 8e3d00c255..c8cc3f847f 100644
--- a/zephyr/test/drivers/default/src/console_cmd/md.c
+++ b/zephyr/test/drivers/default/src/console_cmd/md.c
@@ -36,7 +36,8 @@ ZTEST_USER(console_cmd_md, test_default_count)
uint8_t memory[] = { 0x01, 0x02, 0x03, 0x04 };
char cmd[128] = { 0 };
- zassume_true(sprintf(cmd, "md %llu", memory) != 0, NULL);
+ zassume_true(sprintf(cmd, "md %" PRIuPTR, (uintptr_t)memory) != 0,
+ NULL);
zassert_ok(shell_execute_cmd(get_ec_shell(), cmd), NULL);
}
@@ -45,7 +46,8 @@ ZTEST_USER(console_cmd_md, test_count_arg)
uint8_t memory[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 };
char cmd[128] = { 0 };
- zassume_true(sprintf(cmd, "md %llu 2", memory) != 0, NULL);
+ zassume_true(sprintf(cmd, "md %" PRIuPTR " 2", (uintptr_t)memory) != 0,
+ NULL);
zassert_ok(shell_execute_cmd(get_ec_shell(), cmd), NULL);
}
@@ -54,7 +56,8 @@ ZTEST_USER(console_cmd_md, test_byte_format)
uint8_t memory[] = { 0x01, 0x02, 0x03, 0x04 };
char cmd[128] = { 0 };
- zassume_true(sprintf(cmd, "md .b %llu", memory) != 0, NULL);
+ zassume_true(sprintf(cmd, "md .b %" PRIuPTR, (uintptr_t)memory) != 0,
+ NULL);
zassert_ok(shell_execute_cmd(get_ec_shell(), cmd), NULL);
}
@@ -63,7 +66,8 @@ ZTEST_USER(console_cmd_md, test_half_format)
uint8_t memory[] = { 0x01, 0x02, 0x03, 0x04 };
char cmd[128] = { 0 };
- zassume_true(sprintf(cmd, "md .h %llu", memory) != 0, NULL);
+ zassume_true(sprintf(cmd, "md .h %" PRIuPTR, (uintptr_t)memory) != 0,
+ NULL);
zassert_ok(shell_execute_cmd(get_ec_shell(), cmd), NULL);
}
@@ -72,6 +76,8 @@ ZTEST_USER(console_cmd_md, test_string_format)
char memory[] = "hello world";
char cmd[128] = { 0 };
- zassume_true(sprintf(cmd, "md .s %llu 12", memory) != 0, NULL);
+ zassume_true(sprintf(cmd, "md .s %" PRIuPTR " 12", (uintptr_t)memory) !=
+ 0,
+ NULL);
zassert_ok(shell_execute_cmd(get_ec_shell(), cmd), NULL);
}
diff --git a/zephyr/test/drivers/default/src/power_common.c b/zephyr/test/drivers/default/src/power_common.c
index 537ad9b1d7..23931f322f 100644
--- a/zephyr/test/drivers/default/src/power_common.c
+++ b/zephyr/test/drivers/default/src/power_common.c
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-#include <strings.h>
+#include <string.h>
#include <zephyr/ztest.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/gpio/gpio_emul.h>
@@ -464,7 +464,8 @@ ZTEST(power_common, power_console_cmd)
zassert_equal(EC_SUCCESS, shell_execute_cmd(get_ec_shell(), "power"),
NULL);
buffer = shell_backend_dummy_get_output(get_ec_shell(), &buffer_size);
- zassert_true(strcasecmp(buffer, "\r\noff\r\n") == 0,
+ zassert_true(strcmp(buffer, "\r\noff\r\n") == 0 ||
+ strcmp(buffer, "\r\nOFF\r\n") == 0,
"Invalid console output %s", buffer);
test_set_chipset_to_s0();
@@ -472,7 +473,8 @@ ZTEST(power_common, power_console_cmd)
zassert_equal(EC_SUCCESS, shell_execute_cmd(get_ec_shell(), "power"),
NULL);
buffer = shell_backend_dummy_get_output(get_ec_shell(), &buffer_size);
- zassert_true(strcasecmp(buffer, "\r\non\r\n") == 0,
+ zassert_true(strcmp(buffer, "\r\non\r\n") == 0 ||
+ strcmp(buffer, "\r\nON\r\n") == 0,
"Invalid console output %s", buffer);
zassert_equal(EC_ERROR_PARAM1,