From 0cdfe0b14780152ebec39f21cf99f37d4330843d Mon Sep 17 00:00:00 2001 From: Oliver O'Halloran Date: Wed, 21 Dec 2016 16:35:36 +1100 Subject: core/test: use strcmp for console tests 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 Signed-off-by: Stewart Smith --- 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 03ee476..ae9d206 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 6d6d366..01376ee 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; -- cgit v1.1