]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
Revert "tests: py: nft-tests.py: Add function for loading and removing kernel modules"
authorFlorian Westphal <fw@strlen.de>
Thu, 17 Nov 2016 16:43:11 +0000 (17:43 +0100)
committerFlorian Westphal <fw@strlen.de>
Thu, 17 Nov 2016 22:17:06 +0000 (23:17 +0100)
Its not needed at the moment, all tests that need a network interface
(meta iif/oif) use the lo interface.

For iifname/oifname the network device doesn't have to exist.

We can revisit this in case we need it in the future.

(seems commit causes issues on kernels built without dummy module).

Reported-by: Arturo Borrero Gonzalez <arturo@debian.org>
Signed-off-by: Florian Westphal <fw@strlen.de>
Acked-by: Manuel Messner <mm@skelett.io>
tests/py/nft-test.py

index c1217bbbe72b7d8d95f6a79fbc4a0b0661761a4c..fc7ae608b46b209ab5ff981ba2d3196a1abe2f61 100755 (executable)
@@ -28,7 +28,6 @@ table_list = []
 chain_list = []
 all_set = dict()
 signal_received = 0
-modules = []
 
 
 class Colors:
@@ -115,30 +114,6 @@ def print_differences_error(filename, lineno, cmd):
           str(lineno + 1) + ": '" + cmd + "': " + reason
 
 
-def cleanup_modules():
-    for i in modules:
-        modprobe(i, remove=True)
-
-
-def modprobe(name, remove=False):
-    '''
-    Loads or removes a kernel module
-    '''
-    if name is None:
-        return -1
-
-    cmds = {
-        'ins': ['modprobe', '--first-time', '--quiet', name],
-        'del': ['modprobe', '-r', name],
-    }
-
-    ret = subprocess.call(cmds['del' if remove else 'ins']) == 0
-    if ret and not remove:
-        # the kernel module has been loaded -> remove it afterwards
-        global modules
-        modules.append(name)
-
-
 def table_exist(table, filename, lineno):
     '''
     Exists a table.
@@ -711,8 +686,6 @@ def cleanup_on_exit():
             set_delete(table)
         table_delete(table)
 
-    cleanup_modules()
-
 
 def signal_handler(signal, frame):
     global signal_received
@@ -992,8 +965,6 @@ def main():
         print "The nft binary does not exist. You need to build the project."
         return
 
-    modprobe('dummy')
-
     test_files = files_ok = run_total = 0
     tests = passed = warnings = errors = 0
     global log_file
@@ -1001,7 +972,6 @@ def main():
         log_file = open(LOGFILE, 'w')
     except IOError:
         print "Cannot open log file %s" % LOGFILE
-        cleanup_modules()
         return
 
     file_list = []
@@ -1050,8 +1020,6 @@ def main():
                       "%d error, %d warning" \
                       % (test_files, files_ok, tests, errors, warnings)
 
-    cleanup_modules()
-
 
 if __name__ == '__main__':
     main()