Top Level Namespace

Defined Under Namespace

Classes: Commit, Mesa, MesaTestCase, MesaTestSubmitter

Constant Summary collapse

MesaDirError =
Class.new(StandardError)
TestCaseDirError =
Class.new(StandardError)
InvalidDataType =
Class.new(StandardError)
DEFAULT_REVISION =
10_000

Instance Method Summary collapse

Instance Method Details

#bash_execute(command) ⇒ Object

force the execution to happen with bash



1640
1641
1642
# File 'lib/mesa_test.rb', line 1640

def bash_execute(command)
  system('bash -c "' + command + '"')
end

#generate_seeds_rb(mesa_dir, outfile) ⇒ Object

create seed data for test cases for MesaTestHub of a given mesa version



1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
# File 'lib/mesa_test.rb', line 1617

def generate_seeds_rb(mesa_dir, outfile)
  m = Mesa.new(mesa_dir: mesa_dir)
  m.load_test_source_data
  File.open(outfile, 'w') do |f|
    f.puts 'test_cases = TestCase.create!('
    f.puts '  ['
    m.test_names.each do |test_case_name|
      f.puts '    {'
      f.puts "      name: '#{test_case_name}',"
      f.puts "      version_added: #{m.version_number},"
      # no comma on last one
      if test_case_name == m.test_names[-1]
        f.puts('    }')
      else
        f.puts('    },')
      end
    end
    f.puts '  ]'
    f.puts ')'
  end
end

#visit_and_check(new_dir, exception, message) ⇒ Object

cd into a new directory, execute a block whose return value is either true or false. Either way, cd back to original directory. Raise an exception if the block failed (returned false or nil)

Raises:

  • (exception)


1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
# File 'lib/mesa_test.rb', line 1587

def visit_and_check(new_dir, exception, message)
  cwd = Dir.getwd
  shell.say "Leaving  #{cwd}", :blue
  puts ''
  shell.say "Entering #{new_dir}.", :blue
  Dir.chdir(new_dir)
  success = yield if block_given?
  shell.say "Leaving  #{new_dir}", :blue
  puts ''
  shell.say "Entering #{cwd}.", :blue
  Dir.chdir(cwd)
  return if success
  raise exception, message
end

#visit_dir(new_dir) ⇒ Object

cd into a new directory, execute a block, then cd back into original directory



1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
# File 'lib/mesa_test.rb', line 1604

def visit_dir(new_dir)
  cwd = Dir.getwd
  shell.say "Leaving  #{cwd}\n", :blue
  shell.say "Entering #{new_dir}.", :blue
  Dir.chdir(new_dir)
  yield if block_given?
  shell.say "Leaving  #{new_dir}\n", :blue
  shell.say "Re-entering #{cwd}.", :blue
  puts ""
  Dir.chdir(cwd)
end