[iptables] iptables-test: Run tests in lexical order
diff mbox series

Message ID 20190927125716.1769-1-phil@nwl.cc
State Accepted
Delegated to: Pablo Neira
Headers show
Series
  • [iptables] iptables-test: Run tests in lexical order
Related show

Commit Message

Phil Sutter Sept. 27, 2019, 12:57 p.m. UTC
To quickly see if a given test was run or not, sort the file list. Also
filter non-test files right when preparing the list.

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 iptables-test.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Pablo Neira Ayuso Sept. 30, 2019, 2:30 p.m. UTC | #1
On Fri, Sep 27, 2019 at 02:57:16PM +0200, Phil Sutter wrote:
> To quickly see if a given test was run or not, sort the file list. Also
> filter non-test files right when preparing the list.
> 
> Signed-off-by: Phil Sutter <phil@nwl.cc>

Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>

Patch
diff mbox series

diff --git a/iptables-test.py b/iptables-test.py
index 2aac8ef2256dc..fdb4e6a3644e4 100755
--- a/iptables-test.py
+++ b/iptables-test.py
@@ -359,10 +359,14 @@  def main():
         print("Couldn't open log file %s" % LOGFILE)
         return
 
-    file_list = [os.path.join(EXTENSIONS_PATH, i)
-                 for i in os.listdir(EXTENSIONS_PATH)]
     if args.filename:
         file_list = [args.filename]
+    else:
+        file_list = [os.path.join(EXTENSIONS_PATH, i)
+                     for i in os.listdir(EXTENSIONS_PATH)
+                     if i.endswith('.t')]
+        file_list.sort()
+
     for filename in file_list:
         file_tests, file_passed = run_test_file(filename, args.netns)
         if file_tests: