Skip to content

Commit

Permalink
Temporarily disable linking to libddprof
Browse files Browse the repository at this point in the history
This is a temporary measure to simplify PR
<#1885>.

A later PR will re-enable all of this.
  • Loading branch information
ivoanjo committed May 16, 2022
1 parent 1146f38 commit be6fb26
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 50 deletions.
34 changes: 18 additions & 16 deletions ext/ddtrace_profiling_native_extension/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,22 +78,24 @@ def add_compiler_flag(flag)
end

# If we got here, libddprof is available and loaded
ENV['PKG_CONFIG_PATH'] = "#{ENV['PKG_CONFIG_PATH']}:#{Libddprof.pkgconfig_folder}"
unless pkg_config('ddprof_ffi')
$stderr.puts(%(
+------------------------------------------------------------------------------+
| Skipping build of profiling native extension: |
| failed to configure `libddprof` for compilation. |
| |
| The Datadog Continuous Profiler will not be available, |
| but all other ddtrace features will work fine! |
| |
| For help solving this issue, please contact Datadog support at |
| <https://docs.datadoghq.com/help/>. |
+------------------------------------------------------------------------------+
))
skip_building_extension!
end

# TODO: Temporarily disabled for PR https://github.com/DataDog/dd-trace-rb/pull/1885; will be re-enabled in a follow-up PR
# ENV['PKG_CONFIG_PATH'] = "#{ENV['PKG_CONFIG_PATH']}:#{Libddprof.pkgconfig_folder}"
# unless pkg_config('ddprof_ffi')
# $stderr.puts(%(
# +------------------------------------------------------------------------------+
# | Skipping build of profiling native extension: |
# | failed to configure `libddprof` for compilation. |
# | |
# | The Datadog Continuous Profiler will not be available, |
# | but all other ddtrace features will work fine! |
# | |
# | For help solving this issue, please contact Datadog support at |
# | <https://docs.datadoghq.com/help/>. |
# +------------------------------------------------------------------------------+
# ))
# skip_building_extension!
# end

# Tag the native extension library with the Ruby version and Ruby platform.
# This makes it easier for development (avoids "oops I forgot to rebuild when I switched my Ruby") and ensures that
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@ def self.unsupported_reason
on_truffleruby? ||
on_windows? ||
on_unknown_os? ||
not_on_x86_64? ||
expected_to_use_mjit_but_mjit_is_disabled? ||
libddprof_not_usable?
# TODO: Temporarily disabled for PR https://github.com/DataDog/dd-trace-rb/pull/1885; will be updated in
# follow-up PR
# not_on_x86_64? ||
expected_to_use_mjit_but_mjit_is_disabled?
# TODO: Temporarily disabled for PR https://github.com/DataDog/dd-trace-rb/pull/1885; will be updated in
# follow-up PR
# libddprof_not_usable?
end

private_class_method def self.disabled_via_env?
Expand Down
64 changes: 33 additions & 31 deletions spec/datadog/profiling/native_extension_helpers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,51 +63,53 @@
it { is_expected.to include 'operating system is not supported' }
end

context 'when not on x86-64' do
before { stub_const('RUBY_PLATFORM', 'aarch64-linux') }
# TODO: Temporarily disabled for PR https://github.com/DataDog/dd-trace-rb/pull/1885; will be updated in
# follow-up PR
# context 'when not on x86-64' do
# before { stub_const('RUBY_PLATFORM', 'aarch64-linux') }

it { is_expected.to include 'architecture is not supported' }
end
# it { is_expected.to include 'architecture is not supported' }
# end

context 'when on x86-64 linux' do
before { stub_const('RUBY_PLATFORM', 'x86_64-linux') }

shared_examples 'libddprof usable' do
context 'when libddprof is not available' do
before do
allow(described_class)
.to receive(:require).with('libddprof').and_raise(LoadError.new('Testing failed require'))
end
# context 'when libddprof is not available' do
# before do
# allow(described_class)
# .to receive(:require).with('libddprof').and_raise(LoadError.new('Testing failed require'))
# end

it { is_expected.to include '`libddprof` gem is not available' }
end
# it { is_expected.to include '`libddprof` gem is not available' }
# end

context 'when libddprof is available' do
context 'but DOES NOT have binaries' do
before { expect(Libddprof).to receive(:binaries?).and_return(false) }
# context 'when libddprof is available' do
# context 'but DOES NOT have binaries' do
# before { expect(Libddprof).to receive(:binaries?).and_return(false) }

it { is_expected.to include 'gem installed on your system is missing platform-specific' }
end
# it { is_expected.to include 'gem installed on your system is missing platform-specific' }
# end

context 'and DOES have binaries' do
before { expect(Libddprof).to receive(:binaries?).and_return(true) }
# context 'and DOES have binaries' do
# before { expect(Libddprof).to receive(:binaries?).and_return(true) }

context 'but DOES NOT HAVE binaries for the current platform' do
before do
expect(Libddprof).to receive(:pkgconfig_folder).and_return(nil)
expect(Libddprof).to receive(:available_binaries).and_return(%w[fooarch-linux bararch-linux-musl])
end
# context 'but DOES NOT HAVE binaries for the current platform' do
# before do
# expect(Libddprof).to receive(:pkgconfig_folder).and_return(nil)
# expect(Libddprof).to receive(:available_binaries).and_return(%w[fooarch-linux bararch-linux-musl])
# end

it { is_expected.to include 'platform variant' }
end
# it { is_expected.to include 'platform variant' }
# end

context 'and HAS BINARIES for the current platform' do
before { expect(Libddprof).to receive(:pkgconfig_folder).and_return('/simulated/pkgconfig_folder') }
# context 'and HAS BINARIES for the current platform' do
# before { expect(Libddprof).to receive(:pkgconfig_folder).and_return('/simulated/pkgconfig_folder') }

it { is_expected.to be nil }
end
end
end
it { is_expected.to be nil }
# end
# end
# end
end

context 'when Ruby CAN NOT use the MJIT header' do
Expand Down

0 comments on commit be6fb26

Please sign in to comment.