44
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1 #!/usr/bin/ruby
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
3 require 'ostruct'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
4 require 'unittest'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
5 require 'rexml/document'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
6 include REXML
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
7
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
8 options = OpenStruct.new
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
9 options.outfile = ""
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
10 options.infile = ""
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
11 options.version = "unknown"
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
12
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
13 if ARGV[1]==nil then
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14 puts "Usage: buildxml.rb <inputfile> <outputfile>"
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15 exit
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17 options.infile = ARGV[0]
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18 options.outfile = ARGV[1]
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
19 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21 class UnitTestProcessor
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22 attr_accessor :ut
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
23
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
24 def initialize
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
25 @ut = UnitTest.new
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
26 @results = []
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
27 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
28
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
29 def result=(newResult)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
30 testvalues = newResult.split(",")
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
31 @ut.path = getPath(testvalues)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
32 @ut.title = getTitle(testvalues)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
33 @ut.code = getCode(testvalues)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
34 result = Result.new
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
35 result.syntax = testvalues[1]
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
36 result.algorithm = testvalues[2]
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
37 result.date = Date.new(testvalues[4].to_i)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
38 result.number = testvalues[3].to_i
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
39 @ut.results << result
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
40 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
41
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
42 # generates the path out of the test name
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
43 def getPath(testvalues)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
44 parts = testvalues[0].split("_")
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
45 folder = parts[1]
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
46 parts.pop
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
47 filename = parts.join("_") + ".m"
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
48 "utps/" + folder + "/" + filename
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
49 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
50
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
51 # generates the title out of the test name
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
52 def getTitle(testvalues)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
53 parts = testvalues[0].split("_")
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
54 parts.pop
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
55 parts.shift
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
56 #parts[0].upcase!
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
57 parts.join(" ")
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
58 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
59
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
60 # generates the title out of the test name
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
61 def getCode(testvalues)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
62 parts = testvalues[0].split("_")
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
63 parts.pop
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
64 parts.join("_")
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
65 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
66
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
67 def parseFile
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
68 begin
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
69 if !File.exists? @ut.path then
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
70 return
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
71 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
72 inFile = File.new(@ut.path)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
73 currentTest = SubTest.new
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
74 while line = inFile.readline.chomp
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
75 # TODO: strip HTML-Tags
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
76 # remove trailing spaces
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
77 line.rstrip!
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
78
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
79 if line.match /[%]+[ ]+UTP_[0-9]+/ then
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
80 currentTest = SubTest.new
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
81 parts = line.split("_")
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
82 currentTest.number = parts[1].to_i
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
83 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
84
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
85 if line.match(/[%]+[ ]+END[ ]+UTP_[0-9]+/) and currentTest.number > 0 then
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
86 @ut.tests << currentTest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
87 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
88
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
89 if line.match "</MethodDescription>" then writeTo = "none" end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
90 if line.match "</SyntaxDescription>" then writeTo = "none" end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
91 if line.match "</TestDescription>" then writeTo = "none" end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
92 if line.match "</AlgoDescription>" then writeTo = "none" end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
93 if line.match "</SyntaxCode>" then writeTo = "none" end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
94 if line.match "</AlgoCode>" then writeTo = "none" end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
95
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
96
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
97
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
98 case writeTo
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
99 when "none" then
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
100 a = 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
101 when "algoCode" then
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
102 currentTest.algoCode += line + "\n"
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
103 when "algoDescription" then
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
104 currentTest.algoDescription += removeComment line
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
105 when "syntaxCode" then
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
106 currentTest.syntaxCode += line + "\n"
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
107 when "syntaxDescription" then
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
108 currentTest.syntaxDescription += removeComment line
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
109 when "methodDescription" then
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
110 @ut.methodDescription += removeComment line
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
111 when "testDescription" then
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
112 currentTest.testDescription += removeComment line
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
113 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
114
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
115 if line.match "<MethodDescription>" then writeTo = "methodDescription" end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
116 if line.match "<SyntaxDescription>" then writeTo = "syntaxDescription" end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
117 if line.match "<TestDescription>" then writeTo = "testDescription" end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
118 if line.match "<AlgoDescription>" then writeTo = "algoDescription" end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
119 if line.match "<SyntaxCode>" then writeTo = "syntaxCode" end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
120 if line.match "<AlgoCode>" then writeTo = "algoCode" end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
121
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
122 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
123 rescue EOFError
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
124 inFile.close
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
125 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
126 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
127
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
128 # The analysis of a single line of the .m file
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
129 def removeComment(line)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
130 line.strip!
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
131 while line.match /^%/
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
132 # not elegant, but works in every realistic case (cut off at 100000 chars)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
133 line = line[1,100000]
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
134 line.strip!
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
135 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
136 if line.length>0 then
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
137 line = line + "<br />"
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
138 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
139 line
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
140 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
141
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
142 # Merge Results and Test for easier access
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
143 def mergeTestsAndResults
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
144 @ut.tests.each do |t|
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
145 @ut.results.each do |r|
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
146 if t.number == r.number then
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
147 t.date = r.date
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
148 t.syntaxResult = r.syntax.to_i
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
149 t.algoResult = r.algorithm.to_i
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
150 if t.syntaxResult==0 or t.algoResult==0 then
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
151 @ut.tainted = true
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
152 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
153 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
154 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
155 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
156 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
157 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
158
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
159 infile = File.open(options.infile, 'r');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
160 outfile = File.open(options.outfile, 'w');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
161
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
162 tests = []
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
163
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
164 begin
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
165 while line = infile.readline.chomp
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
166 testvalues = line.split(",")
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
167 parts = testvalues[0].split("_")
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
168 parts.pop
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
169 tests << parts.join("_")
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
170 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
171 rescue EOFError
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
172 infile.close
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
173 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
174
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
175 tests = tests.uniq
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
176
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
177 # For testing: tests fet only for the first test
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
178 #tests = []
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
179 #tests << "utp_ao_join_fsdata"
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
180 utps = []
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
181 puts "Collecting data ..."
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
182 tests.each do |t|
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
183 inFile = File.open(options.infile, 'r')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
184 utp = UnitTestProcessor.new
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
185 begin
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
186 while line = inFile.readline.chomp
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
187 if line.match t then
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
188 utp.result = line
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
189 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
190 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
191 rescue EOFError
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
192 inFile.close
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
193 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
194 utps << utp
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
195 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
196
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
197 unittests = []
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
198
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
199 i=1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
200
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
201 utps.each do |u|
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
202 puts "Parsing file " + i.to_s + " of " + utps.length.to_s + " (" + u.ut.path + ") ..."
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
203 i += 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
204 u.parseFile
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
205 u.mergeTestsAndResults
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
206 unittests << u.ut
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
207 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
208
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
209 #if(options.outfile HERE MATCHES DAT) then
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
210 Marshal.dump(unittests, outfile)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
211 #elseif(optione.outfile. HERE MATCHES XML then
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
212 # doc = Document.new()
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
213 # root = Element.new("Report")
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
214 # root.add_attribute 'date', Time.now.to_s
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
215 # root.add_attribute 'version', options.version
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
216 # unittests.each do |u|
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
217 # testEl = Element.new("
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
218 # end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
219 #end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
220 outfile.close
|