Skip to content

Commit

Permalink
[GR-48855] Test truffleruby on JDK latest
Browse files Browse the repository at this point in the history
  • Loading branch information
eregon committed Oct 9, 2023
1 parent bb05e0b commit f2b7cad
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 53 deletions.
10 changes: 2 additions & 8 deletions ci.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -226,14 +226,8 @@ local part_definitions = {
jdk: {
local with_path = { environment+: { path+:: ["$JAVA_HOME/bin"] } },

local v21 = with_path + common.jdks["labsjdk-ce-21"] + {
environment+: {
JT_JDK: "21",
},
},

lts: v21 + { jdk_label:: 'lts' },
new: v21 + { jdk_label:: 'new' },
lts: with_path + common.jdks["labsjdk-ce-21"] + { environment+: { JT_JDK: "21" }, jdk_label:: 'lts' },
new: with_path + common.jdks["labsjdk-ce-latest"] + { environment+: { JT_JDK: "latest" }, jdk_label:: 'new' },
},

platform: {
Expand Down
51 changes: 6 additions & 45 deletions tool/jt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@
# Expand GEM_HOME relative to cwd so it cannot be misinterpreted later.
ENV['GEM_HOME'] = File.expand_path(ENV['GEM_HOME']) if ENV['GEM_HOME']

JDK_VERSIONS = [21, 17]
DEFAULT_JDK_VERSION = JDK_VERSIONS.first
JDK_VERSIONS = %w[latest 21]
DEFAULT_JDK_VERSION = JDK_VERSIONS.last

MRI_TEST_RELATIVE_PREFIX = 'test/mri/tests'
MRI_TEST_PREFIX = "#{TRUFFLERUBY_DIR}/#{MRI_TEST_RELATIVE_PREFIX}"
Expand Down Expand Up @@ -184,7 +184,7 @@ def jvmci_version
@jvmci_version ||= begin
ci = File.read("#{TRUFFLERUBY_DIR}/common.json")
edition = ee_jdk? ? 'ee' : 'ce'
regex = /{\s*"name"\s*:\s*"labsjdk"\s*,\s*"version"\s*:\s*"#{edition}-#{@jdk_version}[^"]+-(jvmci-[^"]+)"\s*,/
regex = /"labsjdk-#{edition}-#{@jdk_version}":\s*\{\s*"name":\s*"labsjdk"\s*,\s*"version":\s*"[^"]+-(jvmci-[^"]+)"\s*,/
raise "JVMCI version not found for labsjdk-#{edition}-#{@jdk_version} in common.json" unless regex =~ ci
$1
end
Expand Down Expand Up @@ -2506,11 +2506,6 @@ def bootstrap_toolchain
raise 'use --env jvm-ce instead' if options.delete('--graal')
raise 'use --env native instead' if options.delete('--native')

if os_version_changed?
warn "Kernel version changed since last build: #{build_kernel_ver.inspect} -> #{host_kernel_ver.inspect}"
remove_shared_compile_artifacts
end

if options.delete('--new-hash')
build_information_path = "#{TRUFFLERUBY_DIR}/src/shared/java/org/truffleruby/shared/BuildInformation.java"
raise unless File.exist?(build_information_path) # in case the file moves in the future
Expand Down Expand Up @@ -2595,40 +2590,6 @@ def bootstrap_toolchain
end
end

def remove_shared_compile_artifacts
if build_information_path.file?
warn "Deleting shared build artifacts to trigger rebuild: #{shared_path}"
shared_path.rmtree
end
end

def os_version_changed?
build_kernel_ver != host_kernel_ver
end

def host_kernel_ver
`uname -r`[/^\d+/]
end

def build_kernel_ver
return '' unless build_information_path.file?

build_information = build_information_path.readlines
build_os_ver_loc = build_information.index { |l| l.include?('getKernelMajorVersion') }
return '' unless build_os_ver_loc

build_information[build_os_ver_loc + 1][/"(\d+)/, 1]
end

def shared_path
Pathname.new("#{TRUFFLERUBY_DIR}/mxbuild/jdk#{@jdk_version}/org.truffleruby.shared")
end

def build_information_path
shared_path
.join('src_gen/org/truffleruby/shared/BuildInformationImpl.java')
end

def next(*args)
puts `cat spec/tags/core/**/**.txt | grep 'fails:'`.lines.sample
end
Expand Down Expand Up @@ -3237,7 +3198,7 @@ def process_pre_args(args)
needs_rebuild = false
@silent = false
@verbose = false
@jdk_version = Integer(ENV['JT_JDK'] || DEFAULT_JDK_VERSION)
@jdk_version = ENV['JT_JDK'] || DEFAULT_JDK_VERSION

until args.empty?
arg = args.shift
Expand All @@ -3253,7 +3214,7 @@ def process_pre_args(args)
when '-v', '--verbose'
@verbose = true
when '--jdk'
@jdk_version = Integer(args.shift)
@jdk_version = args.shift
when '-h', '-help', '--help'
help
exit
Expand All @@ -3263,7 +3224,7 @@ def process_pre_args(args)
end
end

raise "Invalid JDK version: #{@jdk_version}" unless JDK_VERSIONS.include?(@jdk_version)
raise "Invalid JDK version: #{@jdk_version}. Valid values: #{JDK_VERSIONS.join(' or ')}" unless JDK_VERSIONS.include?(@jdk_version)

if needs_rebuild
rebuild
Expand Down

0 comments on commit f2b7cad

Please sign in to comment.