Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2834a6d7e7fc
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 9b18725b2b18
Choose a head ref
  • 12 commits
  • 11 files changed
  • 1 contributor

Commits on Aug 18, 2016

  1. Copy the full SHA
    9b82f87 View commit details
  2. Copy the full SHA
    b302a84 View commit details
  3. Copy the full SHA
    4fda1b9 View commit details
  4. Copy the full SHA
    c09a3ae View commit details
  5. [Truffle] improve rbconfig compatibility

    Makes Gem.ruby return correctly jruby+truffle
    pitr-ch committed Aug 18, 2016
    Copy the full SHA
    843b978 View commit details
  6. Copy the full SHA
    dc24d28 View commit details
  7. Copy the full SHA
    fe13aa4 View commit details
  8. remove trailing space

    pitr-ch committed Aug 18, 2016
    Copy the full SHA
    8e2a863 View commit details
  9. Copy the full SHA
    cf96c3b View commit details
  10. Copy the full SHA
    018c3f5 View commit details
  11. [Truffle] add railties tests

    pitr-ch committed Aug 18, 2016
    Copy the full SHA
    b937073 View commit details
  12. Copy the full SHA
    9b18725 View commit details
3 changes: 3 additions & 0 deletions bin/jruby-truffle
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

$(dirname $BASH_SOURCE[0])/jruby -X+T $@
2 changes: 1 addition & 1 deletion lib/pom.rb
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ class Gem::Installer
def say(message)
if message != spec.post_install_message || !MORE_QUIET
super
end
end
end
end
end
88 changes: 74 additions & 14 deletions lib/ruby/truffle/jruby+truffle/lib/truffle/config.rb
Original file line number Diff line number Diff line change
@@ -174,6 +174,14 @@ def exclusion_file(gem_name)
data.pretty_inspect
end

def exclusions_for(name)
{ setup: { file: { 'excluded-tests.rb' => format(dedent(<<-RUBY), exclusion_file(name)) } } }
failures = %s
require 'truffle/exclude_rspec_examples'
Truffle.exclude_rspec_examples failures
RUBY
end

rails_common =
deep_merge replacements.fetch(:bundler),
stubs.fetch(:kernel_gem),
@@ -198,12 +206,13 @@ def exclusion_file(gem_name)
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
} })
exclusions_for(:actionpack))

Truffle::Runner.add_config :railties,
deep_merge(rails_common,
stubs.fetch(:activesupport_isolation),
exclusions_for(:railties),
run: { require: %w[bundler.rb] })

Truffle::Runner.add_config :'concurrent-ruby',
setup: { file: { "stub-processor_number.rb" => dedent(<<-RUBY) } },
@@ -235,27 +244,28 @@ def compute_physical_processor_count


class Truffle::Runner::CIEnvironment
def rails_ci
declare_options debug: ['--[no-]debug', 'Run tests with remote debugging enabled.',
STORE_NEW_VALUE, false],
exclude: ['--[no-]exclude', 'Exclude known failing tests',
STORE_NEW_VALUE, true]
def rails_ci(has_exclusions: false, skip_test_files: [])
options = {}
options[:debug] = ['-d', '--[no-]debug', 'Run tests with remote debugging enabled.', STORE_NEW_VALUE, false]
options[:exclude] = ['--[no-]exclusion', 'Exclude known failing tests', STORE_NEW_VALUE, true] if has_exclusions

declare_options options
repository_name 'rails'

use_only_https_git_paths!

