Unload test module only if it was loaded
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Wed, 15 Nov 2017 18:47:16 +0000 (13:47 -0500)
committerJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Wed, 15 Nov 2017 18:47:16 +0000 (13:47 -0500)
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
lttng_ivc/utils/runtime.py

index 3a776cbf2169d348a6f9b78fe6142b80e5802efe..9efdabee085b0bc7d4c33ec5160209002eddef93 100644 (file)
@@ -46,6 +46,7 @@ class Runtime(object):
         self._runtime_log_aggregation = os.path.join(self.__runtime_log, "runtime.log")
 
         self._run_command_count = 0
+        self._is_test_modules_loaded = False
 
         self.special_env_variables = {"LTTNG_UST_DEBUG": "1",
                                       "LTTNG_APP_SOCKET_TIMEOUT": "-1",
@@ -239,10 +240,12 @@ class Runtime(object):
     def load_test_module(self):
         # Base directory is provided by env
         self.run("modprobe lttng-test")
+        self._is_test_modules_loaded = True
 
     def unload_test_module(self, check_return=True):
         # Base directory is provided by env
-        self.run("modprobe -r lttng-test", check_return=check_return)
+        if self._is_test_modules_loaded:
+            self.run("modprobe -r lttng-test", check_return=check_return)
 
     def close(self):
         for key, subp in self.__subprocess.items():
This page took 0.024931 seconds and 5 git commands to generate.