Skip to content

Fix acl_test.cpp Coverity issues #272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 3, 2023
Merged

Conversation

IlanTruanovsky
Copy link
Contributor

@IlanTruanovsky IlanTruanovsky commented Feb 3, 2023

Coverity complains that some setup functions' return values are not being checked. I chose to ignore the return values of these functions.

I tried adding a CHECK(...) to check for success, but this caused a function in Utest.cpp to seg fault. I'm assuming this is caused due to some CppUTest things variables/methods not being initialized until after the problematic acl_test.cpp function is called.

I think it is better to just ignore the function call's return value and if it fails, the test that called the initialization function(s) will fail.

Fixes:

test/acl_test.cpp:95:3:
  Type: Unchecked return value (CHECKED_RETURN)

test/acl_test.cpp:95:3: Unchecked call to function
  1. check_return: Calling "acl_set_hal" without checking return value (as is done elsewhere 28 out of 31 times).
src/acl_globals.cpp:182:3: Examples where return value from this function is checked
  2. example_checked: Example 1: "acl_set_hal(board_hal)" has its value checked in "acl_set_hal(board_hal)".
test/acl_globals_test.cpp:697:1: Examples where return value from this function is checked
  3. example_checked: Example 2: "acl_set_hal(acl_test_get_simple_hal())" has its value checked in "acl_set_hal(acl_test_get_simple_hal())".
test/acl_hal_test.cpp:303:3: Examples where return value from this function is checked
  4. example_checked: Example 3: "acl_set_hal(&simple_hal)" has its value checked in "acl_set_hal(&simple_hal)".
test/acl_hal_test.cpp:181:3: Examples where return value from this function is checked
  5. example_checked: Example 4: "acl_set_hal(&simple_hal)" has its value checked in "1 == acl_set_hal(&simple_hal)".
test/acl_hal_test.cpp:232:3: Examples where return value from this function is checked
  6. example_checked: Example 5: "acl_set_hal(&bad_hal)" has its value checked in "0 == acl_set_hal(&bad_hal)".

test/acl_test.cpp:102:3:
  Type: Unchecked return value (CHECKED_RETURN)

test/acl_test.cpp:102:3: Unchecked call to function
  1. check_return: Calling "acl_set_hal" without checking return value (as is done elsewhere 28 out of 31 times).
src/acl_globals.cpp:182:3: Examples where return value from this function is checked
  2. example_checked: Example 1: "acl_set_hal(board_hal)" has its value checked in "acl_set_hal(board_hal)".
test/acl_globals_test.cpp:697:1: Examples where return value from this function is checked
  3. example_checked: Example 2: "acl_set_hal(acl_test_get_simple_hal())" has its value checked in "acl_set_hal(acl_test_get_simple_hal())".
test/acl_hal_test.cpp:303:3: Examples where return value from this function is checked
  4. example_checked: Example 3: "acl_set_hal(&simple_hal)" has its value checked in "acl_set_hal(&simple_hal)".
test/acl_hal_test.cpp:181:3: Examples where return value from this function is checked
  5. example_checked: Example 4: "acl_set_hal(&simple_hal)" has its value checked in "1 == acl_set_hal(&simple_hal)".
test/acl_hal_test.cpp:232:3: Examples where return value from this function is checked
  6. example_checked: Example 5: "acl_set_hal(&bad_hal)" has its value checked in "0 == acl_set_hal(&bad_hal)".

test/acl_test.cpp:109:3:
  Type: Unchecked return value (CHECKED_RETURN)

test/acl_test.cpp:109:3: Unchecked call to function
  1. check_return: Calling "acl_set_hal" without checking return value (as is done elsewhere 28 out of 31 times).
src/acl_globals.cpp:182:3: Examples where return value from this function is checked
  2. example_checked: Example 1: "acl_set_hal(board_hal)" has its value checked in "acl_set_hal(board_hal)".
test/acl_globals_test.cpp:697:1: Examples where return value from this function is checked
  3. example_checked: Example 2: "acl_set_hal(acl_test_get_simple_hal())" has its value checked in "acl_set_hal(acl_test_get_simple_hal())".
test/acl_hal_test.cpp:303:3: Examples where return value from this function is checked
  4. example_checked: Example 3: "acl_set_hal(&simple_hal)" has its value checked in "acl_set_hal(&simple_hal)".
test/acl_hal_test.cpp:181:3: Examples where return value from this function is checked
  5. example_checked: Example 4: "acl_set_hal(&simple_hal)" has its value checked in "1 == acl_set_hal(&simple_hal)".
test/acl_hal_test.cpp:232:3: Examples where return value from this function is checked
  6. example_checked: Example 5: "acl_set_hal(&bad_hal)" has its value checked in "0 == acl_set_hal(&bad_hal)".

