Node: Test failing in Debug mode

Created on 24 Jul 2016  路  8Comments  路  Source: nodejs/node

The test for addons/repl-domain-abort is failing, when configure was run in debug mode:

./configure --debug && make -j48 test

The assertion in the test test/addons/repl-domain-abort/test.js fails:

/usr/bin/python tools/test.py --mode=release -J \
        addons doctool known_issues message pseudo-tty parallel sequential
=== release test ===                                                           
Path: addons/repl-domain-abort/test
assert.js:89
  throw new assert.AssertionError({
  ^
AssertionError: false == true
    at process.<anonymous> (/usr/local/google/home/franzih/node/test/addons/repl-domain-abort/test.js:15:3)
    at emitOne (events.js:101:20)
    at process.emit (events.js:188:7)
Command: out/Release/node /usr/local/google/home/franzih/node/test/addons/repl-domain-abort/test.js

With some debug statements, turns out the binding module cannot be found:

Error: Cannot find module '/usr/local/google/home/franzih/node/test/addons/repl-domain-abort/build/Debug/binding'

Should build/Debug be created or should the correct path be build/Release/binding?

addons test

All 8 comments

I think the issue with that particular test is that it looks at the default_configuration whereas most other add-on tests simply load the the binding.node from a hard-coded path. Does this patch fix the issue for you?

diff --git a/test/addons/repl-domain-abort/test.js b/test/addons/repl-domain-abort/test.js
index 5591b4f..057af4f 100644
--- a/test/addons/repl-domain-abort/test.js
+++ b/test/addons/repl-domain-abort/test.js
@@ -4,8 +4,7 @@ var assert = require('assert');
 var repl = require('repl');
 var stream = require('stream');
 var path = require('path');
-var buildType = process.config.target_defaults.default_configuration;
-var buildPath = path.join(__dirname, 'build', buildType, 'binding');
+var buildPath = path.join(__dirname, 'build/Release/binding');
 // On Windows, escape backslashes in the path before passing it to REPL.
 if (common.isWindows)
   buildPath = buildPath.replace(/\\/g, '/');

Should build/Debug be created or should the correct path be build/Release/binding?

As mentioned, most tests use a hard-coded path but that is arguably wrong: node-gyp builds add-ons in debug mode when a) --debug is passed, or b) the node binary used to build it is a debug build; the latter is something of a historical artifact.

IOW, build/Debug is the correct path some of the time but the tests don't currently respect it.

Thanks, that fixes it. I can't figure out how to generate build/Debug. I thought BUILDTYPE=Debug would do that.

You have to pass --debug on the command line or npm_config_debug=1 in the environment.

I don't mean to high jack this issue but it is somewhat related. I had an issue getting the add-on tests to run again after configured with --debug. What I mean is that I re-ran ./configure without the --debug option to generate a Release build.

My issue was that when running the tests, the build-addons target would not update the addon's config.gypi which still referred to "default_configuration": "Debug". To force an update I deleted test/addons/.buildstamp, and this allowed me to run the tests.

Should the removal of test/addons/.buildstamp perhaps be part of a target like clean or distclean?

@danbev I'm having similar issues. Especially after switching back from older branches.

@fhinkel Good to know that it is not just me :) I'll create a PR with a suggestion for handling.

@fhinkel Should this issue remain open?

No :rofl:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stevenvachon picture stevenvachon  路  3Comments

danielstaleiny picture danielstaleiny  路  3Comments

dfahlander picture dfahlander  路  3Comments

jmichae3 picture jmichae3  路  3Comments

mcollina picture mcollina  路  3Comments