Sha256: 83deddb06eb8f20dd98268f6d6806d65df37247dd2d24f699b733987754c47f6

Contents?: true

Size: 1.23 KB

Versions: 4

Compression:

Stored size: 1.23 KB

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require "pathname"

OUT_OF_MEMORY_EXPECTED = %w[212971.rb 212983.rb 219293.rb 227322.rb 239195.rb 240894.rb].freeze

def expected_result?(file)
  return true if $CHILD_STATUS.success?
  return true if $CHILD_STATUS.exitstatus == 1
  return true if OUT_OF_MEMORY_EXPECTED.include?(file) && $CHILD_STATUS.termsig == 9
  false
end

pwd = Pathname.new(__FILE__).dirname
mruby = pwd.join("../ext/enterprise_script_service/mruby/bin/mruby").to_s
testdir = pwd.join("../tests/regression")

failures = false

Dir.entries(testdir).sort.each do |file|
  filepath = testdir.join(file)
  next unless File.file?(filepath)
  cmd = "#{mruby} #{filepath}"
  system(cmd)

  if expected_result?(file)
    puts "#{file}: all good."
  else
    failures = true

    if $CHILD_STATUS.stopped?
      puts "#{file}: Stopped (#{$CHILD_STATUS.stopsig})"
    elsif $CHILD_STATUS.signaled?
      puts "#{file}: Signaled (#{$CHILD_STATUS.termsig})"
    elsif $CHILD_STATUS.exited?
      puts "#{file}: Exited (#{$CHILD_STATUS.exitstatus})"
    else
      puts "#{file}: unknown term signal: #{$CHILD_STATUS.methods} (#{$CHILD_STATUS})"
    end
  end
end

raise "Regression tests failed" if failures

puts
puts "Regression tests succeeded"

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
script_core-0.0.4 script/regression
script_core-0.0.3 script/regression
script_core-0.0.2 script/regression
script_core-0.0.1 script/regression