]>
Commit | Line | Data |
---|---|---|
82abe079 | 1 | #! /usr/bin/python2 |
1dc81514 AG |
2 | # |
3 | # Copyright (c) 2006 by Aurelien Foret <orelien@chez.com> | |
801f7d10 | 4 | # Copyright (c) 2006-2013 Pacman Developmet Team <pacman-dev@archlinux.org> |
3ceef977 | 5 | # |
1dc81514 AG |
6 | # This program is free software; you can redistribute it and/or modify |
7 | # it under the terms of the GNU General Public License as published by | |
8 | # the Free Software Foundation; either version 2 of the License, or | |
9 | # (at your option) any later version. | |
10 | # | |
11 | # This program is distributed in the hope that it will be useful, | |
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | # GNU General Public License for more details. | |
15 | # | |
16 | # You should have received a copy of the GNU General Public License | |
9781d0d6 | 17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
1dc81514 AG |
18 | |
19 | ||
20 | import os | |
1dc81514 AG |
21 | |
22 | import pmtest | |
1152052b | 23 | import tap |
1dc81514 AG |
24 | |
25 | ||
b3d71bf7 | 26 | class pmenv(object): |
786cd38c AG |
27 | """Environment object |
28 | """ | |
29 | ||
cf25884e DM |
30 | testcases = [] |
31 | passed = 0 | |
32 | failed = 0 | |
33 | expectedfail = 0 | |
34 | unexpectedpass = 0 | |
35 | ||
786cd38c AG |
36 | def __init__(self, root = "root"): |
37 | self.root = os.path.abspath(root) | |
38 | self.pacman = { | |
39 | "bin": "pacman", | |
40 | "debug": 0, | |
41 | "gdb": 0, | |
42 | "valgrind": 0, | |
43 | "nolog": 0 | |
44 | } | |
786cd38c AG |
45 | |
46 | def __str__(self): | |
47 | return "root = %s\n" \ | |
48 | "pacman = %s" \ | |
49 | % (self.root, self.pacman) | |
50 | ||
51 | def addtest(self, testcase): | |
52 | """ | |
53 | """ | |
54 | if not os.path.isfile(testcase): | |
cf25884e | 55 | raise IOError("test file %s not found" % testcase) |
786cd38c AG |
56 | test = pmtest.pmtest(testcase, self.root) |
57 | self.testcases.append(test) | |
58 | ||
59 | def run(self): | |
60 | """ | |
61 | """ | |
1152052b | 62 | tap.plan(len(self.testcases)) |
786cd38c | 63 | for t in self.testcases: |
1152052b | 64 | tap.diag("Running '%s'" % t.testname) |
786cd38c AG |
65 | |
66 | t.load() | |
801f7d10 | 67 | t.generate(self.pacman) |
786cd38c AG |
68 | t.run(self.pacman) |
69 | ||
1152052b AG |
70 | tap.diag("==> Checking rules") |
71 | tap.todo = t.expectfailure | |
72 | tap.subtest(lambda: t.check(), t.description) | |
786cd38c | 73 | |
786cd38c | 74 | # vim: set ts=4 sw=4 et: |