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



1406
1407
1408
# File 'lib/mesa_test.rb', line 1406

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



1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
# File 'lib/mesa_test.rb', line 1383

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)


1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
# File 'lib/mesa_test.rb', line 1354

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



1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
# File 'lib/mesa_test.rb', line 1371

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 "Entering #{cwd}.", :blue
  Dir.chdir(cwd)
end