diff options
author | Andrew Gregory <andrew.gregory.8@gmail.com> | 2021-01-19 19:30:07 +0100 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2021-01-21 08:18:37 +0100 |
commit | 743e041dbc22ed16a6f996b0caff6523ffecf136 (patch) | |
tree | 5070fdb0feaad778d00066ef036f5217f475380f /test | |
parent | 1fdf8c00764af9e32f8dec13061f625f48bd4c8c (diff) | |
download | pacman-743e041dbc22ed16a6f996b0caff6523ffecf136.tar.gz pacman-743e041dbc22ed16a6f996b0caff6523ffecf136.tar.xz |
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.py | 10 |
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 |