Skip to content

Commit

Permalink
Showing 43 changed files with 705 additions and 555 deletions.
43 changes: 26 additions & 17 deletions bin/jruby-cext-c
Original file line number Diff line number Diff line change
@@ -18,36 +18,45 @@ unless SULONG_DIR
abort 'You need to set SULONG_DIR to the location of a built checkout of the Sulong repository'
end

def mx(command, *args)
command = "mx -p #{SULONG_DIR} #{command} #{args.join(' ')}"
puts "$ #{command}"
`#{command}`
def mx(*args)
command = ['mx', '-p', SULONG_DIR]
command.push *['--java-home', ENV['JVMCI_JAVA_HOME']] if ENV['JVMCI_JAVA_HOME']
command.push *args
puts "$ #{command.join(' ')}"
abort unless system(*command)
end

CEXT_DIR = ARGV[0]
cext_dir = ARGV[0]

unless CEXT_DIR
unless cext_dir
abort 'You need to pass the directory of a C extension so I can build it'
end

CONFIG_FILE = File.join(CEXT_DIR, '.jruby-cext-build.yml')
config_file = File.join(cext_dir, '.jruby-cext-build.yml')

unless File.exist?(CONFIG_FILE)
unless File.exist?(config_file)
abort "There is no .jruby-cext-build.yml in this C extension at the moment - I don't know how to build it"
end

CONFIG = YAML.load_file(CONFIG_FILE)
config = YAML.load_file(config_file)

SRC = Dir[File.join(CEXT_DIR, CONFIG['src'])]
OUT = File.expand_path(CONFIG['out'], CEXT_DIR)
config_src = config['src']

LL = []
if config_src.start_with?('$GEM_HOME/')
src = Dir[ENV['GEM_HOME'] + config_src['$GEM_HOME'.size..-1]]
else
src = Dir[File.join(cext_dir, config_src)]
end

out = File.expand_path(config['out'], cext_dir)

lls = []

SRC.each do |src|
ll = File.join(File.dirname(OUT), File.basename(src, '.*') + '.ll')
mx 'su-clang', "-I#{SULONG_DIR}/include", '-Ilib/ruby/truffle/cext', '-S', '-emit-llvm', src, '-o', ll
src.each do |src|
ll = File.join(File.dirname(out), File.basename(src, '.*') + '.ll')
mx 'su-clang', "-I#{SULONG_DIR}/include", '-Ilib/ruby/truffle/cext', '-S', '-emit-llvm', *ARGV.drop(1), src, '-o', ll
mx 'su-opt', '-S', '-mem2reg', ll, '-o', ll
LL.push ll
lls.push ll
end

mx 'su-link', '-o', OUT, *LL
mx 'su-link', '-o', out, *lls
20 changes: 15 additions & 5 deletions ci.hocon
Original file line number Diff line number Diff line change
@@ -242,6 +242,20 @@ server-benchmarks: {
] ${post-process-and-upload-results}
}

test-gems: {
environment: {
GEM_HOME: jruby-truffle-gem-test-pack/gems
}

setup: ${common-setup} [
[mx, sclone, --kind, git, "https://github.com/jruby/jruby-truffle-gem-test-pack.git", jruby-truffle-gem-test-pack]
]

run: [
${jt} [test, gems]
]
}

