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 coverage of forking programs #785

Closed
bel2125 opened this issue May 23, 2016 · 1 comment
Closed

Test coverage of forking programs #785

bel2125 opened this issue May 23, 2016 · 1 comment

Comments

@bel2125
Copy link

bel2125 commented May 23, 2016

I think there is a principal issue when detecting the coverage of C programs using fork().
Imagine the following code:

static pid_t spawn_process(...)
{
    pid_t t;

    init_code(); // correctly detected as covered

    t = fork();
    if (t==0) {
        child_code(); // always detected as not covered
    } else if (t==-1) {
        error_code();  // impossible to test / not covered
    } else {
        parent_code(); // correctly detected as covered
    }
    return t; // detected as covered, counting only parents
}

I wonder if this is an inherent problem of the way coverage is detected, or if something can be configured differently, changed in the Travis CI script. I did not find any hints in the cpp-coveralls documentation, or in the gcov documentation. Maybe it's indeed impossible? Does anyone know?

Alternatively: Is there a way to mark the sections as "covered" or "un-cover-able" in the code? Some pragma or magic comment?

Or is this some limitation we just have to live with?

@stale
Copy link

stale bot commented Apr 3, 2020

This issue has been automatically marked for closure because it has not had recent activity. It will be closed if no further activity occurs. If your issue is still active please add a comment and we’ll review as soon as we can. Thank you for your contributions.

@stale stale bot closed this as completed Apr 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants