diff --git a/Rakefile b/Rakefile index 3d45ad1d22b..6e6f0878051 100644 --- a/Rakefile +++ b/Rakefile @@ -17,6 +17,12 @@ TEST_METADATA = { 'appsec:main' => { '' => '✅ 2.1 / ✅ 2.2 / ✅ 2.3 / ✅ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ jruby' }, + 'profiling:main' => { + '' => '✅ 2.1 / ✅ 2.2 / ✅ 2.3 / ✅ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ jruby' + }, + 'profiling:ractors' => { + '' => '❌ 2.1 / ❌ 2.2 / ❌ 2.3 / ❌ 2.4 / ❌ 2.5 / ❌ 2.6 / ❌ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ jruby' + }, 'contrib' => { '' => '✅ 2.1 / ✅ 2.2 / ✅ 2.3 / ✅ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ jruby' }, @@ -535,6 +541,29 @@ namespace :spec do end task appsec: [:'appsec:all'] + + namespace :profiling do + task all: [:main, :ractors] + + # Datadog Profiling main specs without Ractor creation + # NOTE: Ractor creation will transition the entire Ruby VM into multi-ractor mode. This cannot be undone + # and, as such, may introduce side-effects between tests and make them flaky depending on order of + # execution. By splitting in two separate suites, the side-effect impact should be mitigated as + # the non-ractor VM will never trigger the transition into multi-ractor mode. + desc '' # "Explicitly hiding from `rake -T`" + RSpec::Core::RakeTask.new(:main) do |t, args| + t.pattern = 'spec/datadog/profiling/**/*_spec.rb' + t.rspec_opts = [*args.to_a, '-t ~ractors'].join(' ') + end + + desc '' # "Explicitly hiding from `rake -T`" + RSpec::Core::RakeTask.new(:ractors) do |t, args| + t.pattern = 'spec/datadog/profiling/**/*_spec.rb' + t.rspec_opts = [*args.to_a, '-t ractors'].join(' ') + end + end + + task profiling: [:'profiling:all'] end if defined?(RuboCop::RakeTask) diff --git a/spec/datadog/profiling/collectors/cpu_and_wall_time_worker_spec.rb b/spec/datadog/profiling/collectors/cpu_and_wall_time_worker_spec.rb index 21888900e7c..ef2bc0e7433 100644 --- a/spec/datadog/profiling/collectors/cpu_and_wall_time_worker_spec.rb +++ b/spec/datadog/profiling/collectors/cpu_and_wall_time_worker_spec.rb @@ -676,7 +676,7 @@ end end - context 'when called from a background ractor' do + context 'when called from a background ractor', :ractors => true do # Even though we're not testing it explicitly, the GC profiling hooks can sometimes be called when running these # specs. Unfortunately, there's a VM crash in that case as well -- https://bugs.ruby-lang.org/issues/18464 -- # so this must be disabled when interacting with Ractors. diff --git a/spec/datadog/profiling/native_extension_spec.rb b/spec/datadog/profiling/native_extension_spec.rb index f2a4c6ebe63..1cf75cdd5fd 100644 --- a/spec/datadog/profiling/native_extension_spec.rb +++ b/spec/datadog/profiling/native_extension_spec.rb @@ -82,7 +82,7 @@ it { is_expected.to be true } end - context 'on a background Ractor' do + context 'on a background Ractor', :ractors => true do # @ivoanjo: When we initially added this test, our test suite kept deadlocking in CI in a later test (not on # this one). #