Skip to content

Commit 0c9d86f

Browse files
danbevBridgeAR
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 <riclau@uk.ibm.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 762bb94 commit 0c9d86f

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
@@ -1050,8 +1050,8 @@ bench: bench-addons-build
10501050

10511051
# Build required addons for benchmark before running it.
10521052
.PHONY: bench-addons-build
1053-
bench-addons-build: benchmark/napi/function_call/build/Release/binding.node \
1054-
benchmark/napi/function_args/build/Release/binding.node
1053+
bench-addons-build: benchmark/napi/function_call/build/$(BUILDTYPE)/binding.node \
1054+
benchmark/napi/function_args/build/$(BUILDTYPE)/binding.node
10551055

10561056
.PHONY: bench-addons-clean
10571057
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)