Skip to content
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

Cleanup sockctl tests #276

Merged
merged 2 commits into from
Sep 16, 2022
Merged

Cleanup sockctl tests #276

merged 2 commits into from
Sep 16, 2022

Conversation

aloisklink
Copy link
Contributor

It's probably easier to review each commit one by one!

The main point of this PR is to remove the use of tempnam from this project, as it is deprecated and the compiler/linker throws a warning on use.

The first line of the description in the tempnam manpage says:

Never use this function. Use mkstemp(3) or tmpfile(3) instead.

I've also used teardown() functions to automatically cleanup all of the sockctl temporary files, so that my /tmp folder isn't filled with junk!

In commit test(sockctl): refactor and cleanup tests, I've also done some general cleanup.

Cleans up temporary files during test.

Also removes the usage of tempnam, which is deprecated and throws
a warning on use.
The first line of the description in the tempnam manpage says:

> _Never use this function_.  Use mkstemp(3) or tmpfile(3) instead.
Cleanup some of the sockctl tests:
- Moves variable declaration next to usage
- Uses struct initialisation when possible
- Replace 100 bytes client_addr buffer to 108 bytes
@aloisklink aloisklink added the refactor Refactoring code label Sep 16, 2022
@aloisklink aloisklink changed the title Test/cleanup sockctl tests Cleanup sockctl tests Sep 16, 2022
@codecov
Copy link

codecov bot commented Sep 16, 2022

Codecov Report

Merging #276 (77e6fd3) into main (1e32462) will increase coverage by 0.04%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #276      +/-   ##
==========================================
+ Coverage   47.86%   47.91%   +0.04%     
==========================================
  Files         114      114              
  Lines       18204    18221      +17     
==========================================
+ Hits         8713     8730      +17     
  Misses       9491     9491              
Impacted Files Coverage Δ
tests/supervisor/test_sockctl_server.c 92.72% <100.00%> (+0.83%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Contributor

@mereacre mereacre left a comment

Choose a reason for hiding this comment

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

Very good.

@aloisklink aloisklink merged commit 52e2529 into main Sep 16, 2022
@aloisklink aloisklink deleted the test/cleanup-sockctl-tests branch September 16, 2022 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Refactoring code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants