summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2014-02-03 12:05:47 -0500
committerAllan McRae <allan@archlinux.org>2014-02-04 13:44:38 +1000
commit4763341ea11c9e33f8d8f0f112659fae5bc74aa9 (patch)
tree15254277360a41a9e2df9575d4f4c611167e55fa
parent1601532a53b3b668b0946400bb2c68ca25f80c72 (diff)
downloadpacman-4763341ea11c9e33f8d8f0f112659fae5bc74aa9.tar.xz
pmrule: add FILE_EMPTY rule
Succeeds if the specified path is a file and is empty. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
-rw-r--r--test/pacman/README1
-rw-r--r--test/pacman/pmrule.py4
2 files changed, 5 insertions, 0 deletions
diff --git a/test/pacman/README b/test/pacman/README
index c7aeb10a..2516a8ad 100644
--- a/test/pacman/README
+++ b/test/pacman/README
@@ -299,6 +299,7 @@ its DEPENDS field.
. FILE rules
FILE_EXIST=path/to/file
+ FILE_EMPTY=path/to/file
FILE_MODIFIED=path/to/file
FILE_MODE=path/to/file|octal
FILE_TYPE=path/to/file|type (possible types: dir, file, link)
diff --git a/test/pacman/pmrule.py b/test/pacman/pmrule.py
index ba94ab8c..a91741be 100644
--- a/test/pacman/pmrule.py
+++ b/test/pacman/pmrule.py
@@ -112,6 +112,10 @@ class pmrule(object):
if case == "EXIST":
if not os.path.isfile(filename):
success = 0
+ elif case == "EMPTY":
+ if not (os.path.isfile(filename)
+ and os.path.getsize(filename) == 0):
+ success = 0
elif case == "MODIFIED":
for f in test.files:
if f.name == key: