{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/coreclr/pulls/comments/39090905","id":39090905,"diff_hunk":"@@ -337,6 +337,26 @@ endif (WIN32)\n \n endif (OVERRIDE_CMAKE_CXX_FLAGS)\n \n+OPTION(CMAKE_ENABLE_CODE_COVERAGE \"Enable code coverage\" OFF)\n+\n+if(CMAKE_ENABLE_CODE_COVERAGE)\n+\n+  string(TOUPPER ${CMAKE_BUILD_TYPE} UPPERCASE_CMAKE_BUILD_TYPE)\n+  if(NOT UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG)\n+    message( WARNING \"Code coverage results with an optimised (non-Debug) build may be misleading\" )\n+  endif(NOT UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG)\n+\n+  if(CLR_CMAKE_PLATFORM_UNIX)\n+    add_definitions(-fprofile-arcs -ftest-coverage -fPIC)","path":"CMakeLists.txt","position":14,"original_position":14,"commit_id":"e75e5007860e2afd356721010a583ce3b4af5fc1","original_commit_id":"e75e5007860e2afd356721010a583ce3b4af5fc1","user":{"login":"janvorli","id":10758568,"avatar_url":"https://avatars.githubusercontent.com/u/10758568?v=3","gravatar_id":"","url":"https://api.github.com/users/janvorli","html_url":"https://github.com/janvorli","followers_url":"https://api.github.com/users/janvorli/followers","following_url":"https://api.github.com/users/janvorli/following{/other_user}","gists_url":"https://api.github.com/users/janvorli/gists{/gist_id}","starred_url":"https://api.github.com/users/janvorli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janvorli/subscriptions","organizations_url":"https://api.github.com/users/janvorli/orgs","repos_url":"https://api.github.com/users/janvorli/repos","events_url":"https://api.github.com/users/janvorli/events{/privacy}","received_events_url":"https://api.github.com/users/janvorli/received_events","type":"User","site_admin":false},"body":"Ok, thanks. So the compilation of the libcorguids.a with code coverage adds a dependency that makes it necessary to be built with the -fPIC. Could you please try to add `add_compile_options(-fPIC)` to `src\\inc\\CMakeLists.txt` before the `endif(WIN32)`? It would be nice to fix the single place where we were missing the option instead of adding it globally.","created_at":"2015-09-09T20:20:39Z","updated_at":"2015-09-09T20:20:39Z","html_url":"https://github.com/dotnet/coreclr/pull/1495#discussion_r39090905","pull_request_url":"https://api.github.com/repos/dotnet/coreclr/pulls/1495","_links":{"self":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/comments/39090905"},"html":{"href":"https://github.com/dotnet/coreclr/pull/1495#discussion_r39090905"},"pull_request":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/1495"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/coreclr/pulls/1495","id":44247577,"html_url":"https://github.com/dotnet/coreclr/pull/1495","diff_url":"https://github.com/dotnet/coreclr/pull/1495.diff","patch_url":"https://github.com/dotnet/coreclr/pull/1495.patch","issue_url":"https://api.github.com/repos/dotnet/coreclr/issues/1495","number":1495,"state":"open","locked":false,"title":"Build Code Coverage instrumented binaries for native binaries in Linux and OSX","user":{"login":"Sridhar-MS","id":9423246,"avatar_url":"https://avatars.githubusercontent.com/u/9423246?v=3","gravatar_id":"","url":"https://api.github.com/users/Sridhar-MS","html_url":"https://github.com/Sridhar-MS","followers_url":"https://api.github.com/users/Sridhar-MS/followers","following_url":"https://api.github.com/users/Sridhar-MS/following{/other_user}","gists_url":"https://api.github.com/users/Sridhar-MS/gists{/gist_id}","starred_url":"https://api.github.com/users/Sridhar-MS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sridhar-MS/subscriptions","organizations_url":"https://api.github.com/users/Sridhar-MS/orgs","repos_url":"https://api.github.com/users/Sridhar-MS/repos","events_url":"https://api.github.com/users/Sridhar-MS/events{/privacy}","received_events_url":"https://api.github.com/users/Sridhar-MS/received_events","type":"User","site_admin":false},"body":"Add an option in build.sh called 'coverage' to produce gcov-style instrumented builds.\r\nExample usage - ./build.sh debug coverage clean\r\n\r\nThis will generate the '.gcno' notes files for each object file in the same directory along with the instrumented native binaries. These .gcno files contain some of the coverage data like source line mappings, basic block graphs info etc.\r\n\r\nEach time these instrumented binaries are run, a separate .gcda file is created for each object file in the same directory. These .gcda files contain arc transition counts, and some summary information.\r\n\r\nCode Coverage reports can be generated from the .gcno and .gcda files using a tool like gcovr or lcov. *But this commit is only for generating the .gcno files while compiling with the 'coverage' option.*\r\n\r\nThe next steps\r\n - Add option in run-test.sh to generate code-coverage reports using the instrumented native binaries.\r\n - Integrate with Jenkins CI to do code-coverage runs.\r\n\r\nSample Report:\r\n![image](https://cloud.githubusercontent.com/assets/9423246/9691458/706ec62e-52f7-11e5-9758-80e5de11b8fd.png)\r\n\r\n![image](https://cloud.githubusercontent.com/assets/9423246/9691500/a300c286-52f7-11e5-8905-c72bf703c9a2.png)\r\n","created_at":"2015-09-04T18:26:11Z","updated_at":"2015-09-09T20:20:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c77d316b8e7fc44a0a3925ca37397f51ac04919d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/coreclr/pulls/1495/commits","review_comments_url":"https://api.github.com/repos/dotnet/coreclr/pulls/1495/comments","review_comment_url":"https://api.github.com/repos/dotnet/coreclr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/coreclr/issues/1495/comments","statuses_url":"https://api.github.com/repos/dotnet/coreclr/statuses/e75e5007860e2afd356721010a583ce3b4af5fc1","head":{"label":"Sridhar-MS:code-coverage","ref":"code-coverage","sha":"e75e5007860e2afd356721010a583ce3b4af5fc1","user":{"login":"Sridhar-MS","id":9423246,"avatar_url":"https://avatars.githubusercontent.com/u/9423246?v=3","gravatar_id":"","url":"https://api.github.com/users/Sridhar-MS","html_url":"https://github.com/Sridhar-MS","followers_url":"https://api.github.com/users/Sridhar-MS/followers","following_url":"https://api.github.com/users/Sridhar-MS/following{/other_user}","gists_url":"https://api.github.com/users/Sridhar-MS/gists{/gist_id}","starred_url":"https://api.github.com/users/Sridhar-MS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sridhar-MS/subscriptions","organizations_url":"https://api.github.com/users/Sridhar-MS/orgs","repos_url":"https://api.github.com/users/Sridhar-MS/repos","events_url":"https://api.github.com/users/Sridhar-MS/events{/privacy}","received_events_url":"https://api.github.com/users/Sridhar-MS/received_events","type":"User","site_admin":false},"repo":{"id":39478658,"name":"coreclr","full_name":"Sridhar-MS/coreclr","owner":{"login":"Sridhar-MS","id":9423246,"avatar_url":"https://avatars.githubusercontent.com/u/9423246?v=3","gravatar_id":"","url":"https://api.github.com/users/Sridhar-MS","html_url":"https://github.com/Sridhar-MS","followers_url":"https://api.github.com/users/Sridhar-MS/followers","following_url":"https://api.github.com/users/Sridhar-MS/following{/other_user}","gists_url":"https://api.github.com/users/Sridhar-MS/gists{/gist_id}","starred_url":"https://api.github.com/users/Sridhar-MS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sridhar-MS/subscriptions","organizations_url":"https://api.github.com/users/Sridhar-MS/orgs","repos_url":"https://api.github.com/users/Sridhar-MS/repos","events_url":"https://api.github.com/users/Sridhar-MS/events{/privacy}","received_events_url":"https://api.github.com/users/Sridhar-MS/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Sridhar-MS/coreclr","description":"This repo contains the .NET Core runtime, called CoreCLR, and the base library, called mscorlib. It includes the garbage collector, JIT compiler, base .NET data types and many low-level classes.","fork":true,"url":"https://api.github.com/repos/Sridhar-MS/coreclr","forks_url":"https://api.github.com/repos/Sridhar-MS/coreclr/forks","keys_url":"https://api.github.com/repos/Sridhar-MS/coreclr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Sridhar-MS/coreclr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Sridhar-MS/coreclr/teams","hooks_url":"https://api.github.com/repos/Sridhar-MS/coreclr/hooks","issue_events_url":"https://api.github.com/repos/Sridhar-MS/coreclr/issues/events{/number}","events_url":"https://api.github.com/repos/Sridhar-MS/coreclr/events","assignees_url":"https://api.github.com/repos/Sridhar-MS/coreclr/assignees{/user}","branches_url":"https://api.github.com/repos/Sridhar-MS/coreclr/branches{/branch}","tags_url":"https://api.github.com/repos/Sridhar-MS/coreclr/tags","blobs_url":"https://api.github.com/repos/Sridhar-MS/coreclr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Sridhar-MS/coreclr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Sridhar-MS/coreclr/git/refs{/sha}","trees_url":"https://api.github.com/repos/Sridhar-MS/coreclr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Sridhar-MS/coreclr/statuses/{sha}","languages_url":"https://api.github.com/repos/Sridhar-MS/coreclr/languages","stargazers_url":"https://api.github.com/repos/Sridhar-MS/coreclr/stargazers","contributors_url":"https://api.github.com/repos/Sridhar-MS/coreclr/contributors","subscribers_url":"https://api.github.com/repos/Sridhar-MS/coreclr/subscribers","subscription_url":"https://api.github.com/repos/Sridhar-MS/coreclr/subscription","commits_url":"https://api.github.com/repos/Sridhar-MS/coreclr/commits{/sha}","git_commits_url":"https://api.github.com/repos/Sridhar-MS/coreclr/git/commits{/sha}","comments_url":"https://api.github.com/repos/Sridhar-MS/coreclr/comments{/number}","issue_comment_url":"https://api.github.com/repos/Sridhar-MS/coreclr/issues/comments{/number}","contents_url":"https://api.github.com/repos/Sridhar-MS/coreclr/contents/{+path}","compare_url":"https://api.github.com/repos/Sridhar-MS/coreclr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Sridhar-MS/coreclr/merges","archive_url":"https://api.github.com/repos/Sridhar-MS/coreclr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Sridhar-MS/coreclr/downloads","issues_url":"https://api.github.com/repos/Sridhar-MS/coreclr/issues{/number}","pulls_url":"https://api.github.com/repos/Sridhar-MS/coreclr/pulls{/number}","milestones_url":"https://api.github.com/repos/Sridhar-MS/coreclr/milestones{/number}","notifications_url":"https://api.github.com/repos/Sridhar-MS/coreclr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Sridhar-MS/coreclr/labels{/name}","releases_url":"https://api.github.com/repos/Sridhar-MS/coreclr/releases{/id}","created_at":"2015-07-22T01:30:17Z","updated_at":"2015-07-22T01:30:54Z","pushed_at":"2015-09-08T18:15:33Z","git_url":"git://github.com/Sridhar-MS/coreclr.git","ssh_url":"git@github.com:Sridhar-MS/coreclr.git","clone_url":"https://github.com/Sridhar-MS/coreclr.git","svn_url":"https://github.com/Sridhar-MS/coreclr","homepage":"http://dotnet.github.io/core/","size":37218,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"b6c0cdc4d52455dbff31cfe621149be348150728","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":30092893,"name":"coreclr","full_name":"dotnet/coreclr","owner":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotnet/coreclr","description":"This repo contains the .NET Core runtime, called CoreCLR, and the base library, called mscorlib. It includes the garbage collector, JIT compiler, base .NET data types and many low-level classes.","fork":false,"url":"https://api.github.com/repos/dotnet/coreclr","forks_url":"https://api.github.com/repos/dotnet/coreclr/forks","keys_url":"https://api.github.com/repos/dotnet/coreclr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/coreclr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/coreclr/teams","hooks_url":"https://api.github.com/repos/dotnet/coreclr/hooks","issue_events_url":"https://api.github.com/repos/dotnet/coreclr/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/coreclr/events","assignees_url":"https://api.github.com/repos/dotnet/coreclr/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/coreclr/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/coreclr/tags","blobs_url":"https://api.github.com/repos/dotnet/coreclr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/coreclr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/coreclr/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/coreclr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/coreclr/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/coreclr/languages","stargazers_url":"https://api.github.com/repos/dotnet/coreclr/stargazers","contributors_url":"https://api.github.com/repos/dotnet/coreclr/contributors","subscribers_url":"https://api.github.com/repos/dotnet/coreclr/subscribers","subscription_url":"https://api.github.com/repos/dotnet/coreclr/subscription","commits_url":"https://api.github.com/repos/dotnet/coreclr/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/coreclr/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/coreclr/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/coreclr/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/coreclr/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/coreclr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/coreclr/merges","archive_url":"https://api.github.com/repos/dotnet/coreclr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/coreclr/downloads","issues_url":"https://api.github.com/repos/dotnet/coreclr/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/coreclr/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/coreclr/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/coreclr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/coreclr/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/coreclr/releases{/id}","created_at":"2015-01-30T22:10:02Z","updated_at":"2015-09-09T18:38:43Z","pushed_at":"2015-09-09T20:13:23Z","git_url":"git://github.com/dotnet/coreclr.git","ssh_url":"git@github.com:dotnet/coreclr.git","clone_url":"https://github.com/dotnet/coreclr.git","svn_url":"https://github.com/dotnet/coreclr","homepage":"http://dotnet.github.io/core/","size":54069,"stargazers_count":5144,"watchers_count":5144,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1034,"mirror_url":null,"open_issues_count":267,"forks":1034,"open_issues":267,"watchers":5144,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/1495"},"html":{"href":"https://github.com/dotnet/coreclr/pull/1495"},"issue":{"href":"https://api.github.com/repos/dotnet/coreclr/issues/1495"},"comments":{"href":"https://api.github.com/repos/dotnet/coreclr/issues/1495/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/1495/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/1495/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/coreclr/statuses/e75e5007860e2afd356721010a583ce3b4af5fc1"}}}}