Skip to content

Commit fbab3ba

Browse files
committed
[GR-15047] JT improvements.
PullRequest: truffleruby/856
2 parents 22dfb29 + 20aca5f commit fbab3ba

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

tool/jt.rb

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -415,13 +415,7 @@ def mx_os
415415
end
416416
end
417417

418-
def mspec(command, *args)
419-
env_vars = {}
420-
if command.is_a?(Hash)
421-
env_vars = command
422-
command, *args = args
423-
end
424-
418+
def run_mspec(env_vars, command = 'run', *args)
425419
mspec_args = ['spec/mspec/bin/mspec', command, '--config', 'spec/truffle.mspec']
426420

427421
if i = args.index('-t')
@@ -504,6 +498,8 @@ def help
504498
jt test report :language build a report on language specs
505499
:core (results go into test/target/mspec-html-report)
506500
:library
501+
jt test unit run Java unittests
502+
jt test tck run tck tests
507503
jt gem-test-pack check that the gem test pack is downloaded, or download it for you, and print the path
508504
jt rubocop [rubocop options] run rubocop rules (using ruby available in the environment)
509505
jt tag spec/ruby/language tag failing specs in this directory
@@ -577,8 +573,12 @@ def clean(*options)
577573
mx 'clean', '--dependencies', 'org.truffleruby.cext'
578574
when nil
579575
mx 'clean'
580-
sh 'rm', '-rf', 'mxbuild'
581576
sh 'rm', '-rf', 'spec/ruby/ext'
577+
Dir.glob("#{TRUFFLERUBY_DIR}/mxbuild/{*,.*}") do |path|
578+
next if File.basename(path).start_with?('truffleruby-')
579+
next if %w(. ..).include? File.basename(path)
580+
sh 'rm', '-rf', path
581+
end
582582
else
583583
raise ArgumentError, project
584584
end
@@ -791,7 +791,6 @@ def test(*args)
791791

792792
case path
793793
when nil
794-
ENV['HAS_REDIS'] = 'true'
795794
%w[specs mri bundle cexts integration gems ecosystem compiler].each do |kind|
796795
jt('test', kind)
797796
end
@@ -806,6 +805,8 @@ def test(*args)
806805
when 'basictest' then test_basictest(*rest)
807806
when 'bootstraptest' then test_bootstraptest(*rest)
808807
when 'mri' then test_mri(*rest)
808+
when 'unit', 'unittest' then mx 'unittest', 'org.truffleruby'
809+
when 'tck' then mx 'tck'
809810
else
810811
if File.expand_path(path, TRUFFLERUBY_DIR).start_with?("#{TRUFFLERUBY_DIR}/test")
811812
test_mri(*args)
@@ -1230,7 +1231,7 @@ def test_bundle(*args)
12301231
end
12311232

12321233
def mspec(*args)
1233-
super(*args)
1234+
run_mspec({}, *args)
12341235
end
12351236

12361237
def test_specs(command, *args)
@@ -1307,7 +1308,7 @@ def test_specs(command, *args)
13071308
build("cexts")
13081309
end
13091310

1310-
mspec env_vars, command, *options, *args
1311+
run_mspec env_vars, command, *options, *args
13111312
end
13121313
private :test_specs
13131314

@@ -1859,6 +1860,16 @@ def build_graalvm(*options)
18591860
rubies_dir = chruby_versions if File.directory?(chruby_versions)
18601861

18611862
if rubies_dir
1863+
Dir.glob(rubies_dir + "/truffleruby-*").each do |link|
1864+
next unless File.symlink?(link)
1865+
next if File.exist?(link)
1866+
target = File.readlink(link)
1867+
next unless target.start_with?("#{TRUFFLERUBY_DIR}/mxbuild")
1868+
1869+
File.delete link
1870+
puts "Deleted old link: #{link} -> #{target}"
1871+
end
1872+
18621873
link_path = "#{rubies_dir}/#{name}"
18631874
File.delete link_path if File.exist? link_path
18641875
File.symlink dest_ruby, link_path

0 commit comments

Comments
 (0)