Skip to content

Commit fee4c4f

Browse files
committed
Backport changes related to extracted stdlibs in Ruby 3.4-3.5
[ This is a backport to the 3.1 branch. ] This is a squash of the following commits, and brings the content of Gemfile to match master: b0acc1a Make optional benchmark test in OpenSSL::OSSL#test_memcmp_timing 4312b07 Add rdoc as a development dependency. f59ec58 Use the test-unit-ruby-core gem for Test::Unit::CoreAssertions 459f20b Add prime gem to development dependency
1 parent 82548a4 commit fee4c4f

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Gemfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,8 @@ group :development do
44
gem "rake"
55
gem "rake-compiler"
66
gem "test-unit", "~> 3.0", ">= 3.4.6"
7+
gem "test-unit-ruby-core"
8+
gem "prime"
9+
# In the case of Ruby whose rdoc is not a default gem.
10+
gem "rdoc"
711
end

test/openssl/test_ossl.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# frozen_string_literal: true
22
require_relative "utils"
33

4-
require 'benchmark'
5-
64
if defined?(OpenSSL)
75

86
class OpenSSL::OSSL < OpenSSL::SSLTestCase
@@ -44,6 +42,12 @@ def test_secure_compare
4442
end
4543

4644
def test_memcmp_timing
45+
begin
46+
require "benchmark"
47+
rescue LoadError
48+
pend "Benchmark is not available in this environment. Please install it with `gem install benchmark`."
49+
end
50+
4751
# Ensure using fixed_length_secure_compare takes almost exactly the same amount of time to compare two different strings.
4852
# Regular string comparison will short-circuit on the first non-matching character, failing this test.
4953
# NOTE: this test may be susceptible to noise if the system running the tests is otherwise under load.

0 commit comments

Comments
 (0)