[Skiboot] [RFC PATCH 02/10] core/test: use strcmp for console tests
Oliver O'Halloran
oohall at gmail.com
Wed Dec 21 16:35:36 AEDT 2016
The console logging tests use a memcmp and strlen() with string literal
arguments. Unfortunately the strings were updated at some point and not
kept in sync. strcmp() should be fine here so use that instead.
Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
---
core/test/run-console-log-pr_fmt.c | 6 +++---
core/test/run-console-log.c | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/core/test/run-console-log-pr_fmt.c b/core/test/run-console-log-pr_fmt.c
index 03ee476f5265..ae9d206cb626 100644
--- a/core/test/run-console-log-pr_fmt.c
+++ b/core/test/run-console-log-pr_fmt.c
@@ -52,7 +52,7 @@ int main(void)
debug_descriptor.console_log_levels = 0x75;
prlog(PR_EMERG, "Hello World");
- assert(memcmp(console_buffer, "[ 0.000000042,0] PREFIX: Hello World", strlen("[ 0.000042,0] PREFIX: Hello World")) == 0);
+ assert(strcmp(console_buffer, "[ 0.000000042,0] PREFIX: Hello World") == 0);
assert(flushed_to_drivers==true);
memset(console_buffer, 0, sizeof(console_buffer));
@@ -63,11 +63,11 @@ int main(void)
// Should not be flushed to console
prlog(PR_DEBUG, "Hello World");
- assert(memcmp(console_buffer, "[ 0.000000042,7] PREFIX: Hello World", strlen("[ 0.000042,7] PREFIX: Hello World")) == 0);
+ assert(strcmp(console_buffer, "[ 0.000000042,7] PREFIX: Hello World") == 0);
assert(flushed_to_drivers==false);
printf("Hello World");
- assert(memcmp(console_buffer, "[ 0.000000042,5] PREFIX: Hello World", strlen("[ 0.000042,5] PREFIX: Hello World")) == 0);
+ assert(strcmp(console_buffer, "[ 0.000000042,5] PREFIX: Hello World") == 0);
assert(flushed_to_drivers==true);
return 0;
diff --git a/core/test/run-console-log.c b/core/test/run-console-log.c
index 6d6d366b2140..01376eee7334 100644
--- a/core/test/run-console-log.c
+++ b/core/test/run-console-log.c
@@ -52,7 +52,7 @@ int main(void)
debug_descriptor.console_log_levels = 0x75;
prlog(PR_EMERG, "Hello World");
- assert(memcmp(console_buffer, "[ 0.000000042,0] Hello World", strlen("[ 0.000042,0] Hello World")) == 0);
+ assert(strcmp(console_buffer, "[ 0.000000042,0] Hello World") == 0);
assert(flushed_to_drivers==true);
memset(console_buffer, 0, sizeof(console_buffer));
@@ -63,11 +63,11 @@ int main(void)
// Should not be flushed to console
prlog(PR_DEBUG, "Hello World");
- assert(memcmp(console_buffer, "[ 0.000000042,7] Hello World", strlen("[ 0.000042,7] Hello World")) == 0);
+ assert(strcmp(console_buffer, "[ 0.000000042,7] Hello World") == 0);
assert(flushed_to_drivers==false);
printf("Hello World");
- assert(memcmp(console_buffer, "[ 0.000000042,5] Hello World", strlen("[ 0.000042,5] Hello World")) == 0);
+ assert(strcmp(console_buffer, "[ 0.000000042,5] Hello World") == 0);
assert(flushed_to_drivers==true);
return 0;
--
2.7.4
More information about the Skiboot
mailing list