Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2021-01-19 10:30:07 -0800
committerAllan McRae <allan@archlinux.org>2021-01-21 17:18:37 +1000
commit743e041dbc22ed16a6f996b0caff6523ffecf136 (patch)
tree5070fdb0feaad778d00066ef036f5217f475380f /test
parent1fdf8c00764af9e32f8dec13061f625f48bd4c8c (diff)
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>
Diffstat (limited to 'test')
-rw-r--r--test/pacman/pmrule.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/pacman/pmrule.py b/test/pacman/pmrule.py
index 59293266..aef73cdb 100644
--- a/test/pacman/pmrule.py
+++ b/test/pacman/pmrule.py
@@ -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