[pacman-dev] [PATCH 4/7] add CACHE_FEXISTS and CACHE_FCONTENTS test rules
Andrew Gregory
andrew.gregory.8 at gmail.com
Tue Jan 19 18:30:07 UTC 2021
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 at gmail.com>
---
test/pacman/pmrule.py | 10 ++++++++++
1 file changed, 10 insertions(+)
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 @@ def check(self, test):
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
--
2.30.0
More information about the pacman-dev
mailing list