From 8e0716e93e206f949912b2507cc5c0b91999dbce Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Thu, 17 Nov 2016 17:43:11 +0100 Subject: Revert "tests: py: nft-tests.py: Add function for loading and removing kernel modules" 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 Signed-off-by: Florian Westphal Acked-by: Manuel Messner --- tests/py/nft-test.py | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/tests/py/nft-test.py b/tests/py/nft-test.py index c1217bbb..fc7ae608 100755 --- a/tests/py/nft-test.py +++ b/tests/py/nft-test.py @@ -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() -- cgit v1.2.3