Skip to content

Commit 2ea0f67

Browse files
committed
build, test: skip addon build by default and test separately
- Split tests to test/addon and test/plugin - Skip building addons and running addon tests in nightly and canary builds in Travis
1 parent d7fcd41 commit 2ea0f67

File tree

11 files changed

+91
-58
lines changed

11 files changed

+91
-58
lines changed

.travis.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,35 @@ matrix:
77
before_install:
88
- sudo apt-get -qq update
99
- sudo apt-get install lldb-3.9 liblldb-3.9-dev -y
10+
install: npm install --llnode_build_addon=true
11+
script: TEST_LLDB_BINARY=`which lldb-3.9` npm test
1012
node_js: "6"
1113
- sudo: required
1214
dist: trusty
1315
before_install:
1416
- sudo apt-get -qq update
1517
- sudo apt-get install lldb-3.9 liblldb-3.9-dev -y
18+
install: npm install --llnode_build_addon=true
19+
script: TEST_LLDB_BINARY=`which lldb-3.9` npm test
1620
node_js: "8"
1721
- sudo: required
1822
dist: trusty
1923
before_install:
2024
- sudo apt-get -qq update
2125
- sudo apt-get install lldb-3.9 liblldb-3.9-dev -y
26+
install: npm install --llnode_build_addon=true
27+
script: TEST_LLDB_BINARY=`which lldb-3.9` npm test
2228
node_js: "9"
2329
- sudo: required
2430
dist: trusty
2531
before_install:
2632
- sudo apt-get -qq update
2733
- sudo apt-get install lldb-3.9 liblldb-3.9-dev -y
34+
install: npm install --llnode_build_addon=true
35+
script: TEST_LLDB_BINARY=`which lldb-3.9` npm test
2836
node_js: "10"
2937
# Test Node.js master nightly build
38+
# Addon is not tested due to lack of node-addon-api
3039
- node_js: "node"
3140
sudo: required
3241
dist: trusty
@@ -35,10 +44,12 @@ matrix:
3544
- sudo apt-get install lldb-3.9 liblldb-3.9-dev -y
3645
install:
3746
- npm install --nodedir=$(dirname $(dirname $(which node)))/include/node
47+
script: TEST_LLDB_BINARY=`which lldb-3.9` npm run test-plugin
3848
env:
3949
- NVM_NODEJS_ORG_MIRROR=https://nodejs.org/download/nightly
4050
- NODEJS_ORG_MIRROR=https://nodejs.org/download/nightly
4151
# Test Node.js v8-canary nightly build
52+
# Addon is not tested due to lack of node-addon-api
4253
- node_js: "node"
4354
sudo: required
4455
dist: trusty
@@ -47,21 +58,30 @@ matrix:
4758
- sudo apt-get install lldb-3.9 liblldb-3.9-dev -y
4859
install:
4960
- npm install --nodedir=$(dirname $(dirname $(which node)))/include/node
61+
script: TEST_LLDB_BINARY=`which lldb-3.9` npm run test-plugin
5062
env:
5163
- NVM_NODEJS_ORG_MIRROR=https://nodejs.org/download/v8-canary
5264
- NODEJS_ORG_MIRROR=https://nodejs.org/download/v8-canary
5365
# Test on OS X
5466
- os: osx
5567
osx_image: xcode9.3
68+
install: npm install --llnode_build_addon=true
69+
script: npm test
5670
node_js: "6"
5771
- os: osx
5872
osx_image: xcode9.3
73+
install: npm install --llnode_build_addon=true
74+
script: npm test
5975
node_js: "8"
6076
- os: osx
6177
osx_image: xcode9.3
78+
install: npm install --llnode_build_addon=true
79+
script: npm test
6280
node_js: "9"
6381
- os: osx
6482
osx_image: xcode9.3
83+
install: npm install --llnode_build_addon=true
84+
script: npm test
6585
node_js: "10"
6686
allow_failures:
6787
# Allow the nightly installs to fail
@@ -80,4 +100,3 @@ matrix:
80100
branches:
81101
only:
82102
- master
83-
script: make _travis

Makefile

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
TEST_LLDB_BINARY ?= $(shell which lldb-3.9)
2-
31
.PHONY: all
42
all:
53
@echo "Please take a look at README.md"
@@ -41,11 +39,6 @@ plugin: configure
4139
addon: configure
4240
node-gyp rebuild
4341

44-
.PHONY: _travis
45-
_travis:
46-
TEST_LLDB_BINARY="$(TEST_LLDB_BINARY)" \
47-
npm test
48-
4942
.PHONY: clean
5043
clean:
5144
$(RM) -r build

binding.gyp

Lines changed: 46 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
# gyp does not appear to let you test for undefined variables, so define
99
# lldb_lib_dir as empty so we can test it later.
1010
"lldb_lib_dir%": "",
11-
"lldb_lib_so%": ""
11+
"lldb_lib_so%": "",
12+
"build_addon": "false",
1213
},
1314

