From 9fccfb1b06c68e52f8f15b7d43881a0efb86a809 Mon Sep 17 00:00:00 2001 From: Ilan Truanovsky Date: Thu, 26 Jan 2023 13:25:36 -0800 Subject: [PATCH 1/2] Fix PRINTF_ARGS Coverity issues Fixes: test/acl_event_test.cpp:903:27: Type: Invalid type in argument to printf format specifier (PRINTF_ARGS) test/acl_event_test.cpp:903:27: invalid_type: Argument "queued_times[i]" to format specifier "%d" was expected to have type "int" but has type "unsigned long". src/acl_hal.cpp:123:3: path: Condition "debug_mode > 0", taking true branch. src/acl_hal.cpp:126:5: printf_function: Calling "vprintf" which uses a "printf"-style format string. [Note: The source code implementation of the function has been overridden by a builtin model.] test/acl_event_test.cpp:903:44: Type: Invalid type in argument to printf format specifier (PRINTF_ARGS) test/acl_event_test.cpp:903:44: invalid_type: Argument "submit_times[i]" to format specifier "%d" was expected to have type "int" but has type "unsigned long". src/acl_hal.cpp:123:3: path: Condition "debug_mode > 0", taking true branch. src/acl_hal.cpp:126:5: printf_function: Calling "vprintf" which uses a "printf"-style format string. [Note: The source code implementation of the function has been overridden by a builtin model.] test/acl_event_test.cpp:903:61: Type: Invalid type in argument to printf format specifier (PRINTF_ARGS) test/acl_event_test.cpp:903:61: invalid_type: Argument "start_times[i]" to format specifier "%d" was expected to have type "int" but has type "unsigned long". src/acl_hal.cpp:123:3: path: Condition "debug_mode > 0", taking true branch. src/acl_hal.cpp:126:5: printf_function: Calling "vprintf" which uses a "printf"-style format string. [Note: The source code implementation of the function has been overridden by a builtin model.] test/acl_event_test.cpp:904:27: Type: Invalid type in argument to printf format specifier (PRINTF_ARGS) test/acl_event_test.cpp:904:27: invalid_type: Argument "end_times[i]" to format specifier "%d" was expected to have type "int" but has type "unsigned long". src/acl_hal.cpp:123:3: path: Condition "debug_mode > 0", taking true branch. src/acl_hal.cpp:126:5: printf_function: Calling "vprintf" which uses a "printf"-style format string. [Note: The source code implementation of the function has been overridden by a builtin model.] --- test/acl_event_test.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/acl_event_test.cpp b/test/acl_event_test.cpp index eec5d763..ba6be11d 100644 --- a/test/acl_event_test.cpp +++ b/test/acl_event_test.cpp @@ -24,6 +24,8 @@ #include #include +#include + #include "acl_test.h" MT_TEST_GROUP(acl_event) { @@ -899,8 +901,9 @@ MT_TEST(acl_event_default_config, event_dependency_exec_order) { // Internally consistent event profile. // Recall the example HAL bumps up the timestamp on every call. CHECK(queued_times[i] < submit_times[i]); - acl_print_debug_msg(" Event[%d] times = { %d %d %d %d }\n", i, - queued_times[i], submit_times[i], start_times[i], + acl_print_debug_msg(" Event[%d] times = { %" PRIu64 " %" PRIu64 + " %" PRIu64 " %" PRIu64 " }\n", + i, queued_times[i], submit_times[i], start_times[i], end_times[i]); CHECK(submit_times[i] < start_times[i]); CHECK(start_times[i] < end_times[i]); From 02979e367be67b9c1babaa40ed74908049358323 Mon Sep 17 00:00:00 2001 From: Ilan Truanovsky Date: Fri, 27 Jan 2023 10:05:14 -0800 Subject: [PATCH 2/2] Fix Coverity COPY_PASTE_ERROR This was not a real copy paste error. We intended to have the code do what we indicated. So, our two options were to tell Coverity to ignore this line of code, or change the code slightly so Coverity doesn't recognize it as a copy-paste error. We chose to do the latter. Fixes: test/acl_event_test.cpp:918:9: Type: Copy-paste error (COPY_PASTE_ERROR) test/acl_event_test.cpp:914:9: original: "submit_times[i]" looks like the original copy. test/acl_event_test.cpp:918:9: copy_paste_error: "submit_times" in "submit_times[i]" looks like a copy-paste error. test/acl_event_test.cpp:918:9: remediation: Should it say "end_times" instead? --- test/acl_event_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/acl_event_test.cpp b/test/acl_event_test.cpp index ba6be11d..4922ada4 100644 --- a/test/acl_event_test.cpp +++ b/test/acl_event_test.cpp @@ -918,7 +918,7 @@ MT_TEST(acl_event_default_config, event_dependency_exec_order) { // Check separation between dependent events. // That is, they actually waited for the prior events. - CHECK(end_times[i - 1] < submit_times[i]); + CHECK(submit_times[i] > end_times[i - 1]); } }