From 267dd15767a18b433790117d7c6fc3f77c5a1b83 Mon Sep 17 00:00:00 2001 From: dearblue Date: Sun, 6 Mar 2022 15:35:05 +0900 Subject: [PATCH] Allow build settings to define if benchmarks are covered or not Each build target can be explicitly disabled from benchmarking with `MRuby::Build#disable_benchmark`. Also, the build target "host", which was previously excluded, is now included in the benchmark. --- lib/mruby/build.rb | 9 +++++++++ tasks/benchmark.rake | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/mruby/build.rb b/lib/mruby/build.rb index 66005a6df..771aa7f3e 100644 --- a/lib/mruby/build.rb +++ b/lib/mruby/build.rb @@ -123,6 +123,7 @@ module MRuby @enable_test = false @enable_lock = true @enable_presym = true + @enable_benchmark = true @mrbcfile_external = false @internal = internal @toolchains = [] @@ -232,6 +233,14 @@ module MRuby @cxx_abi_enabled = true end + def benchmark_enabled? + @enable_benchmark + end + + def disable_benchmark + @enable_benchmark = false + end + def compile_as_cxx(src, cxx_src = nil, obj = nil, includes = []) # # If `cxx_src` is specified, this method behaves the same as before as diff --git a/tasks/benchmark.rake b/tasks/benchmark.rake index 9dbd344e5..b32d165bf 100644 --- a/tasks/benchmark.rake +++ b/tasks/benchmark.rake @@ -51,7 +51,7 @@ end MRuby.each_target do |target| - next if target.name == 'host' || target.internal? + next if !target.benchmark_enabled? || target.internal? mruby_bin = "#{target.build_dir}/bin/mruby" bm_files.each do |bm_file|