Succeeds if the specified path is a file and is empty.

Signed-off-by: Andrew Gregory <[email protected]>
---
 test/pacman/README    | 1 +
 test/pacman/pmrule.py | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/test/pacman/README b/test/pacman/README
index c7aeb10..2516a8a 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 ba94ab8..a91741b 100644
--- a/test/pacman/pmrule.py
+++ b/test/pacman/pmrule.py
@@ -112,6 +112,10 @@ def check(self, test):
             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:
-- 
1.8.5.3


Reply via email to