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, write to the Free Software
17 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
32 def __init__(self
, root
= "root"):
33 self
.root
= os
.path
.abspath(root
)
44 return "root = %s\n" \
46 % (self
.root
, self
.pacman
)
48 def addtest(self
, testcase
):
51 if not os
.path
.isfile(testcase
):
52 err("file %s not found" % testcase
)
54 test
= pmtest
.pmtest(testcase
, self
.root
)
55 self
.testcases
.append(test
)
61 for t
in self
.testcases
:
63 print "Running '%s'" % t
.testname
70 # Hack for mtimes consistency
73 if i
.rule
.find("MODIFIED") != -1:
81 print "==> Test result"
82 if t
.result
["fail"] == 0:
94 for test
in self
.testcases
:
95 fail
= test
.result
["fail"]
103 success
= test
.result
["success"]
104 fail
= test
.result
["fail"]
105 rules
= len(test
.rules
)
111 print "%s Rules: OK = %2u FAIL = %2u SKIP = %2u" \
112 % (test
.testname
.ljust(34), success
, fail
, \
113 rules
- (success
+ fail
))
115 # print test description if test failed
116 print " ", test
.description
121 for test
in tpassed
: _printtest(test
)
123 for test
in tfailed
: _printtest(test
)
126 total
= len(self
.testcases
)
127 failed
= total
- passed
128 print "TOTAL = %3u" % total
130 print "PASS = %3u (%6.2f%%)" % (passed
, float(passed
) * 100 / total
)
131 print "FAIL = %3u (%6.2f%%)" % (failed
, float(failed
) * 100 / total
)
134 if __name__
== "__main__":
137 # vim: set ts=4 sw=4 et: