3 # Copyright (c) 2006 by Aurelien Foret <orelien@chez.com>
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
30 def __init__(self
, root
= "root"):
31 self
.root
= os
.path
.abspath(root
)
42 return "root = %s\n" \
44 % (self
.root
, self
.pacman
)
46 def addtest(self
, testcase
):
49 if not os
.path
.isfile(testcase
):
50 err("file %s not found" % testcase
)
52 test
= pmtest
.pmtest(testcase
, self
.root
)
53 self
.testcases
.append(test
)
59 for t
in self
.testcases
:
61 print "Running '%s'" % t
.testname
68 # Hack for mtimes consistency
70 if i
.rule
.find("MODIFIED") != -1:
77 print "==> Test result"
78 if t
.result
["fail"] == 0:
90 for test
in self
.testcases
:
91 fail
= test
.result
["fail"]
99 success
= test
.result
["success"]
100 fail
= test
.result
["fail"]
101 rules
= len(test
.rules
)
107 print "%s Rules: OK = %2u FAIL = %2u SKIP = %2u" \
108 % (test
.testname
.ljust(34), success
, fail
, \
109 rules
- (success
+ fail
))
111 # print test description if test failed
112 print " ", test
.description
117 for test
in tpassed
: _printtest(test
)
119 for test
in tfailed
: _printtest(test
)
122 total
= len(self
.testcases
)
123 failed
= total
- passed
124 print "TOTAL = %3u" % total
126 print "PASS = %3u (%6.2f%%)" % (passed
, float(passed
) * 100 / total
)
127 print "FAIL = %3u (%6.2f%%)" % (failed
, float(failed
) * 100 / total
)
130 if __name__
== "__main__":
133 # vim: set ts=4 sw=4 et: