From f8b113ed97652da62c217cef139c58ca1d75d647 Mon Sep 17 00:00:00 2001 From: Aaron Griffin Date: Thu, 29 Nov 2007 22:33:45 -0600 Subject: Fail sanely on OUTPUT rules when --nolog is passed Check for existence of the logfile first, and output an error if not found Signed-off-by: Aaron Griffin Signed-off-by: Dan McGee --- pactest/pmrule.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'pactest') diff --git a/pactest/pmrule.py b/pactest/pmrule.py index f4e35443..ea3ad333 100755 --- a/pactest/pmrule.py +++ b/pactest/pmrule.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . - +import os from util import * from stat import * @@ -52,7 +52,11 @@ class pmrule: if retcode != int(key): success = 0 elif case == "OUTPUT": - if not grep(os.path.join(root, LOGFILE), key): + logfile = os.path.join(root, LOGFILE) + if not os.access(logfile, os.F_OK): + print "LOGFILE not found, cannot validate 'OUTPUT' rule" + success = 0 + elif not grep(os.path.join(root, LOGFILE), key): success = 0 else: print "PACMAN rule '%s' not found" % case -- cgit v1.2.3-70-g09d2