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: 74a54af98d4e
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: a304bb14278c
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Oct 2, 2015

  1. Copy the full SHA
    b92855d View commit details
  2. Copy the full SHA
    a304bb1 View commit details
Showing with 18 additions and 16 deletions.
  1. +2 −2 test/truffle/pe/core/block_given_pe.rb
  2. +16 −14 test/truffle/pe/pe.rb
4 changes: 2 additions & 2 deletions test/truffle/pe/core/block_given_pe.rb
Original file line number Diff line number Diff line change
@@ -14,5 +14,5 @@ def self.foo

end

example "BlockGivenFixtures.foo", false
example "BlockGivenFixtures.foo { }", true
tagged_example "BlockGivenFixtures.foo", false
tagged_example "BlockGivenFixtures.foo { }", true
30 changes: 16 additions & 14 deletions test/truffle/pe/pe.rb
Original file line number Diff line number Diff line change
@@ -32,8 +32,10 @@

EXAMPLES = []

Example = Struct.new(:code, :expected_value, :expected_constant, :tagged)

def example(code, expected_value, expected_constant=true, tagged=false)
EXAMPLES << [code, expected_value, expected_constant, tagged]
EXAMPLES << Example.new(code, expected_value, expected_constant, tagged)
end

def tagged_example(code, expected_value)
@@ -86,16 +88,16 @@ def report(status, code, message = nil)
puts message ? format(format_str + "\n %s", status, code, message) : format('%14s: %s', status, code)
end

EXAMPLES.each do |code, expected_value, expected_constant, tagged|
next if tagged
EXAMPLES.each do |example|
next if example.tagged

finished = false

test_thread = Thread.new do
begin
tested += 1
value = nil
eval "loop { value = Truffle::Primitive.assert_constant begin; #{code}; end; Truffle::Primitive.assert_not_compiled; Thread.pass }"
eval "loop { value = Truffle::Primitive.assert_constant begin; #{example.code}; end; Truffle::Primitive.assert_not_compiled; Thread.pass }"
rescue RubyTruffleError => e
if e.message.include? 'Truffle::Primitive.assert_not_compiled'
constant = true
@@ -106,27 +108,27 @@ def report(status, code, message = nil)
end

if constant.nil?
report 'ERROR', code, "errored in some unexpected way: #{e.message}"
report 'ERROR', example.code, "errored in some unexpected way: #{e.message}"
errored += 1
else
if expected_constant
if example.expected_constant
unless constant
report 'FAILED', code, "wasn't constant"
report 'FAILED', example.code, "wasn't constant"
failed += 1
else
if value == expected_value
report 'OK', code
if value == example.expected_value
report 'OK', example.code
else
report 'INCORRECT', code, "was: #{value.inspect} and not: #{expected_value.inspect}"
report 'INCORRECT', example.code, "was: #{value.inspect} and not: #{example.expected_value.inspect}"
failed += 1
end
end
else
if constant
report 'QUERY', code, "wasn't supposed to be constant but it was (#{value.inspect})"
report 'QUERY', example.code, "wasn't supposed to be constant but it was (#{value.inspect})"
failed += 1
else
report 'OK (counter)', code
report 'OK (counter)', example.code
end
end
end
@@ -138,11 +140,11 @@ def report(status, code, message = nil)
test_thread.join(TIMEOUT)

unless finished
report 'TIMEOUT', code, "didn't compile in time so I don't know if it's constant or not"
report 'TIMEOUT', example.code, "didn't compile in time so I don't know if it's constant or not"
timedout += 1
end
end

puts "Tested #{tested}, #{EXAMPLES.select{|c,e,t| t}.size} tagged, #{failed} failed, #{errored} errored, #{timedout} timed out"
puts "Tested #{tested}, #{EXAMPLES.select{|example| example.tagged}.size} tagged, #{failed} failed, #{errored} errored, #{timedout} timed out"

exit 1 unless failed.zero? && errored.zero? && timedout.zero?