builds: [
{name: ruby-test-fast} ${common} ${gate-caps} {run: [${jt} [test, fast]]},
{name: ruby-test-specs-command-line} ${common} ${gate-caps} {run: [${jt} [test, specs, ":command_line"]]},
@@ -250,11 +264,7 @@ builds: [
{name: ruby-test-specs-library} ${common} ${gate-caps} {run: [${jt} [test, specs, ":library"]]},
{name: ruby-test-specs-truffle} ${common} ${gate-caps} {run: [${jt} [test, specs, ":truffle"]]},
{name: ruby-test-integration} ${common} ${gate-caps} {run: [${jt} [test, integration]]},
{name: ruby-test-gems} ${common} ${gate-caps} {
setup: ${common-setup} [[mx, sclone, --kind, git, "https://github.com/jruby/jruby-truffle-gem-test-pack.git", jruby-truffle-gem-test-pack]]
environment: {GEM_HOME: jruby-truffle-gem-test-pack/gems}
run: [${jt} [test, gems]]
},
{name: ruby-test-gems} ${common} ${gate-caps} ${test-gems},
{name: ruby-test-tck} ${common} ${gate-caps} {run: [${jt} [test, tck]]},
{name: ruby-test-tarball} ${common} ${gate-caps} {run: [${jt} [tarball]]},

4 changes: 3 additions & 1 deletion lib/ruby/truffle/cext/ruby.h
Original file line number Diff line number Diff line change
@@ -25,6 +25,8 @@ extern "C" {

#include <truffle.h>

#define RUBY_CEXT truffle_import_cached("ruby_cext")

#define xmalloc malloc
#define xfree free
#define ALLOC_N(type, n) malloc(sizeof(type) * n)
@@ -149,7 +151,7 @@ int rb_scan_args(int argc, VALUE *argv, const char *format, ...);

// Calls

#define rb_funcall(object, name, argc, ...) truffle_invoke(object, "__send__", name, ##__VA_ARGS__)
#define rb_funcall(object, name, ...) truffle_invoke(RUBY_CEXT, "rb_funcall", object, name, __VA_ARGS__)

VALUE rb_yield(VALUE value);

20 changes: 0 additions & 20 deletions lib/ruby/truffle/jruby+truffle/gem_ci/actionpack.rb

This file was deleted.

12 changes: 0 additions & 12 deletions lib/ruby/truffle/jruby+truffle/gem_ci/activemodel.rb

This file was deleted.

12 changes: 0 additions & 12 deletions lib/ruby/truffle/jruby+truffle/gem_ci/activesupport.rb

This file was deleted.

7 changes: 0 additions & 7 deletions lib/ruby/truffle/jruby+truffle/gem_ci/algebrick.rb

This file was deleted.

13 changes: 0 additions & 13 deletions lib/ruby/truffle/jruby+truffle/gem_ci/default.rb

This file was deleted.

132 changes: 90 additions & 42 deletions lib/ruby/truffle/jruby+truffle/lib/truffle/config.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
require 'pp'
require 'yaml'

include Truffle::Runner::ConfigUtils
include Truffle::Runner::OptionBlocks

stubs = {
# TODO (pitr-ch 23-Jun-2016): remove? it's not used any more
minitest: dedent(<<-RUBY),
@@ -157,54 +160,99 @@ def exclusion_file(gem_name)
run: { environment: { 'N' => 1 },
require: %w(rubygems date bigdecimal pathname openssl-stubs) }

config :activesupport,
deep_merge(
rails_common,
stubs.fetch(:activesupport_isolation),
replacements.fetch(:method_source))
Truffle::Runner.add_config :activesupport,
deep_merge(
rails_common,
stubs.fetch(:activesupport_isolation),
replacements.fetch(:method_source))

config :activemodel,
deep_merge(
rails_common,
stubs.fetch(:activesupport_isolation),
stubs.fetch(:bcrypt))
Truffle::Runner.add_config :activemodel,
deep_merge(
rails_common,
stubs.fetch(:activesupport_isolation),
stubs.fetch(:bcrypt))

# TODO (pitr-ch 23-Jun-2016): investigate, fails intermittently
config :actionpack,
deep_merge(
rails_common,
stubs.fetch(:html_sanitizer),
setup: { file: { 'excluded-tests.rb' => format(dedent(<<-RUBY), exclusion_file(:actionpack)),
Truffle::Runner.add_config :actionpack,
deep_merge(
rails_common,
stubs.fetch(:html_sanitizer),
setup: { file: { 'excluded-tests.rb' => format(dedent(<<-RUBY), exclusion_file(:actionpack)),
failures = %s
require 'truffle/exclude_rspec_examples'
Truffle.exclude_rspec_examples failures
RUBY
} })

config :'concurrent-ruby',
setup: { file: { "stub-processor_number.rb" => dedent(<<-RUBY) } },
# stub methods calling #system
require 'concurrent'
module Concurrent
module Utility
class ProcessorCounter
def compute_processor_count
2
end
def compute_physical_processor_count
2
end
end
end
end
RUBY
run: { require: %w(stub-processor_number) }
RUBY
} })

Truffle::Runner.add_config :'concurrent-ruby',
setup: { file: { "stub-processor_number.rb" => dedent(<<-RUBY) } },
# stub methods calling #system
require 'concurrent'
module Concurrent
module Utility
class ProcessorCounter
def compute_processor_count
2
end
def compute_physical_processor_count
2
end
end
end
end
RUBY
run: { require: %w(stub-processor_number) }

Truffle::Runner.add_config :monkey_patch,
replacements.fetch(:bundler)

Truffle::Runner.add_config :openweather,
replacements.fetch(:'bundler/gem_tasks')

Truffle::Runner.add_config :psd,
replacements.fetch(:nokogiri)


class Truffle::Runner::CIEnvironment
def rails_ci(exclude)
repository_name 'rails'

config :monkey_patch,
replacements.fetch(:bundler)
git_clone 'https://github.com/rails/rails.git' unless File.exists? repository_dir
git_checkout git_tag('4.2.6')

config :openweather,
replacements.fetch(:'bundler/gem_tasks')
use_only_https_git_paths!

config :psd,
replacements.fetch(:nokogiri)
has_to_succeed setup
set_result run([%w[--require-pattern test/**/*_test.rb],
(exclude ? %w[-r excluded-tests] : []),
%w[-- -I test -e nil]].flatten(1))
end
end

Truffle::Runner.add_ci_definition :actionpack do
declare_options exclude: ['--[no-]exclude',
'Exclude known failing tests',
STORE_NEW_VALUE,
true]
subdir 'actionpack'
rails_ci option(:exclude)
end

Truffle::Runner.add_ci_definition :activemodel do
subdir 'activemodel'
rails_ci false
end

Truffle::Runner.add_ci_definition :activesupport do
subdir 'activesupport'
rails_ci false
end

Truffle::Runner.add_ci_definition :algebrick do
git_clone 'https://github.com/pitr-ch/algebrick.git' unless File.exists? repository_dir
git_checkout git_tag '0.7.3'

has_to_succeed setup

set_result run(%w[test/algebrick_test.rb])
end
Loading

0 comments on commit 25a34d8

Please sign in to comment.