add CACHE_FEXISTS and CACHE_FCONTENTS test rules
The existing CACHE_EXISTS rule takes a package, which is not suitable for -U tests that need to be able to check for specific files. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
1fdf8c0076
commit
743e041dbc
1 changed files with 10 additions and 0 deletions
|
@ -181,6 +181,16 @@ class pmrule(object):
|
|||
if not pkg or not os.path.isfile(
|
||||
os.path.join(cachedir, pkg.filename())):
|
||||
success = 0
|
||||
elif case == "FEXISTS":
|
||||
if not os.path.isfile(os.path.join(cachedir, key)):
|
||||
success = 0
|
||||
elif case == "FCONTENTS":
|
||||
filename = os.path.join(cachedir, key)
|
||||
try:
|
||||
with open(filename, 'r') as f:
|
||||
success = f.read() == value
|
||||
except:
|
||||
success = 0
|
||||
else:
|
||||
tap.diag("Rule kind '%s' not found" % kind)
|
||||
success = -1
|
||||
|
|
Loading…
Add table
Reference in a new issue