Skip to content

Commit 9533108

Browse files
committed
[NO-TICKET] Validate that all public symbols are prefixed in Ruby releases
**What does this PR do?** This PR adds a check during packaging of Ruby releases that all symbols exported in the libdatadog shared library are correctly prefixed. **Motivation:** This allows us to catch any new unprefixed symbols, and thus we're able to rely on libdatadog not exporting symbols that would clash with other libraries that may be loaded in the same Ruby VM. **Additional Notes:** N/A **How to test the change?** You can observe the new check running with `docker-compose run push_to_rubygems`. This is safe to call as it'll stop asking for credentials before actually publishing anything to rubygems.
1 parent 866b79d commit 9533108

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

ruby/spec/gem_packaging.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,18 @@
3434
end
3535
end
3636
end
37+
38+
it "prefixes all public symbols in .so files" do
39+
so_files = Dir.glob("vendor/libdatadog-#{Libdatadog::LIB_VERSION}/**/*.so")
40+
expect(so_files.size).to be 4
41+
42+
so_files.each do |so_file|
43+
raw_symbols = `nm -D --defined-only #{so_file}`
44+
45+
symbols = raw_symbols.split("\n").map { |it| it.split(" ").last }.sort
46+
expect(symbols.size).to be > 20 # Quick sanity check
47+
48+
expect(symbols).to all(start_with("ddog_").or(start_with("blaze_")))
49+
end
50+
end
3751
end

0 commit comments

Comments
 (0)