has_to_succeed setup
set_result run([*%w[--require-pattern test/**/*_test.rb],
*(%w[-r excluded-tests] if option(:exclude)),
set_result run([*(['--exclude-pattern', *skip_test_files.join('|')] unless skip_test_files.empty?),
*%w[--require-pattern test/**/*_test.rb],
*(%w[-r excluded-tests] if has_exclusions && option(:exclude)),
*(%w[--debug] if option(:debug)),
*%w[-- -I test -e nil]])
end
end

Truffle::Runner.add_ci_definition :actionpack do
subdir 'actionpack'
rails_ci
rails_ci has_exclusions: true
end

Truffle::Runner.add_ci_definition :activemodel do
@@ -268,6 +278,56 @@ def rails_ci
rails_ci
end

Truffle::Runner.add_ci_definition :railties do
subdir 'railties'
rails_ci has_exclusions: true,
skip_test_files: %w[
test/application/asset_debugging_test.rb
test/application/assets_test.rb
test/application/bin_setup_test.rb
test/application/configuration_test.rb
test/application/console_test.rb
test/application/generators_test.rb
test/application/loading_test.rb
test/application/mailer_previews_test.rb
test/application/middleware_test.rb
test/application/multiple_applications_test.rb
test/application/paths_test.rb
test/application/rackup_test.rb
test/application/rake_test.rb
test/application/rendering_test.rb
test/application/routing_test.rb
test/application/runner_test.rb
test/application/test_runner_test.rb
test/application/test_test.rb
test/application/url_generation_test.rb
test/application/configuration/base_test.rb
test/application/configuration/custom_test.rb
test/application/initializers/frameworks_test.rb
test/application/initializers/hooks_test.rb
test/application/initializers/i18n_test.rb
test/application/initializers/load_path_test.rb
test/application/initializers/notifications_test.rb
test/application/middleware/cache_test.rb
test/application/middleware/cookies_test.rb
test/application/middleware/exceptions_test.rb
test/application/middleware/remote_ip_test.rb
test/application/middleware/sendfile_test.rb
test/application/middleware/session_test.rb
test/application/middleware/static_test.rb
test/application/rack/logger_test.rb
test/application/rake/dbs_test.rb
test/application/rake/migrations_test.rb
test/application/rake/notes_test.rb
test/railties/engine_test.rb
test/railties/generators_test.rb
test/railties/mounted_engine_test.rb
test/railties/railtie_test.rb
test/fixtures
test/rails_info_controller_test
test/commands/console_test]
end

Truffle::Runner.add_ci_definition :algebrick do

has_to_succeed setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
---
PathGenerationTest:
- test_original_script_name
Rails::TestInfoTest:
- test_with_file
- test_with_opts
Rails::DBConsoleTest:
- test_sqlite3_db_without_defined_rails_root
ActionsTest:
- test_environment_should_include_data_in_environment_initializer_block_with_env_option
AppGeneratorTest:
- test_application_name_is_detected_if_it_exists_and_app_folder_renamed
- test_application_name_with_spaces
- test_application_new_exits_with_message_and_non_zero_code_when_generating_inside_existing_rails_directory
- test_application_new_show_help_message_inside_existing_rails_directory
- test_assets
- test_generator_if_skip_sprockets_is_given
- test_generator_if_skip_turbolinks_is_given
- test_gitignore_when_sqlite3
- test_javascript_is_skipped_if_required
- test_jquery_is_the_default_javascript_library
- test_new_hash_style
- test_other_javascript_libraries
- test_rails_update_generates_correct_session_key
- test_spring
- test_template_is_executed_when_supplied
- test_template_is_executed_when_supplied_an_https_path
- test_web_console
GeneratorGeneratorTest:
- test_generator_skeleton_is_created
- test_generator_skeleton_is_created_without_file_name_namespace
- test_namespaced_generator_skeleton
- test_namespaced_generator_skeleton_without_file_name_namespace
Rails::Generators::GeneratorTest:
- test_filter
- test_two_filters
NamespacedScaffoldGeneratorTest:
- test_scaffold_with_namespace_on_invoke
- test_scaffold_with_namespace_on_revoke
- test_scaffold_with_nested_namespace_on_invoke
- test_scaffold_with_nested_namespace_on_revoke
OrmTest:
- test_orm_instance_returns_orm_class_instance_with_name
PluginGeneratorTest:
- test_create_mountable_application_with_mountable_option
- test_creating_engine_in_full_mode
- test_ensure_that_migration_tasks_work_with_mountable_option
- test_ensure_that_tests_work
- test_ensure_that_tests_works_in_full_mode
- test_generating_controller_inside_mountable_engine
- test_generation_runs_bundle_install_with_full_and_mountable
- test_shebang
- test_shebang_is_added_to_rails_file
- test_shebang_when_is_the_same_as_default_use_env
- test_template_is_executed_when_supplied
- test_template_is_executed_when_supplied_an_https_path
- test_usage_of_engine_commands
ResourceGeneratorTest:
- test_files_from_inherited_invocation
- test_inherited_invocations_with_attributes
- test_plural_names_are_singularized
- test_plural_names_can_be_forced
- test_resource_controller_with_actions
- test_resource_controller_with_pluralized_class_name
ScaffoldControllerGeneratorTest:
- test_controller_permit_polymorphic_references_attributes
- test_controller_permit_references_attributes
- test_controller_skeleton_is_created
- test_controller_tests_pass_by_default_inside_full_engine
- test_controller_tests_pass_by_default_inside_mountable_engine
- test_customized_orm_is_used
- test_default_orm_is_used
- test_dont_use_require_or_permit_if_there_are_no_attributes
- test_functional_tests
- test_functional_tests_without_attributes
- test_helper_are_invoked_with_a_pluralized_name
- test_index_page_have_notice
- test_views_are_generated
ScaffoldGeneratorTest:
- test_functional_tests_without_attributes
- test_scaffold_generator_belongs_to
- test_scaffold_generator_no_javascripts
- test_scaffold_generator_no_stylesheets
- test_scaffold_generator_outputs_error_message_on_missing_attribute_type
- test_scaffold_generator_password_digest
- test_scaffold_on_invoke
- test_scaffold_tests_pass_by_default_inside_full_engine
- test_scaffold_tests_pass_by_default_inside_mountable_engine
- test_scaffold_with_namespace_on_invoke
- test_scaffold_with_namespace_on_revoke
24 changes: 14 additions & 10 deletions lib/ruby/truffle/jruby+truffle/lib/truffle/runner.rb
Original file line number Diff line number Diff line change
@@ -65,7 +65,7 @@ def print_cmd(cmd, dir, print)
cmd = Array(cmd) # wrap if it's just a string

formatted_env, command = if cmd[0].is_a?(Hash)
[cmd[0].map { |k, v| "#{k}=#{v}" }, cmd[1..-1]]
[cmd[0].map { |k, v| "#{k}=\"#{v}\"" }, cmd[1..-1]]
else
[[], cmd]
end
@@ -637,27 +637,31 @@ def subcommand_run(rest)
'-X+T',
"-J-Xmx#{@options[:run][:xmx]}",
*(%w[-J-ea -J-esa] unless @options[:run][:no_asserts]),
("-Xtruffle.core.load_path=#{core_load_path}" if @options[:global][:use_fs_core] && !missing_core_load_path),
('-Xtruffle.exceptions.print_java=true' if @options[:run][:jexception])
*("-Xtruffle.core.load_path=#{core_load_path}" if @options[:global][:use_fs_core] && !missing_core_load_path),
*('-Xtruffle.exceptions.print_java=true' if @options[:run][:jexception])
]

bundler_setup = "./#{@options[:global][:truffle_bundle_path]}/bundler/setup.rb"
cmd_options = [
*(truffle_options unless @options[:run][:no_truffle]),
(format(@options[:global][:debug_option], @options[:global][:debug_port]) if @options[:run][:debug]),
jruby_options = [
*(format(@options[:global][:debug_option], @options[:global][:debug_port]) if @options[:run][:debug]),
*(truffle_options unless @options[:run][:no_truffle])
]

bundler_setup = File.expand_path "#{@options[:global][:truffle_bundle_path]}/bundler/setup.rb"
env_options = [
*ruby_options,
*(['-r', bundler_setup] if File.exist? bundler_setup),
*@options[:run][:load_path].flat_map { |v| ['-I', v] },
*@options[:run][:require].flat_map { |v| ['-r', v] }
].compact
]

env = @options[:run][:environment]
env['JAVACMD'] = @options[:global][:graal_path] if @options[:run][:graal]
env.each { |k, v| env[k] = v.to_s }

cmd = [(env unless env.empty?),
@options[:run][:interpreter_path].to_s,
*cmd_options,
*jruby_options,
*env_options,
executable,
*rest
].compact
@@ -688,7 +692,7 @@ def subcommand_ci(rest)
File.read(Pathname(@called_from_dir).join(path))
end
end
cis_to_run = YAML.load(batch_content)
cis_to_run = YAML.load(batch_content)

results = cis_to_run.map do |ci|
# ci is just a name or a array of name and options
2 changes: 2 additions & 0 deletions lib/ruby/truffle/truffle/io/console.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# left unimplemented
# shim needed for bundler, thor
1 change: 1 addition & 0 deletions test/truffle/ecosystem/batch.yaml
Original file line number Diff line number Diff line change
@@ -3,5 +3,6 @@
- activesupport
- activemodel
- algebrick
- railties

# - [gem_name, --option] # is alternative format
Original file line number Diff line number Diff line change
@@ -14,6 +14,8 @@
import org.jruby.truffle.Layouts;
import org.jruby.truffle.RubyContext;
import org.jruby.truffle.core.proc.ProcOperations;
import org.jruby.truffle.debug.DebugHelpers;
import org.jruby.truffle.language.backtrace.Backtrace;
import org.jruby.truffle.language.backtrace.BacktraceFormatter;
import org.jruby.truffle.language.control.RaiseException;

@@ -84,7 +86,15 @@ public static DynamicObject handleAtExitException(RubyContext context, RaiseExce
if (Layouts.BASIC_OBJECT.getLogicalClass(rubyException) == context.getCoreLibrary().getSystemExitClass()) {
// Do not show SystemExit errors, just track them for the exit status
} else {
BacktraceFormatter.createDefaultFormatter(context).printBacktrace(context, rubyException, Layouts.EXCEPTION.getBacktrace(rubyException));
// can be null, if @custom_backtrace is used
final Backtrace backtrace = Layouts.EXCEPTION.getBacktrace(rubyException);
if (backtrace != null) {
BacktraceFormatter.createDefaultFormatter(context).printBacktrace(context, rubyException, backtrace);
} else {
// TODO (pitr-ch 10-Aug-2016): replace temporary duplication, BacktraceFormatter works only with Backtrace
final String code = "puts format \"%s: %s (%s)\\n%s\", e.backtrace[0], e.message, e.class, e.backtrace[1..-1].map { |l| \"\\tfrom \" + l }.join(\"\\n\")";
DebugHelpers.eval(context, code, "e", rubyException);
}
}
return rubyException;
}
Original file line number Diff line number Diff line change
@@ -48,6 +48,11 @@ public Object setLastExceptionAndRun(VirtualFrame frame, RaiseException exceptio
}
}

