import shutil
import contextlib
import pprint
-import traceback
from tempfile import TemporaryDirectory
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",
+ "LTTNG_APP_SOCKET_TIMEOUT": "-1",
#"LTTNG_UST_REGISTER_TIMEOUT": "-1",
"LTTNG_NETWORK_SOCKET_TIMEOUT": "-1"}
def add_project(self, project):
self.__projects.append(project)
+ def remove_project(self, project):
+ self.__projects.remove(project)
+
def subprocess_signal(self, subprocess_uuid, signal):
self.__subproces[subprocess_uuid].send_signal(signal)
_logger.debug("Spawned sub pid: {} args: {} stdout: {} stderr{}".format(p.pid, p.args, out_path, err_path))
return tmp_id
- def run(self, command_line, cwd=None, check_return=True, ld_preload=""):
+ def run(self, command_line, cwd=None, check_return=True, ld_preload="", classpath=""):
"""
Run the command and return a tuple of a (CompletedProcess, stdout_path,
stderr_path). The subprocess is already executed and returned. The
if ld_preload:
env['LD_PRELOAD'] = ld_preload
+ if classpath:
+ env['CLASSPATH'] = classpath
tmp_id = self._run_command_count
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():
# Copy the lttng_home used at runtime using hardlink to prevent useless
# data duplication
shutil.copytree(self.lttng_home, self.__post_runtime_lttng_home_path, copy_function=os.link)
-