Skip to content

Commit

Permalink
[PROF-8667] Keep native ext compilation in main due to profiling conf…
Browse files Browse the repository at this point in the history
…ig tests
  • Loading branch information
AlexJF committed Dec 12, 2023
1 parent bcae1c5 commit b17e4fa
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -332,13 +332,23 @@ namespace :spec do
:elasticsearch, :http, :redis, :sidekiq, :sinatra, :hanami, :hanami_autoinstrument,
:profiling]

task :compile_native_extensions do
# "bundle exec rake compile" currently only works on MRI Ruby on Linux
if RUBY_ENGINE == 'ruby' && OS.linux? && Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.3.0')
Rake::Task[:clean].invoke
Rake::Task[:compile].invoke
end
end

desc '' # "Explicitly hiding from `rake -T`"
RSpec::Core::RakeTask.new(:main) do |t, args|
t.pattern = 'spec/**/*_spec.rb'
t.exclude_pattern = 'spec/**/{contrib,benchmark,redis,opentracer,auto_instrument,opentelemetry,profiling}/**/*_spec.rb,'\
' spec/**/{auto_instrument,opentelemetry}_spec.rb'
t.rspec_opts = args.to_a.join(' ')
end
# Some of the profiling-related core config tests require native extensions to be built
Rake::Task[:main].enhance([:compile_native_extensions])

RSpec::Core::RakeTask.new(:benchmark) do |t, args|
t.pattern = 'spec/ddtrace/benchmark/**/*_spec.rb'
Expand Down Expand Up @@ -541,14 +551,6 @@ namespace :spec do
namespace :profiling do
task all: [:main, :ractors]

task :setup do
# "bundle exec rake compile" currently only works on MRI Ruby on Linux
if RUBY_ENGINE == 'ruby' && OS.linux? && Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.3.0')
Rake::Task[:clean].invoke
Rake::Task[:compile].invoke
end
end

# 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
Expand All @@ -559,14 +561,14 @@ namespace :spec do
t.pattern = 'spec/datadog/profiling/**/*_spec.rb'
t.rspec_opts = [*args.to_a, '-t ~ractors'].join(' ')
end
Rake::Task[:main].enhance([:setup])

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
Rake::Task[:ractors].enhance([:setup])

Rake::Task[:all].prerequisite_tasks.each { |t| t.enhance([:compile_native_extensions]) }
end

task profiling: [:'profiling:all']
Expand Down

0 comments on commit b17e4fa

Please sign in to comment.