Parent

Test::Unit::TestCase

Public Instance Methods

assert_coredump(app, *args) click to toggle source
# File lib/test/unit/systemtest.rb, line 55
def assert_coredump(app, *args)
  out, err, status = run_app(app, args)
  assert_equal(true, status.coredump?,
    "Running #{[app,args].delete_if { |i| i.empty? }.join(" ")} did not coredump.")
  yield(out, err, status) if block_given?
end
assert_failure(app, *args) click to toggle source
# File lib/test/unit/systemtest.rb, line 48
def assert_failure(app, *args)
  out, err, status = run_app(app, args)
  assert_equal(false, status.success?,
    "No failure running #{[app,args].delete_if { |i| i.empty? }.join(" ")}.")
  yield(out, err, status) if block_given?
end
assert_no_coredump(app, *args) click to toggle source
# File lib/test/unit/systemtest.rb, line 61
def assert_no_coredump(app, *args)
  out, err, status = run_app(app, args)
  assert_equal(false, status.coredump?,
    "Running #{[app,args].delete_if { |i| i.empty? }.join(" ")} caused coredump.")
  yield(out, err, status) if block_given?
end
assert_stopped(app, *args) click to toggle source
# File lib/test/unit/systemtest.rb, line 68
def assert_stopped(app, *args)
  out, err, status = run_app(app, args)
  assert_equal(true, status.stopped?,
    "Running #{[app,args].delete_if { |i| i.empty? }.join(" ")} not stopped.")
  yield(out, err, status) if block_given?
end
assert_success(app, *args) click to toggle source
# File lib/test/unit/systemtest.rb, line 39
def assert_success(app, *args)
  args.compact!
  out, err, status = run_app(app, args)
  assert_equal(true, status.success?, 
    "Failure running #{[app,args].delete_if { |i| i.empty? }.join(" ")} "+
    "with error(s):\n => stderr: '#{err}'\n => stdout: '#{out}'.")
  yield(out, err, status) if block_given?
end
run_app(app, *args) click to toggle source
# File lib/test/unit/systemtest.rb, line 9
def run_app(app, *args)
  cmd = [app, args].flatten.join(" ")
  out = nil
  err = nil
  Timeout::timeout(5) {
  status = Open4.popen4(cmd) { |cid, stdin, stdout, stderr|
    out = stdout.read
    err = stderr.read
    stdin.close_write
  }
  }
rescue(Timeout::Error) => err
  puts "ERROR running #{app} #{args}"
  puts err
  puts err.backtrace
  [out, err, status]
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.