public void setLastException(VirtualFrame frame, DynamicObject exception) {
final DynamicObject threadLocals = getThreadLocalsObject(frame);
writeDollarBang(threadLocals, exception);
}

private DynamicObject getThreadLocalsObject(VirtualFrame frame) {
if (threadLocalNode == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@ public class TopLevelRaiseHandler extends RubyNode {

@Child private RubyNode body;
@Child private IntegerCastNode integerCastNode;
@Child private SetExceptionVariableNode setExceptionVariableNode;

public TopLevelRaiseHandler(RubyContext context, SourceSection sourceSection, RubyNode body) {
super(context, sourceSection);
@@ -41,6 +42,7 @@ public Object execute(VirtualFrame frame) {
body.execute(frame);
} catch (RaiseException e) {
lastException = AtExitManager.handleAtExitException(getContext(), e);
getSetExceptionVariableNode().setLastException(frame, lastException);
} finally {
final DynamicObject atExitException = getContext().getAtExitManager().runAtExitHooks();

@@ -71,4 +73,13 @@ private int castToInt(Object value) {
return integerCastNode.executeCastInt(value);
}

private SetExceptionVariableNode getSetExceptionVariableNode() {
if (setExceptionVariableNode == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
setExceptionVariableNode = insert(new SetExceptionVariableNode(getContext()));
}

return setExceptionVariableNode;
}

}
11 changes: 6 additions & 5 deletions truffle/src/main/ruby/core/rbconfig.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2014, 2015 Oracle and/or its affiliates. All rights reserved. This
# code is released under a tri EPL/GPL/LGPL license. You can use it,
# redistribute it and/or modify it under the terms of the:
#
#
# Eclipse Public License version 1.0
# GNU General Public License version 2
# GNU Lesser General Public License version 2.1
@@ -14,15 +14,16 @@ module RbConfig
'host_cpu' => Truffle::System.host_cpu,
'bindir' => "#{Truffle::Boot.jruby_home_directory}/bin",
'libdir' => "#{Truffle::Boot.jruby_home_directory}/lib/ruby/truffle",
'ruby_install_name' => 'jruby',
'RUBY_INSTALL_NAME' => 'jruby',
'ruby_install_name' => 'jruby-truffle',
'RUBY_INSTALL_NAME' => 'jruby-truffle',
# 'ruby_install_name' => 'jruby',
# 'RUBY_INSTALL_NAME' => 'jruby',
'ruby_version' => '2.2.0',
'OBJEXT' => 'll',
'DLEXT' => 'su'
}

def self.ruby
# TODO CS 19-May-15 should return the original command? Not sure that's possible
"ruby"
File.join CONFIG['bindir'], CONFIG['ruby_install_name'], CONFIG['exeext']
end
end