Skip to content

Commit b82034f

Browse files
RUBY-3651 Add support for jruby 10 (#353)
Co-authored-by: Dmitry Rybakov <[email protected]>
1 parent 4049239 commit b82034f

File tree

12 files changed

+59
-32
lines changed

12 files changed

+59
-32
lines changed

.evergreen/config.yml

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ functions:
148148
"upload test results":
149149
- command: attach.xunit_results
150150
params:
151-
file: ./src/*/build/test-results/TEST-*.xml
151+
file: ./src/tmp/rspec.xml
152152

153153
"run tests":
154154
- command: shell.exec
@@ -249,10 +249,15 @@ axes:
249249
display_name: OS
250250
values:
251251
- id: debian
252-
display_name: "Debian 11"
253-
run_on: debian11-small
252+
display_name: "Debian 12"
253+
run_on: debian12-small
254254
variables:
255-
MACHINE: "debian11"
255+
MACHINE: "debian12"
256+
- id: "ubuntu2404"
257+
display_name: "Ubuntu 24.04"
258+
run_on: ubuntu2404-small
259+
variables:
260+
MACHINE: "ubuntu2204"
256261
- id: "ubuntu2204"
257262
display_name: "Ubuntu 22.04"
258263
run_on: ubuntu2204-small
@@ -267,11 +272,11 @@ axes:
267272
- id: "special-os"
268273
display_name: OS
269274
values:
270-
- id: "ubuntu2204-arm64"
271-
display_name: "Ubuntu 22.04 ARM64"
272-
run_on: ubuntu2204-arm64-small
275+
- id: "ubuntu2404-arm64"
276+
display_name: "Ubuntu 24.04 ARM64"
277+
run_on: ubuntu2404-arm64-small
273278
variables:
274-
MACHINE: ubuntu2204-arm64
279+
MACHINE: ubuntu2404-arm64
275280

276281
- id: ruby
277282
display_name: Ruby Version
@@ -296,6 +301,10 @@ axes:
296301
display_name: ruby-2.7
297302
variables:
298303
RVM_RUBY: ruby-2.7
304+
- id: jruby-10.0
305+
display_name: jruby-10.0
306+
variables:
307+
RVM_RUBY: jruby-10.0
299308
- id: jruby-9.4
300309
display_name: jruby-9.4
301310
variables:
@@ -390,13 +399,13 @@ buildvariants:
390399
- name: "test"
391400

392401
- matrix_name: "special-os"
393-
matrix_spec: { ruby: ["ruby-3.2", "ruby-3.1", "jruby-9.4"], special-os: '*' }
402+
matrix_spec: { ruby: ["ruby-3.2", "ruby-3.1"], special-os: '*' }
394403
display_name: "${ruby}, ${special-os}"
395404
tasks:
396405
- name: "test"
397406

398407
- matrix_name: "jruby"
399-
matrix_spec: { ruby: ["jruby-9.4", "jruby-9.3"], all-os: ubuntu2204 }
408+
matrix_spec: { ruby: ["jruby-10.0", "jruby-9.4", "jruby-9.3"], all-os: ubuntu2204 }
400409
display_name: "${ruby}, ${all-os}"
401410
tasks:
402411
- name: "test"

.evergreen/config/axes.yml.erb

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,15 @@ axes:
33
display_name: OS
44
values:
55
- id: debian
6-
display_name: "Debian 11"
7-
run_on: debian11-small
6+
display_name: "Debian 12"
7+
run_on: debian12-small
88
variables:
9-
MACHINE: "debian11"
9+
MACHINE: "debian12"
10+
- id: "ubuntu2404"
11+
display_name: "Ubuntu 24.04"
12+
run_on: ubuntu2404-small
13+
variables:
14+
MACHINE: "ubuntu2204"
1015
- id: "ubuntu2204"
1116
display_name: "Ubuntu 22.04"
1217
run_on: ubuntu2204-small
@@ -21,11 +26,11 @@ axes:
2126
- id: "special-os"
2227
display_name: OS
2328
values:
24-
- id: "ubuntu2204-arm64"
25-
display_name: "Ubuntu 22.04 ARM64"
26-
run_on: ubuntu2204-arm64-small
29+
- id: "ubuntu2404-arm64"
30+
display_name: "Ubuntu 24.04 ARM64"
31+
run_on: ubuntu2404-arm64-small
2732
variables:
28-
MACHINE: ubuntu2204-arm64
33+
MACHINE: ubuntu2404-arm64
2934

3035
- id: ruby
3136
display_name: Ruby Version

.evergreen/config/functions.yml.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ functions:
113113
"upload test results":
114114
- command: attach.xunit_results
115115
params:
116-
file: ./src/*/build/test-results/TEST-*.xml
116+
file: ./src/tmp/rspec.xml
117117

118118
"run tests":
119119
- command: shell.exec

.evergreen/config/variants.yml.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ buildvariants:
3939
- name: "test"
4040

4141
- matrix_name: "special-os"
42-
matrix_spec: { ruby: <%= recent_rubies %>, special-os: '*' }
42+
matrix_spec: { ruby: <%= recent_rubies - %w[ jruby-10.0 ] %>, special-os: '*' }
4343
display_name: "${ruby}, ${special-os}"
4444
tasks:
4545
- name: "test"

.evergreen/run-tests.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ set_env_ruby
1717

1818
install_deps
1919

20+
# TODO: move this to shared/shlib/set_env.sh
21+
export JAVA_HOME="/opt/java/jdk21"
22+
export SOURCE_VERSION=21
23+
export TARGET_VERSION=21
24+
# END TODO
25+
export CI=1
2026
echo "Running specs"
2127
bundle exec rake spec
2228
test_status=$?

.evergreen/update-evergreen-configs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ module ConfigProcessor
7575

7676
# these are used for testing against a few recent ruby versions
7777
def recent_rubies
78-
@recent_rubies ||= %w[ ruby-3.2 ruby-3.1 jruby-9.4 ]
78+
@recent_rubies ||= %w[ ruby-3.2 ruby-3.1 jruby-10.0 ]
7979
end
8080

8181
# the most recently released, stable version of Ruby (make sure this
@@ -96,7 +96,7 @@ module ConfigProcessor
9696

9797
# as above, but including the most recent JRuby release
9898
def sample_rubies
99-
@sample_rubies ||= sample_mri_rubies + %w[ jruby-9.4 ]
99+
@sample_rubies ||= sample_mri_rubies + %w[ jruby-10.0 ]
100100
end
101101

102102
# older Ruby versions provided by 10gen/mongo-ruby-toolchain
@@ -106,7 +106,7 @@ module ConfigProcessor
106106

107107
# all supported JRuby versions provided by 10gen/mongo-ruby-toolchain
108108
def jrubies
109-
@jrubies ||= %w[ jruby-9.4 jruby-9.3 ]
109+
@jrubies ||= %w[ jruby-10.0 jruby-9.4 jruby-9.3 ]
110110
end
111111

112112
# all supported MRI ruby versions

.rspec

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1-
--color
2-
--format <%= ENV["CI"] ? 'Rfc::Riff' : 'Fuubar'%>
31
--tty
2+
--colour
3+
<% if %w(1 true yes).include?(ENV['CI']&.downcase) %>
4+
--format RspecJunitFormatter
5+
--out tmp/rspec.xml
6+
--format 'Rfc::Riff'
7+
<% else %>
8+
--format Fuubar
9+
<% end %>

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,5 @@ end
3838
group :test do
3939
gem 'fuubar'
4040
gem 'rfc'
41+
gem "rspec_junit_formatter"
4142
end

spec/bson/int64_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
BSON::ByteBuffer.new(BSON::Int64.new(integer).to_bson.to_s)
101101
end
102102

103-
context "when on JRuby", if: BSON::Environment.jruby? do
103+
context "when on JRuby", if: BSON::Environment.jruby? && RUBY_VERSION < '3.0.0' do
104104

105105
it "deserializes to a Fixnum object" do
106106
expect(described_class.from_bson(bson).class).to be(Fixnum)
@@ -120,7 +120,7 @@
120120
BSON::ByteBuffer.new(integer.to_bson.to_s)
121121
end
122122

123-
context "when on JRuby", if: BSON::Environment.jruby? do
123+
context "when on JRuby", if: BSON::Environment.jruby? && RUBY_VERSION < '3.0.0' do
124124

125125
it "deserializes to a Fixnum object" do
126126
expect(described_class.from_bson(bson).class).to be(Fixnum)

src/main/org/bson_ruby/ByteBuf.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ public ByteBuf putInt64(ThreadContext context, IRubyObject value) {
564564
value = ((RubyFloat) value).truncate(context);
565565
}
566566
ensureBsonWrite(8);
567-
this.buffer.putLong(((RubyInteger) value).getLongValue());
567+
this.buffer.putLong(RubyNumeric.num2long(value));
568568
this.writePosition += 8;
569569
return this;
570570
}

0 commit comments

Comments
 (0)