Skip to content

Commit 07b7db2

Browse files
danbevcodebytere
authored andcommitted
build: use BUILDTYPE in bench-addons-build targets
This commit uses the BUILDTYPE for the benchmark targets that currently explicitly use Release as the build type. The motivation for this change is allows switching between debug builds and release builds using the bench-addons-clean/bench-addons-build targets. PR-URL: #24033 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 4d1a803 commit 07b7db2

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

Makefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ test-valgrind: all
308308
test-check-deopts: all
309309
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) --check-deopts parallel sequential
310310

311-
benchmark/napi/function_call/build/Release/binding.node: \
311+
benchmark/napi/function_call/build/$(BUILDTYPE)/binding.node: \
312312
benchmark/napi/function_call/napi_binding.c \
313313
benchmark/napi/function_call/binding.cc \
314314
benchmark/napi/function_call/binding.gyp | all
@@ -317,7 +317,7 @@ benchmark/napi/function_call/build/Release/binding.node: \
317317
--directory="$(shell pwd)/benchmark/napi/function_call" \
318318
--nodedir="$(shell pwd)"
319319

320-
benchmark/napi/function_args/build/Release/binding.node: \
320+
benchmark/napi/function_args/build/$(BUILDTYPE)/binding.node: \
321321
benchmark/napi/function_args/napi_binding.c \
322322
benchmark/napi/function_args/binding.cc \
323323
benchmark/napi/function_args/binding.gyp | all
@@ -1046,8 +1046,8 @@ bench: bench-addons-build
10461046

10471047
# Build required addons for benchmark before running it.
10481048
.PHONY: bench-addons-build
1049-
bench-addons-build: benchmark/napi/function_call/build/Release/binding.node \
1050-
benchmark/napi/function_args/build/Release/binding.node
1049+
bench-addons-build: benchmark/napi/function_call/build/$(BUILDTYPE)/binding.node \
1050+
benchmark/napi/function_args/build/$(BUILDTYPE)/binding.node
10511051

10521052
.PHONY: bench-addons-clean
10531053
bench-addons-clean:

benchmark/common.js

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
const child_process = require('child_process');
44
const http_benchmarkers = require('./_http-benchmarkers.js');
55

6+
exports.buildType = process.features.debug ? 'Debug' : 'Release';
7+
68
exports.createBenchmark = function(fn, configs, options) {
79
return new Benchmark(fn, configs, options);
810
};

benchmark/napi/function_args/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ let v8;
1010
let napi;
1111

1212
try {
13-
v8 = require('./build/Release/binding');
13+
v8 = require(`./build/${common.buildType}/binding`);
1414
} catch {
1515
console.error(`${__filename}: V8 Binding failed to load`);
1616
process.exit(0);
1717
}
1818

1919
try {
20-
napi = require('./build/Release/napi_binding');
20+
napi = require(`./build/${common.buildType}/napi_binding`);
2121
} catch {
2222
console.error(`${__filename}: NAPI-Binding failed to load`);
2323
process.exit(0);

benchmark/napi/function_call/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const common = require('../../common.js');
1212
// abort quietly.
1313

1414
try {
15-
var binding = require('./build/Release/binding');
15+
var binding = require(`./build/${common.buildType}/binding`);
1616
} catch {
1717
console.error('misc/function_call.js Binding failed to load');
1818
process.exit(0);
@@ -21,7 +21,7 @@ const cxx = binding.hello;
2121

2222
let napi_binding;
2323
try {
24-
napi_binding = require('./build/Release/napi_binding');
24+
napi_binding = require(`./build/${common.buildType}/napi_binding`);
2525
} catch {
2626
console.error('misc/function_call/index.js NAPI-Binding failed to load');
2727
process.exit(0);

0 commit comments

Comments
 (0)