class MesaTestCase

Attributes

mesa[R]
mod[R]
position[R]
shell[R]
test_name[R]

Public Class Methods

modules() click to toggle source
# File lib/mesa_test.rb, line 950
def self.modules
  %i[star binary astero]
end
new(test: nil, mesa: nil, mod: nil, position: nil) click to toggle source
# File lib/mesa_test.rb, line 954
def initialize(test: nil, mesa: nil, mod: nil, position: nil)
  @test_name = test
  @mesa = mesa
  unless MesaTestCase.modules.include? mod
    raise TestCaseDirError, "Invalid module: #{mod}. Must be one of: " +
                            MesaTestCase.modules.join(', ')
  end
  @mod = mod
  @position = position

  # way to output colored text to shell
  @shell = Thor::Shell::Color.new

  # validate stuff
  check_mesa_dir
  check_test_case

end

Public Instance Methods

do_one() click to toggle source

just punt to each_test_run in the test_suite directory. It's your problem now, sucker!

# File lib/mesa_test.rb, line 983
def do_one
  shell.say("Testing #{test_name}", :yellow)
  visit_dir(test_suite_dir) do
    bash_execute("./each_test_run #{position}")
  end
end
err_64() click to toggle source

Base-64 encoded contents of err.txt file

# File lib/mesa_test.rb, line 1014
def err_64
  err_file = File.join(test_case_dir, 'err.txt')
  return '' unless File.exist?(err_file)

  b64_file(err_file)
end
mk_64() click to toggle source

Base-64 encoded contents of mk.txt file

# File lib/mesa_test.rb, line 1006
def mk_64
  mk_file = File.join(test_case_dir, 'mk.txt')
  return '' unless File.exist?(mk_file)

  b64_file(mk_file)
end
out_64() click to toggle source

Base-64 encoded contents of out.txt file

# File lib/mesa_test.rb, line 1022
def out_64
  out_file = File.join(test_case_dir, 'out.txt')
  return '' unless File.exist?(out_file)

  b64_file(out_file)
end
passed?() click to toggle source

whether or not a test case has passed; only has meaning if we can load the results hash, though

# File lib/mesa_test.rb, line 1001
def passed?
  results_hash['outcome'] == :pass
end
results_hash() click to toggle source
# File lib/mesa_test.rb, line 990
def results_hash
  testhub_file = File.join(test_case_dir, 'testhub.yml')
  unless File.exist?(testhub_file)
    raise TestCaseDirError.new('No results found for test case '\
                               "#{test_name}.")
  end
  YAML.load(File.read(testhub_file))
end
test_case_dir() click to toggle source
# File lib/mesa_test.rb, line 977
def test_case_dir
  File.join(test_suite_dir, test_name)
end
test_suite_dir() click to toggle source
# File lib/mesa_test.rb, line 973
def test_suite_dir
  mesa.test_suite_dir(mod: @mod)
end

Private Instance Methods

check_mesa_dir() click to toggle source

“verify” that mesa_dir is valid by checking for test_suite directory

# File lib/mesa_test.rb, line 1045
def check_mesa_dir
  is_valid =  dir_or_symlink_exists? test_suite_dir
  raise MesaDirError, "Invalid MESA dir: #{mesa.mesa_dir}" unless is_valid
end
check_test_case() click to toggle source

make sure that we can get to the test case directory. Throw an exception if we cannot

# File lib/mesa_test.rb, line 1039
def check_test_case
  return if dir_or_symlink_exists? test_case_dir
  raise TestCaseDirError, "No such test case: #{test_case_dir}."
end
in_dir(&block) click to toggle source

cd into the test case directory, do something in a block, then cd back to original directory

# File lib/mesa_test.rb, line 1033
def in_dir(&block)
  visit_dir(test_case_dir, &block)
end