From 07b7db2f81a8052ae60c31720251bda1ce911824 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Fri, 2 Nov 2018 07:53:57 +0100 Subject: [PATCH] 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: https://github.com/nodejs/node/pull/24033 Reviewed-By: Richard Lau Reviewed-By: Refael Ackermann Reviewed-By: James M Snell --- Makefile | 8 ++++---- benchmark/common.js | 2 ++ benchmark/napi/function_args/index.js | 4 ++-- benchmark/napi/function_call/index.js | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index d24451f4289414..2c7c52d262fe1a 100644 --- a/Makefile +++ b/Makefile @@ -308,7 +308,7 @@ test-valgrind: all test-check-deopts: all $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) --check-deopts parallel sequential -benchmark/napi/function_call/build/Release/binding.node: \ +benchmark/napi/function_call/build/$(BUILDTYPE)/binding.node: \ benchmark/napi/function_call/napi_binding.c \ benchmark/napi/function_call/binding.cc \ benchmark/napi/function_call/binding.gyp | all @@ -317,7 +317,7 @@ benchmark/napi/function_call/build/Release/binding.node: \ --directory="$(shell pwd)/benchmark/napi/function_call" \ --nodedir="$(shell pwd)" -benchmark/napi/function_args/build/Release/binding.node: \ +benchmark/napi/function_args/build/$(BUILDTYPE)/binding.node: \ benchmark/napi/function_args/napi_binding.c \ benchmark/napi/function_args/binding.cc \ benchmark/napi/function_args/binding.gyp | all @@ -1046,8 +1046,8 @@ bench: bench-addons-build # Build required addons for benchmark before running it. .PHONY: bench-addons-build -bench-addons-build: benchmark/napi/function_call/build/Release/binding.node \ - benchmark/napi/function_args/build/Release/binding.node +bench-addons-build: benchmark/napi/function_call/build/$(BUILDTYPE)/binding.node \ + benchmark/napi/function_args/build/$(BUILDTYPE)/binding.node .PHONY: bench-addons-clean bench-addons-clean: diff --git a/benchmark/common.js b/benchmark/common.js index 148f51830f7b8d..bc4177d512d037 100644 --- a/benchmark/common.js +++ b/benchmark/common.js @@ -3,6 +3,8 @@ const child_process = require('child_process'); const http_benchmarkers = require('./_http-benchmarkers.js'); +exports.buildType = process.features.debug ? 'Debug' : 'Release'; + exports.createBenchmark = function(fn, configs, options) { return new Benchmark(fn, configs, options); }; diff --git a/benchmark/napi/function_args/index.js b/benchmark/napi/function_args/index.js index c41b5d78abadd9..df567dcfcc55bc 100644 --- a/benchmark/napi/function_args/index.js +++ b/benchmark/napi/function_args/index.js @@ -10,14 +10,14 @@ let v8; let napi; try { - v8 = require('./build/Release/binding'); + v8 = require(`./build/${common.buildType}/binding`); } catch { console.error(`${__filename}: V8 Binding failed to load`); process.exit(0); } try { - napi = require('./build/Release/napi_binding'); + napi = require(`./build/${common.buildType}/napi_binding`); } catch { console.error(`${__filename}: NAPI-Binding failed to load`); process.exit(0); diff --git a/benchmark/napi/function_call/index.js b/benchmark/napi/function_call/index.js index 272c41662d2830..59063e500f7a84 100644 --- a/benchmark/napi/function_call/index.js +++ b/benchmark/napi/function_call/index.js @@ -12,7 +12,7 @@ const common = require('../../common.js'); // abort quietly. try { - var binding = require('./build/Release/binding'); + var binding = require(`./build/${common.buildType}/binding`); } catch { console.error('misc/function_call.js Binding failed to load'); process.exit(0); @@ -21,7 +21,7 @@ const cxx = binding.hello; let napi_binding; try { - napi_binding = require('./build/Release/napi_binding'); + napi_binding = require(`./build/${common.buildType}/napi_binding`); } catch { console.error('misc/function_call/index.js NAPI-Binding failed to load'); process.exit(0);