Sha256: c3ba83b1351d528b129319592088fb269c4fa86f7deb860c6acb7f40f64b7e22

Contents?: true

Size: 1.24 KB

Versions: 14

Compression:

Stored size: 1.24 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
test_dir = pwd.join("../tests/regression")

failures = false

Dir.entries(test_dir).sort.each do |file|
  file_path = test_dir.join(file)
  next unless File.file?(file_path)

  cmd = "#{mruby} #{file_path}"
  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

14 entries across 14 versions & 1 rubygems

Version Path
script_core-0.3.2 script/regression
script_core-0.3.0 script/regression
script_core-0.2.7 script/regression
script_core-0.2.6 script/regression
script_core-0.2.5 script/regression
script_core-0.2.4 script/regression
script_core-0.2.3 script/regression
script_core-0.2.2 script/regression
script_core-0.2.1 script/regression
script_core-0.2.0 script/regression
script_core-0.1.1 script/regression
script_core-0.1.0 script/regression
script_core-0.0.6 script/regression
script_core-0.0.5 script/regression