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

test: fix issues reported by Coverity #8870

Closed
wants to merge 0 commits into from
Closed

test: fix issues reported by Coverity #8870

wants to merge 0 commits into from

Conversation

eugeneo
Copy link
Contributor

@eugeneo eugeneo commented Sep 30, 2016

Checklist
  • make -j8 test (UNIX), or vcbuild test nosign (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

This is a refactoring of the inspector socket test case.

Description of change

Wrapped the timer into class to ensure it is cleaned up properly.

CC: @ofrobots

@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Sep 30, 2016
@eugeneo eugeneo changed the title test: fix issues reported by Coverty test: fix issues reported by Coverity Sep 30, 2016
@eugeneo eugeneo added c++ Issues and PRs that require attention from people who are familiar with C++. inspector Issues and PRs related to the V8 inspector protocol labels Sep 30, 2016
@eugeneo
Copy link
Contributor Author

eugeneo commented Oct 1, 2016

Test failures are caused by parallel/test-tick-processor-builtin and parallel/test-tick-processor-unknown and do not seem to caused by this change, that only touches cctest executable.

}
class Timeout {
public:
Timeout(uv_loop_t* loop) : timed_out(false), done_(false) {
Copy link
Member

Choose a reason for hiding this comment

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

explicit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

}
bool timed_out;
private:
static void setFlag(uv_timer_t* timer) {
Copy link
Member

Choose a reason for hiding this comment

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

Style nit: can you either call this SetFlag or set_flag? Ditto for markDone.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done (used set_flag and mark_done)

@jasnell
Copy link
Member

jasnell commented Oct 6, 2016

LGTM once @bnoordhuis is happy with it.

@eugeneo
Copy link
Contributor Author

eugeneo commented Oct 6, 2016

Thank you for the review. I uploaded a new version, please take another look.

@ofrobots
Copy link
Contributor

ofrobots commented Oct 7, 2016

LGTM

@eugeneo
Copy link
Contributor Author

eugeneo commented Oct 11, 2016

@bnoordhuis I've implemented your suggestions, please take another look.

uv_timer_t* timer = start_timer(&timed_out); \
while (((condition)) && !timed_out) { \
Timeout timeout(&loop); \
while (((condition)) && !timeout.timed_out) { \
Copy link
Member

Choose a reason for hiding this comment

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

While you're here, maybe you can remove the extraneous parentheses around condition?

eugeneo pushed a commit that referenced this pull request Oct 13, 2016
Wrapped the timer into class to ensure it is cleaned up properly.

PR-URL: #8870
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@eugeneo eugeneo closed this Oct 13, 2016
@eugeneo eugeneo deleted the coverty branch October 13, 2016 23:32
jasnell pushed a commit that referenced this pull request Oct 14, 2016
Wrapped the timer into class to ensure it is cleaned up properly.

PR-URL: #8870
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
MylesBorins pushed a commit that referenced this pull request Nov 11, 2016
Wrapped the timer into class to ensure it is cleaned up properly.

PR-URL: #8870
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@MylesBorins MylesBorins mentioned this pull request Nov 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. inspector Issues and PRs related to the V8 inspector protocol test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants