summaryrefslogtreecommitdiff
path: root/test/pacman/util.py
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-03-01 14:24:13 -0600
committerDan McGee <dan@archlinux.org>2011-03-01 14:24:13 -0600
commitd68635e7c2bc38343a58a8f9cddf95960fa642be (patch)
tree07198aea7d63e1ee4462473d02658a3970cdb51a /test/pacman/util.py
parentb12be99c8925e758554076c87294b4af10ebf05e (diff)
pactest: use actual regexes in OUTPUT rules
I managed to just make deptest001.py fail by changing a DEBUG-level logger in commit b12be99c89. This should not be this fickle. Enhance the OUTPUT rule to use an actual Python re object when looking for matches, and make a lot of the rules use stronger patterns to match with. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'test/pacman/util.py')
-rwxr-xr-xtest/pacman/util.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/test/pacman/util.py b/test/pacman/util.py
index 359b42bf..b771a345 100755
--- a/test/pacman/util.py
+++ b/test/pacman/util.py
@@ -17,6 +17,7 @@
import os
+import re
import hashlib
import stat
@@ -194,11 +195,13 @@ def which(filename):
return None
def grep(filename, pattern):
- lines = file(filename, 'r').readlines()
- for line in lines:
- if not line: break
- if line.find(pattern) != -1:
+ pat = re.compile(pattern)
+ myfile = open(filename, 'r')
+ for line in myfile:
+ if pat.search(line):
+ myfile.close()
return True
+ myfile.close()
return False
def mkdir(path):