1415
"target_defaults": {
@@ -85,47 +86,53 @@
8586
],
8687
}]
8788
]
88-
}, {
89-
"target_name": "addon",
90-
"type": "loadable_module",
91-
"include_dirs": [
92-
"<!@(node -p \"require('node-addon-api').include\")"
93-
],
94-
"defines": [ "NAPI_DISABLE_CPP_EXCEPTIONS" ],
95-
"sources": [
96-
"src/addon.cc",
97-
"src/llnode_module.cc",
98-
"src/llnode_api.cc",
99-
"src/constants.cc",
100-
"src/error.cc",
101-
"src/llv8.cc",
102-
"src/llv8-constants.cc",
103-
"src/llscan.cc",
104-
"src/node-constants.cc",
105-
],
106-
"cflags!": [ "-fno-exceptions" ],
107-
"cflags_cc!": [ "-fno-exceptions" ],
108-
"conditions": [
109-
[ "OS=='linux' or OS=='freebsd'", {
89+
}],
90+
91+
"conditions": [
92+
[ "build_addon == 'true'", {
93+
"targets": [{
94+
"target_name": "addon",
95+
"type": "loadable_module",
96+
"include_dirs": [
97+
"<!@(node -p \"require('node-addon-api').include\")"
98+
],
99+
"defines": [ "NAPI_DISABLE_CPP_EXCEPTIONS" ],
100+
"sources": [
101+
"src/addon.cc",
102+
"src/llnode_module.cc",
103+
"src/llnode_api.cc",
104+
"src/constants.cc",
105+
"src/error.cc",
106+
"src/llv8.cc",
107+
"src/llv8-constants.cc",
108+
"src/llscan.cc",
109+
"src/node-constants.cc",
110+
],
111+
"cflags!": [ "-fno-exceptions" ],
112+
"cflags_cc!": [ "-fno-exceptions" ],
110113
"conditions": [
111-
# If we could not locate the lib dir, then we will have to search
112-
# from the global search paths during linking and at runtime
113-
[ "lldb_lib_dir != ''", {
114-
"ldflags": [
115-
"-L<(lldb_lib_dir)",
116-
"-Wl,-rpath,<(lldb_lib_dir)"
114+
[ "OS=='linux' or OS=='freebsd'", {
115+
"conditions": [
116+
# If we could not locate the lib dir, then we will have to search
117+
# from the global search paths during linking and at runtime
118+
[ "lldb_lib_dir != ''", {
119+
"ldflags": [
120+
"-L<(lldb_lib_dir)",
121+
"-Wl,-rpath,<(lldb_lib_dir)"
122+
]
123+
}],
124+
# If we cannot find a non-versioned library liblldb(-x.y).so,
125+
# then we will have to link to the versioned library
126+
# liblldb(-x.y).so.z loaded by the detected lldb executable
127+
[ "lldb_lib_so != ''", {
128+
"libraries": ["<(lldb_lib_so)"]
129+
}, {
130+
"libraries": ["-l<(lldb_lib)"]
131+
}]
117132
]
118-
}],
119-
# If we cannot find a non-versioned library liblldb(-x.y).so,
120-
# then we will have to link to the versioned library
121-
# liblldb(-x.y).so.z loaded by the detected lldb executable
122-
[ "lldb_lib_so != ''", {
123-
"libraries": ["<(lldb_lib_so)"]
124-
}, {
125-
"libraries": ["-l<(lldb_lib)"]
126133
}]
127134
]
128135
}]
129-
]
130-
}]
136+
}]
137+
]
131138
}

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
"preinstall": "node scripts/configure.js",
1414
"install": "node scripts/install.js",
1515
"postinstall": "node scripts/cleanup.js",
16-
"test": "tape test/*-test.js"
16+
"test-plugin": "tape test/plugin/*-test.js",
17+
"test-addon": "tape test/addon/*-test.js",
18+
"test": "npm run test-addon && npm run test-plugin"
1719
},
1820
"repository": {
1921
"type": "git",

scripts/configure.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,27 @@ function main() {
99
const buildDir = process.cwd();
1010
console.log('Build dir is: ' + buildDir);
1111
const osName = os.type();
12-
const result = configureInstallation(osName, buildDir);
13-
writeConfig(result.config);
14-
writeLlnodeScript(buildDir, result.executable, osName);
12+
const { config, executable } = configureInstallation(osName, buildDir);
13+
configureBuildOptions(config);
14+
writeConfig(config);
15+
writeLlnodeScript(buildDir, executable, osName);
1516
// Exit with success.
1617
process.exit(0);
1718
}
1819

1920
main();
2021

22+
// Do not build addon by default until it's less experimental
23+
function configureBuildOptions(config) {
24+
const build_addon = (process.env.npm_config_llnode_build_addon ||
25+
process.env.LLNODE_BUILD_ADDON);
26+
if (build_addon) {
27+
config.variables.build_addon = build_addon;
28+
} else {
29+
config.variables.build_addon = 'false';
30+
}
31+
}
32+
2133
/**
2234
* Get and configure the lldb installation. The returned prefix
2335
* should be linked to ./lldb
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
'use strict';
22

3-
const fromCoredump = require('../').fromCoredump;
3+
const fromCoredump = require('../../').fromCoredump;
44

55
const debug = process.env.TEST_LLNODE_DEBUG ?
66
console.log.bind(console) : () => { };
77

8-
const common = require('./common');
8+
const common = require('../common');
99
const tape = require('tape');
1010

1111
tape('llnode API', (t) => {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const tape = require('tape');
44

5-
const common = require('./common');
5+
const common = require('../common');
66

77
tape('v8 stack', (t) => {
88
t.timeoutAfter(15000);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const tape = require('tape');
44

5-
const common = require('./common');
5+
const common = require('../common');
66

77
// <Object: Object elements {
88
const hashMapTests = {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
const tape = require('tape');
4-
const common = require('./common');
4+
const common = require('../common');
55
const versionMark = common.versionMark;
66

77
tape('v8 findrefs and friends', (t) => {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const tape = require('tape');
44

5-
const common = require('./common');
5+
const common = require('../common');
66

77
tape('v8 stack', (t) => {
88
t.timeoutAfter(15000);

0 commit comments

Comments
 (0)