Class | Test::Unit::TestCase |
In: |
lib/test/unit/CVS/Base/systemtest.rb
lib/test/unit/systemtest.rb |
Parent: | Object |
# File lib/test/unit/CVS/Base/systemtest.rb, line 36 36: def assert_coredump(app, *args) 37: out, err, status = run_app(app, args) 38: assert_equal(true, status.coredump?, 39: "Running #{[app,args].delete_if { |i| i.empty? }.join(" ")} did not coredump.") 40: yield(out, err, status) if block_given? 41: end
# File lib/test/unit/systemtest.rb, line 55 55: def assert_coredump(app, *args) 56: out, err, status = run_app(app, args) 57: assert_equal(true, status.coredump?, 58: "Running #{[app,args].delete_if { |i| i.empty? }.join(" ")} did not coredump.") 59: yield(out, err, status) if block_given? 60: end
# File lib/test/unit/systemtest.rb, line 48 48: def assert_failure(app, *args) 49: out, err, status = run_app(app, args) 50: assert_equal(false, status.success?, 51: "No failure running #{[app,args].delete_if { |i| i.empty? }.join(" ")}.") 52: yield(out, err, status) if block_given? 53: end
# File lib/test/unit/CVS/Base/systemtest.rb, line 29 29: def assert_failure(app, *args) 30: out, err, status = run_app(app, args) 31: assert_equal(false, status.success?, 32: "No failure running #{[app,args].delete_if { |i| i.empty? }.join(" ")}.") 33: yield(out, err, status) if block_given? 34: end
# File lib/test/unit/CVS/Base/systemtest.rb, line 42 42: def assert_no_coredump(app, *args) 43: out, err, status = run_app(app, args) 44: assert_equal(false, status.coredump?, 45: "Running #{[app,args].delete_if { |i| i.empty? }.join(" ")} caused coredump.") 46: yield(out, err, status) if block_given? 47: end
# File lib/test/unit/systemtest.rb, line 61 61: def assert_no_coredump(app, *args) 62: out, err, status = run_app(app, args) 63: assert_equal(false, status.coredump?, 64: "Running #{[app,args].delete_if { |i| i.empty? }.join(" ")} caused coredump.") 65: yield(out, err, status) if block_given? 66: end
# File lib/test/unit/CVS/Base/systemtest.rb, line 49 49: def assert_stopped(app, *args) 50: out, err, status = run_app(app, args) 51: assert_equal(true, status.stopped?, 52: "Running #{[app,args].delete_if { |i| i.empty? }.join(" ")} not stopped.") 53: yield(out, err, status) if block_given? 54: end
# File lib/test/unit/systemtest.rb, line 68 68: def assert_stopped(app, *args) 69: out, err, status = run_app(app, args) 70: assert_equal(true, status.stopped?, 71: "Running #{[app,args].delete_if { |i| i.empty? }.join(" ")} not stopped.") 72: yield(out, err, status) if block_given? 73: end
# File lib/test/unit/systemtest.rb, line 39 39: def assert_success(app, *args) 40: args.compact! 41: out, err, status = run_app(app, args) 42: assert_equal(true, status.success?, 43: "Failure running #{[app,args].delete_if { |i| i.empty? }.join(" ")} "+ 44: "with error(s):\n => stderr: '#{err}'\n => stdout: '#{out}'.") 45: yield(out, err, status) if block_given? 46: end
# File lib/test/unit/CVS/Base/systemtest.rb, line 20 20: def assert_success(app, *args) 21: args.compact! 22: out, err, status = run_app(app, args) 23: assert_equal(true, status.success?, 24: "Failure running #{[app,args].delete_if { |i| i.empty? }.join(" ")} "+ 25: "with error(s):\n => stderr: '#{err}'\n => stdout: '#{out}'.") 26: yield(out, err, status) if block_given? 27: end
# File lib/test/unit/systemtest.rb, line 9 9: def run_app(app, *args) 10: cmd = [app, args].flatten.join(" ") 11: out = nil 12: err = nil 13: Timeout::timeout(5) { 14: status = Open4.popen4(cmd) { |cid, stdin, stdout, stderr| 15: out = stdout.read 16: err = stderr.read 17: stdin.close_write 18: } 19: } 20: rescue(Timeout::Error) => err 21: puts "ERROR running #{app} #{args}" 22: puts err 23: puts err.backtrace 24: [out, err, status] 25: end
the above is having problems. I don’t know why
# File lib/test/unit/systemtest.rb, line 29 29: def run_app(app, *args) 30: cmd = "#{app} #{args.join(" ")}" 31: puts "==> Command: #{cmd}" if $DEBUG 32: out = `#{cmd} 2> stderr.txt` 33: status = $? 34: err = File.read("stderr.txt") 35: File.delete("stderr.txt") 36: [out, err, status] 37: end
# File lib/test/unit/CVS/Base/systemtest.rb, line 8 8: def run_app(app, *args) 9: cmd = [app, args].flatten.join(" ") 10: out = nil 11: err = nil 12: status = Open4.popen4(cmd) { |cid, stdin, stdout, stderr| 13: out = stdout.read 14: err = stderr.read 15: stdin.close 16: } 17: [out, err, status] 18: end