Skip to content

Analyze code coverage #1106

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 2 commits into from
Jun 22, 2015
Merged

Analyze code coverage #1106

merged 2 commits into from
Jun 22, 2015

Conversation

nulltoken
Copy link
Member

@@ -98,7 +105,18 @@ test_script:
- ps: |
If ($Env:SHOULD_RUN_COVERITY_ANALYSIS -eq $False)
{
& "$Env:xunit_runner" "$Env:APPVEYOR_BUILD_FOLDER\LibGit2Sharp.Tests\bin\Release\LibGit2Sharp.Tests.dll" /appveyor
If ($Env:SHOULD_PACKAGE_NUGET_ARTIFACT -eq $True -and $Env:publish_on_success -eq $True)
Copy link
Member

Choose a reason for hiding this comment

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

Not sure why coverage depends on $Env:SHOULD_PACKAGE_NUGET_ARTIFACT?

Copy link
Member Author

Choose a reason for hiding this comment

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

You're right. The idea is to analyze on merges. This also happen to be when we generate NuGet packages.

I think the variable is badly named. What would you call it?

Copy link
Member

Choose a reason for hiding this comment

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

Personally I'd add a separate SHOULD_RUN_COVERALLS variable.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@csMACnz
Copy link

csMACnz commented Jun 19, 2015

The problem is that appveyor removes secure token variables on PR builds. The args list becomes
... --repoToken --commitId $env:...
Which is invalid syntax. I'm still looking at how to solve this usage error ao it becomes more obvious.

If you look at my other projects, I wrap it in a condition to check for the PR build environment variable

@nulltoken
Copy link
Member Author

@csMACnz Thanks for your answer.

I've pushed this as a separate branch (see ntk/coverage...coveralls).

The log still displays the same usage pattern.

However, this time it also fails with a Command exited with code 1 message, still without any troubleshooting message. Could it be possible that the Console.Error.WriteLine() calls aren't intercepted by AppVeyor?

Another question. When the Usage is displayed, the possible options aren't. Is that expected?

/cc @FeodorFitsner

@FeodorFitsner
Copy link
Contributor

You mean AppVeyor swallows Console.Error.WriteLine() from .NET console app?

@nulltoken
Copy link
Member Author

@FeodorFitsner It might. By taking a look at source code it looks like at least one of them should be output in this log.

It's fairly possible I may be completely wrong about this though.

@csMACnz
Copy link

csMACnz commented Jun 21, 2015

Your variables don't match so its still the same problem. You declare coveralls_token then use COVERALLS_REPO_TOKEN.
Hopefully making them the same fixes your problem.

Also, the docopts.net library I use is printing the usage statements, and returning the exit code. That is why none of my console.error.writeline calls show up.

@nulltoken
Copy link
Member Author

Your variables don't match so its still the same problem. You declare coveralls_token then use COVERALLS_REPO_TOKEN.

@csMACnz 💎 Thanks a lot for having pointed me at this mistake!

@dahlbyk @jamill The coveralls branch code coverage has been successfully pushed up to coveralls.io. One can peek at the published analysis at https://coveralls.io/r/libgit2/libgit2sharp

I'm going to update the appveyor.yml file with some Console output in order to ease the troubleshooting of the build steps being run. I'll ping you when it's done.

@csMACnz Amazingly neat package and AWESOME support ‼️

@nulltoken
Copy link
Member Author

TODO:

  • Maybe not consider files under LibGit2Sharp.Tests namespace for coverage analysis (see Constants.cs)
  • Correctly configure the project root path (c:/projects/libgit2sharp/)

@dahlbyk
Copy link
Member

dahlbyk commented Jun 22, 2015

Maybe not consider files under LibGit2Sharp.Tests namespace for coverage analysis (see Constants.cs)

I see you've already done this (cb5d495) but 👍 anyway.

Correctly configure the project root path (c:/projects/libgit2sharp/)

This looks correct now as well.

Coverage numbers look correct. Low coverage on exceptions makes it kind of hard to identify actual gaps in coverage. I noticed most of our "for mocking purposes" ctors were untested, so just pushed a commit to coveralls to see how many "false negatives" we can avoid by actually trying to create mock instances.

@nulltoken
Copy link
Member Author

I noticed most of our "for mocking purposes" ctors were untested, so just pushed a commit to coveralls to see how many "false negatives" we can avoid by actually trying to create mock instances.

😍 It's just been published!

@nulltoken
Copy link
Member Author

@dahlbyk As this looks like working, I'm going to rewrite now both this PR and the coveralls branch. I'll ping you when done.

@nulltoken
Copy link
Member Author

@dahlbyk Done. Let's wait for the report to be published to coveralls.io. Once it's available, how about having this one merged?

@dahlbyk
Copy link
Member

dahlbyk commented Jun 22, 2015

:shipit:

nulltoken added a commit that referenced this pull request Jun 22, 2015
@nulltoken nulltoken merged commit c25c6e4 into vNext Jun 22, 2015
@nulltoken nulltoken deleted the ntk/coverage branch June 22, 2015 17:35
@nulltoken nulltoken added this to the v0.22 milestone Jun 22, 2015
@nulltoken
Copy link
Member Author

@dahlbyk Thanks for the help and the feedback ❤️

I've dropped all the coverage analysis. One should be automatically run during the next scheduled build (for now, daily at 00:00UTC)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants