commit 6154747b8416b5640a9dd9a246f5ea817fd1ac10 Author: Radek Pazdera rpazdera@redhat.com Date: Thu Sep 26 10:43:48 2013 +0200
test_modules: Removing the 'Test' prefix from modules
In order to be loaded properly, each test module was required to use 'Test' prefix in its name. However, in recipes, the prefix was never used.
This was justified when the modules were mixed with other code. However, this hasn't been the case for quite a while now. The modules are kept in their own directory, so requiring a prefix is not necessary any more.
This patch removes the prefixes from module names.
Signed-off-by: Radek Pazdera rpazdera@redhat.com Signed-off-by: Jiri Pirko jiri@resnulli.us
lnst/Common/NetTestCommand.py | 2 +- lnst/Common/ResourceCache.py | 2 +- lnst/Controller/NetTestController.py | 2 +- .../{TestDummyFailing.py => DummyFailing.py} | 2 +- test_modules/{TestIcmp6Ping.py => Icmp6Ping.py} | 2 +- test_modules/{TestIcmpPing.py => IcmpPing.py} | 2 +- test_modules/{TestIperf.py => Iperf.py} | 2 +- test_modules/{TestMulticast.py => Multicast.py} | 2 +- test_modules/{TestNetCat.py => NetCat.py} | 2 +- .../{TestPacketAssert.py => PacketAssert.py} | 2 +- test_modules/{TestPktCounter.py => PktCounter.py} | 2 +- test_modules/{TestPktgenTx.py => PktgenTx.py} | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) --- diff --git a/lnst/Common/NetTestCommand.py b/lnst/Common/NetTestCommand.py index 9e1708d..abd7400 100644 --- a/lnst/Common/NetTestCommand.py +++ b/lnst/Common/NetTestCommand.py @@ -243,7 +243,7 @@ def NetTestCommandTest(command, resource_table): raise Exception(msg)
module_path = resource_table["module"][test_name] - module_name = "Test%s" % test_name + module_name = test_name
module = imp.load_source(module_name, module_path) test_class = getattr(module, module_name) diff --git a/lnst/Common/ResourceCache.py b/lnst/Common/ResourceCache.py index a4ab955..8719b09 100644 --- a/lnst/Common/ResourceCache.py +++ b/lnst/Common/ResourceCache.py @@ -102,7 +102,7 @@ class ResourceCache(object): entry_path = "%s/%s" % (entry_dir, os.path.basename(filepath))
if entry_type == "module": - filename = "Test%s.py" % entry_name + filename = "%s.py" % entry_name shutil.move(entry_path, "%s/%s" % (entry_dir, filename)) elif entry_type == "tools": filename = entry_name diff --git a/lnst/Controller/NetTestController.py b/lnst/Controller/NetTestController.py index 85253ed..e55c36d 100644 --- a/lnst/Controller/NetTestController.py +++ b/lnst/Controller/NetTestController.py @@ -663,7 +663,7 @@ class NetTestController: for f in files: test_path = os.path.abspath("%s/%s" % (dir_name, f)) if os.path.isfile(test_path): - match = re.match("Test(.+).py$", f) + match = re.match("(.+).py$", f) if match: test_name = match.group(1) test_hash = md5sum(test_path) diff --git a/test_modules/TestDummyFailing.py b/test_modules/DummyFailing.py similarity index 92% rename from test_modules/TestDummyFailing.py rename to test_modules/DummyFailing.py index 4ea342d..fed9fe4 100644 --- a/test_modules/TestDummyFailing.py +++ b/test_modules/DummyFailing.py @@ -13,7 +13,7 @@ jpirko@redhat.com (Jiri Pirko) import logging from lnst.Common.TestsCommon import TestGeneric
-class TestDummyFailing(TestGeneric): +class DummyFailing(TestGeneric): def run(self): res_data = {"msg": "what else did you expect?"} return self.set_fail(res_data) diff --git a/test_modules/TestIcmp6Ping.py b/test_modules/Icmp6Ping.py similarity index 98% rename from test_modules/TestIcmp6Ping.py rename to test_modules/Icmp6Ping.py index 83550c5..3c5c994 100644 --- a/test_modules/TestIcmp6Ping.py +++ b/test_modules/Icmp6Ping.py @@ -11,7 +11,7 @@ from lnst.Common.TestsCommon import TestGeneric from lnst.Common.ExecCmd import exec_cmd
-class TestIcmp6Ping(TestGeneric): +class Icmp6Ping(TestGeneric): def compose_cmd(self): addr = self.get_mopt("addr", opt_type="addr") cmd = "ping6 %s" % addr diff --git a/test_modules/TestIcmpPing.py b/test_modules/IcmpPing.py similarity index 98% rename from test_modules/TestIcmpPing.py rename to test_modules/IcmpPing.py index 6920056..6f7380c 100644 --- a/test_modules/TestIcmpPing.py +++ b/test_modules/IcmpPing.py @@ -15,7 +15,7 @@ import re from lnst.Common.TestsCommon import TestGeneric from lnst.Common.ExecCmd import exec_cmd
-class TestIcmpPing(TestGeneric): +class IcmpPing(TestGeneric): def _compose_cmd(self): addr = self.get_mopt("addr", opt_type="addr") cmd = "ping %s" % addr diff --git a/test_modules/TestIperf.py b/test_modules/Iperf.py similarity index 99% rename from test_modules/TestIperf.py rename to test_modules/Iperf.py index a58104d..2982cff 100644 --- a/test_modules/TestIperf.py +++ b/test_modules/Iperf.py @@ -14,7 +14,7 @@ from lnst.Common.TestsCommon import TestGeneric from lnst.Common.ExecCmd import exec_cmd from lnst.Common.ShellProcess import ShellProcess
-class TestIperf(TestGeneric): +class Iperf(TestGeneric): def _compose_iperf_cmd(self, role): iperf_options = self.get_opt("iperf_opts") if iperf_options is None: diff --git a/test_modules/TestMulticast.py b/test_modules/Multicast.py similarity index 99% rename from test_modules/TestMulticast.py rename to test_modules/Multicast.py index cb5a60e..4865957 100644 --- a/test_modules/TestMulticast.py +++ b/test_modules/Multicast.py @@ -16,7 +16,7 @@ from lnst.Common.TestsCommon import TestGeneric from lnst.Common.NetTestCommand import CommandException from lnst.Common.ExecCmd import exec_cmd
-class TestMulticast(TestGeneric): +class Multicast(TestGeneric): """ Wrapper for executing the multicast test tools in LNST
Running this test executes specified test setup from diff --git a/test_modules/TestNetCat.py b/test_modules/NetCat.py similarity index 98% rename from test_modules/TestNetCat.py rename to test_modules/NetCat.py index 89c7e4b..ffa4c9f 100644 --- a/test_modules/TestNetCat.py +++ b/test_modules/NetCat.py @@ -16,7 +16,7 @@ import logging from lnst.Common.TestsCommon import TestGeneric from lnst.Common.ShellProcess import ShellProcess
-class TestNetCat(TestGeneric): +class NetCat(TestGeneric): def _get_stream(self): return self.get_opt("stream", default="tcp")
diff --git a/test_modules/TestPacketAssert.py b/test_modules/PacketAssert.py similarity index 99% rename from test_modules/TestPacketAssert.py rename to test_modules/PacketAssert.py index d8a73e3..c716c66 100644 --- a/test_modules/TestPacketAssert.py +++ b/test_modules/PacketAssert.py @@ -17,7 +17,7 @@ import re import signal from lnst.Common.TestsCommon import TestGeneric
-class TestPacketAssert(TestGeneric): +class PacketAssert(TestGeneric): """ Assert for number of incomming/outgoing packets Capturing backend of this class is provided by tcpdump(8). diff --git a/test_modules/TestPktCounter.py b/test_modules/PktCounter.py similarity index 98% rename from test_modules/TestPktCounter.py rename to test_modules/PktCounter.py index 7eec92c..bb0325b 100644 --- a/test_modules/TestPktCounter.py +++ b/test_modules/PktCounter.py @@ -38,7 +38,7 @@ def get_pkt_count(indev_name, dport, proto): return None return match.groups()[0]
-class TestPktCounter(TestGeneric): +class PktCounter(TestGeneric): def run(self): indev_name = self.get_opt("input_netdev_name") dport = self.get_opt("dport") diff --git a/test_modules/TestPktgenTx.py b/test_modules/PktgenTx.py similarity index 98% rename from test_modules/TestPktgenTx.py rename to test_modules/PktgenTx.py index 684640f..cf35b5f 100644 --- a/test_modules/TestPktgenTx.py +++ b/test_modules/PktgenTx.py @@ -61,7 +61,7 @@ def pktget_options_merge(pktgen_options, default_pktgen_options): res = res + opts return [" ".join(opt) for opt in res]
-class TestPktgenTx(TestGeneric): +class PktgenTx(TestGeneric): def run(self): dev_names = self.get_multi_mopt("netdev_name") pktgen_options = self.get_multi_mopt("pktgen_option")