[PATCH nft 5/7] test: py: print path of the logfile

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 tests/py/README      | 2 ++
 tests/py/nft-test.py | 5 ++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/tests/py/README b/tests/py/README
index a156032..0e12dfa 100644
--- a/tests/py/README
+++ b/tests/py/README
@@ -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
 
diff --git a/tests/py/nft-test.py b/tests/py/nft-test.py
index 2be4700..b536e9c 100755
--- a/tests/py/nft-test.py
+++ b/tests/py/nft-test.py
@@ -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 = []
-- 
ecklm

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux