]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: py: print path of the logfile
authorMáté Eckl <ecklm94@gmail.com>
Thu, 17 May 2018 07:37:00 +0000 (09:37 +0200)
committerFlorian Westphal <fw@strlen.de>
Thu, 17 May 2018 13:35:36 +0000 (15:35 +0200)
It is good to know that a log is generated even without browsing the
nft-test.py source code.

Also print_info function is introduced.

Signed-off-by: Máté Eckl <ecklm94@gmail.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
tests/py/README
tests/py/nft-test.py

index a1560329d14a3d814517eddde56d3c6a2ff28f46..0e12dfa883e19f2d6f303386f4e794d3286966ad 100644 (file)
@@ -132,6 +132,8 @@ E) Meaning of messages:
 * A warning message means the rule input and output of nft mismatches.
 * An error message means the nft-tool shows an error when we add it or
   the listing is broken after the rule is added.
+* An info message means something that is not necessarily related to any test
+  case and does not indicate faulty behaviour.
 
 F) Acknowledgements
 
index 2be4700463b7ff3a80d96ab54d88d6c558c7f737..b536e9cdd813cf4db511d1aa8c1457d89bf8bff7 100755 (executable)
@@ -124,6 +124,8 @@ def print_error(reason, filename=None, lineno=None):
 def print_warning(reason, filename=None, lineno=None):
     print_msg(reason, "WARNING:", filename, lineno, Colors.YELLOW)
 
+def print_info(reason, filename=None, lineno=None):
+    print_msg(reason, "INFO:", filename, lineno, Colors.GREEN)
 
 def color_differences(rule, other, color):
     rlen = len(rule)
@@ -1350,8 +1352,9 @@ def main():
     global log_file
     try:
         log_file = open(LOGFILE, 'w')
+        print_info("Log will be available at %s" % LOGFILE)
     except IOError:
-        print "Cannot open log file %s" % LOGFILE
+        print_error("Cannot open log file %s" % LOGFILE)
         return
 
     file_list = []