@IlanTruanovsky IlanTruanovsky self-assigned this Feb 3, 2023
@IlanTruanovsky IlanTruanovsky added the bug Something isn't working label Feb 3, 2023
@IlanTruanovsky IlanTruanovsky added this to the 2023.2 milestone Feb 3, 2023
Copy link
Contributor

@pcolberg pcolberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @IlanTruanovsky, just one minor nitpick.

pcolberg
pcolberg previously approved these changes Feb 3, 2023
Fixes:
```
test/acl_test.cpp:95:3:
  Type: Unchecked return value (CHECKED_RETURN)

test/acl_test.cpp:95:3: Unchecked call to function
  1. check_return: Calling "acl_set_hal" without checking return value (as is done elsewhere 28 out of 31 times).
src/acl_globals.cpp:182:3: Examples where return value from this function is checked
  2. example_checked: Example 1: "acl_set_hal(board_hal)" has its value checked in "acl_set_hal(board_hal)".
test/acl_globals_test.cpp:697:1: Examples where return value from this function is checked
  3. example_checked: Example 2: "acl_set_hal(acl_test_get_simple_hal())" has its value checked in "acl_set_hal(acl_test_get_simple_hal())".
test/acl_hal_test.cpp:303:3: Examples where return value from this function is checked
  4. example_checked: Example 3: "acl_set_hal(&simple_hal)" has its value checked in "acl_set_hal(&simple_hal)".
test/acl_hal_test.cpp:181:3: Examples where return value from this function is checked
  5. example_checked: Example 4: "acl_set_hal(&simple_hal)" has its value checked in "1 == acl_set_hal(&simple_hal)".
test/acl_hal_test.cpp:232:3: Examples where return value from this function is checked
  6. example_checked: Example 5: "acl_set_hal(&bad_hal)" has its value checked in "0 == acl_set_hal(&bad_hal)".

test/acl_test.cpp:102:3:
  Type: Unchecked return value (CHECKED_RETURN)

test/acl_test.cpp:102:3: Unchecked call to function
  1. check_return: Calling "acl_set_hal" without checking return value (as is done elsewhere 28 out of 31 times).
src/acl_globals.cpp:182:3: Examples where return value from this function is checked
  2. example_checked: Example 1: "acl_set_hal(board_hal)" has its value checked in "acl_set_hal(board_hal)".
test/acl_globals_test.cpp:697:1: Examples where return value from this function is checked
  3. example_checked: Example 2: "acl_set_hal(acl_test_get_simple_hal())" has its value checked in "acl_set_hal(acl_test_get_simple_hal())".
test/acl_hal_test.cpp:303:3: Examples where return value from this function is checked
  4. example_checked: Example 3: "acl_set_hal(&simple_hal)" has its value checked in "acl_set_hal(&simple_hal)".
test/acl_hal_test.cpp:181:3: Examples where return value from this function is checked
  5. example_checked: Example 4: "acl_set_hal(&simple_hal)" has its value checked in "1 == acl_set_hal(&simple_hal)".
test/acl_hal_test.cpp:232:3: Examples where return value from this function is checked
  6. example_checked: Example 5: "acl_set_hal(&bad_hal)" has its value checked in "0 == acl_set_hal(&bad_hal)".

test/acl_test.cpp:109:3:
  Type: Unchecked return value (CHECKED_RETURN)

test/acl_test.cpp:109:3: Unchecked call to function
  1. check_return: Calling "acl_set_hal" without checking return value (as is done elsewhere 28 out of 31 times).
src/acl_globals.cpp:182:3: Examples where return value from this function is checked
  2. example_checked: Example 1: "acl_set_hal(board_hal)" has its value checked in "acl_set_hal(board_hal)".
test/acl_globals_test.cpp:697:1: Examples where return value from this function is checked
  3. example_checked: Example 2: "acl_set_hal(acl_test_get_simple_hal())" has its value checked in "acl_set_hal(acl_test_get_simple_hal())".
test/acl_hal_test.cpp:303:3: Examples where return value from this function is checked
  4. example_checked: Example 3: "acl_set_hal(&simple_hal)" has its value checked in "acl_set_hal(&simple_hal)".
test/acl_hal_test.cpp:181:3: Examples where return value from this function is checked
  5. example_checked: Example 4: "acl_set_hal(&simple_hal)" has its value checked in "1 == acl_set_hal(&simple_hal)".
test/acl_hal_test.cpp:232:3: Examples where return value from this function is checked
  6. example_checked: Example 5: "acl_set_hal(&bad_hal)" has its value checked in "0 == acl_set_hal(&bad_hal)".

```
@pcolberg
Copy link
Contributor

pcolberg commented Feb 3, 2023

For some reason the GitHub review UI tries hard to hide commit messages, which means an outdated commit message is easy to miss when reviewing unless one remembers each and every time to click through to the commit.

@pcolberg pcolberg merged commit 2d33310 into intel:main Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants