Conversation
| @@ -58,10 +58,7 @@ WERROR=false make | |||
| Enable additional sanitizers to catch hard-to-find bugs, for example: | |||
There was a problem hiding this comment.
Perhaps this could say something like:
Run tests locally with compile flags enabled to catch hard-to-find bugs (see this PR for more info):
make sanitize
The sanitizers are also run for a variety builds via Travis.
There was a problem hiding this comment.
Sweet, added a comment inline. Also, I pulled the branch down to run make sanitize locally and got the following error. Looks like leak flag isnt supported by x86_64-apple-darwin16.5.0, or perhaps my version of clang?
Details
clang-4.0: error: unsupported option '-fsanitize=leak' for target 'x86_64-apple-darwin16.5.0'
make[2]: *** [Debug/obj.target/module/src/module.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/carol/.nvm/versions/node/v4.4.5/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:285:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 16.5.0
gyp ERR! command "/Users/carol/.nvm/versions/node/v4.4.5/bin/node" "/Users/carol/.nvm/versions/node/v4.4.5/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--error_on_warnings=true" "--loglevel=error" "--debug" "--module=/Users/carol/dev/node-cpp-skel/lib/binding/module.node" "--module_name=module" "--module_path=/Users/carol/dev/node-cpp-skel/lib/binding"
gyp ERR! cwd /Users/carol/dev/node-cpp-skel
gyp ERR! node -v v4.4.5
gyp ERR! node-gyp -v v3.6.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/Users/carol/.nvm/versions/node/v4.4.5/bin/node /Users/carol/.nvm/versions/node/v4.4.5/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --error_on_warnings=true --loglevel=error --debug --module=/Users/carol/dev/node-cpp-skel/lib/binding/module.node --module_name=module --module_path=/Users/carol/dev/node-cpp-skel/lib/binding' (1)
node-pre-gyp ERR! stack at ChildProcess. (/Users/carol/dev/node-cpp-skel/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:87:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:172:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:827:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
node-pre-gyp ERR! System Darwin 16.5.0
node-pre-gyp ERR! command "/Users/carol/.nvm/versions/node/v4.4.5/bin/node" "/Users/carol/dev/node-cpp-skel/node_modules/.bin/node-pre-gyp" "configure" "build" "--error_on_warnings=true" "--loglevel=error" "--debug"
node-pre-gyp ERR! cwd /Users/carol/dev/node-cpp-skel
node-pre-gyp ERR! node -v v4.4.5
node-pre-gyp ERR! node-pre-gyp -v v0.6.36
node-pre-gyp ERR! not ok
Failed to execute '/Users/carol/.nvm/versions/node/v4.4.5/bin/node /Users/carol/.nvm/versions/node/v4.4.5/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --error_on_warnings=true --loglevel=error --debug --module=/Users/carol/dev/node-cpp-skel/lib/binding/module.node --module_name=module --module_path=/Users/carol/dev/node-cpp-skel/lib/binding' (1)
make[1]: *** [debug] Error 1
make: *** [sanitize] Error 2
There was a problem hiding this comment.
make distclean cleared it up. Local sanitize looks 👍
| make sanitize | ||
| ``` | ||
|
|
||
| The sanitizers [are part of the compiler](https://github.com/mapbox/cpp/blob/master/glossary.md#sanitizers) are also run in a specific job on Travis. |
There was a problem hiding this comment.
"and are also run in a specific job on Travis"
Looks good, thanks @springmeyer !
Running with the clang++ sanitizers (
-fsanitize=address,undefined,integer,leak) locally should be easy. It is now. Just run:Which will build with all key sanitizers enabled and run the tests. This should work on both Linux and OS X. It handles these various gochas which otherwise make setting up the sanitizers locally a difficult and error prone task:
ASAN_OPTIONS=detect_leaks:1to enable leak checking on OS XLD_PRELOADvsDYLD_INSERT_LIBRARIESnpm testcommand on OS X will fail sinceDYLD_INSERT_LIBRARIEScannot be inherited by shells so we callnode test/*.test.jsdirectly to workaround this limitationllvm-symbolizeris located with theASAN_SYMBOLIZER_PATH(done in./scripts/setup.sh)Builds upon #75.
/cc @GretaCB