1 # Copyright (C) 2010 Red Hat, Inc. All rights reserved.
3 # This copyrighted material is made available to anyone wishing to use,
4 # modify, copy, or redistribute it subject to the terms and conditions
5 # of the GNU General Public License v.2.
7 # You should have received a copy of the GNU General Public License
8 # along with this program; if not, write to the Free Software Foundation,
9 # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
11 # Parses the simple colon delimited test schedule files.
13 ScheduledTest = Struct.new(:desc, :command_line, :status, :output)
16 attr_reader :dir, :schedules
18 def initialize(dir, ss)
24 Dir::chdir(@dir.to_s) do
25 @schedules.each do |s|
26 reader, writer = IO.pipe
27 print "#{s.desc} ... "
28 pid = spawn(s.command_line, [ STDERR, STDOUT ] => writer)
30 _, s.status = Process::waitpid2(pid)
31 puts (s.status.success? ? "pass" : "fail")
32 s.output = reader.read
37 def self.read(dir, io)
40 io.readlines.each do |line|
46 ss << ScheduledTest.new($1.strip, $2.strip)
49 raise RuntimeError, "badly formatted schedule line"