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

build: add c++ coverage support on macOS #16163

Merged
merged 1 commit into from
Oct 18, 2017

Conversation

evanlucas
Copy link
Contributor

macOS requires passing the --coverage flag in OTHER_LDFLAGS and
OTHER_CFLAGS in xcode_settings.

Checklist
Affected core subsystem(s)

build

@nodejs-github-bot nodejs-github-bot added the build Issues and PRs related to build files or the CI. label Oct 12, 2017
Copy link
Member

@jasnell jasnell left a comment

Choose a reason for hiding this comment

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

rubber stampy LGTM. Looked it over, didn't see anything that was problematic, but cannot test on macos at the moment.

Makefile Outdated
@@ -34,6 +35,10 @@ ifdef DISABLE_V8_I18N
V8_BUILD_OPTIONS += i18nsupport=off
endif

ifeq ($(OSTYPE), darwin)
GCOV = xcrun llvm-cov gcov
Copy link
Member

Choose a reason for hiding this comment

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

Tiniest of nits: two space indent like the lines above.

@joyeecheung
Copy link
Member

I am still seeing 0% C++ Coverage with this patch on MacOS 10.12.4...

@evanlucas
Copy link
Contributor Author

@joyeecheung That was happening to me before too. I had to completely remove the out/ directory after running make clean. I also had to remove the use of ccache for it to work properly. This is working for me on 10.12.6. Thanks for checking!

Copy link
Contributor

@cjihrig cjihrig left a comment

Choose a reason for hiding this comment

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

Nice work

Copy link
Member

@gireeshpunathil gireeshpunathil left a comment

Choose a reason for hiding this comment

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

Copy link
Member

@mhdawson mhdawson left a comment

Choose a reason for hiding this comment

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

LGTM, good to see this get added.

@evanlucas
Copy link
Contributor Author

ping @joyeecheung, did you get a chance to try this again?

@joyeecheung
Copy link
Member

joyeecheung commented Oct 18, 2017

@evanlucas I have tried before with make clean and rm -rf out, but it's still 0%. I have upgraded my system after, let me try again...

@evanlucas
Copy link
Contributor Author

@joyeecheung are you using ccache by chance?

@joyeecheung
Copy link
Member

@evanlucas No, I don't have ccache set up. I tried again but still no luck :( Maybe this has something to do with the version of llvm toolchain that I am using?

> llvm-cov --version
LLVM (http://llvm.org/):
  LLVM version 5.0.0
  Optimized build.
  Default target: x86_64-apple-darwin16.7.0
  Host CPU: haswell

@evanlucas
Copy link
Contributor Author

@joyeecheung it very well could:

$ xcrun llvm-cov --version                                                                                                                                                                                               
Apple LLVM version 9.0.0 (clang-900.0.35)
  Optimized build.
  Default target: x86_64-apple-darwin16.7.0
  Host CPU: broadwell

Ah, are you using Xcode's cli tools or did you manually install everything?

@joyeecheung
Copy link
Member

@evanlucas Ah, I seemed to forget to rerun ./configure --coverage. It is working now! Thanks!

-n C++ coverage %:
89.6%

@evanlucas
Copy link
Contributor Author

@joyeecheung awesome thanks!

I'll land today then! Thanks!

macOS requires passing the --coverage flag in OTHER_LDFLAGS and
OTHER_CFLAGS in xcode_settings.

PR-URL: nodejs#16163
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Khaidi Chu <i@2333.moe>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
@evanlucas evanlucas closed this Oct 18, 2017
@evanlucas evanlucas deleted the macos-src-coverage branch October 18, 2017 18:58
@evanlucas evanlucas merged commit a078584 into nodejs:master Oct 18, 2017
@evanlucas
Copy link
Contributor Author

Landed in a078584. Thanks!

MylesBorins pushed a commit that referenced this pull request Oct 23, 2017
macOS requires passing the --coverage flag in OTHER_LDFLAGS and
OTHER_CFLAGS in xcode_settings.

PR-URL: #16163
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Khaidi Chu <i@2333.moe>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
addaleax pushed a commit to ayojs/ayo that referenced this pull request Oct 26, 2017
macOS requires passing the --coverage flag in OTHER_LDFLAGS and
OTHER_CFLAGS in xcode_settings.

PR-URL: nodejs/node#16163
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Khaidi Chu <i@2333.moe>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
@MylesBorins
Copy link
Contributor

Should this be backported to v6.x-staging? If yes please follow the guide and raise a backport PR, if not let me know or add the dont-land-on label.

@evanlucas
Copy link
Contributor Author

Not really necessary IMO, so I'll add the label

addaleax pushed a commit to ayojs/ayo that referenced this pull request Dec 7, 2017
macOS requires passing the --coverage flag in OTHER_LDFLAGS and
OTHER_CFLAGS in xcode_settings.

PR-URL: nodejs/node#16163
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Khaidi Chu <i@2333.moe>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI.
Projects
None yet
Development

Successfully merging this pull request may close these issues.