Force LD_BIND_NOW on all runtime invocation.
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Tue, 12 Dec 2017 03:13:21 +0000 (22:13 -0500)
committerJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Thu, 14 Dec 2017 20:24:28 +0000 (15:24 -0500)
Behavior regarding lazy on immediate binding can vary based on
distribution and gcc configuration.

We are interested in the immediate binding case (LD_BIN_NOW, ld.so '-z now').

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
README
lttng_ivc/tests/tools_liblttng-ctl_vs_sessiond/test_tools_liblttng-ctl_vs_sessiond.py
lttng_ivc/utils/runtime.py

diff --git a/README b/README
index 9865bbf5fd42412f89255c07116e73fb0bbea29f..1170d37554e8f22be5f820025d9aa65119bbb70b 100644 (file)
--- a/README
+++ b/README
@@ -30,3 +30,13 @@ How to run:
 With tox:
 
 1: tox -r ./
+
+Findings
+========
+
+The binding type (ld.so) (now or lazy) is dependent on the gcc/ld distribution
+configuration. Hence, for this test suite, we force the behavior to "now". This
+result in the lookup of all required symbols at launch. This is particularly
+important since we want to prevent inconsistent behavior. Immediate might be
+forced in the future for lttng project but for now we simply force it at
+runtime.
index 1259ec06ae73fbadfb4c8337973d17ede438ba2f..2776ff212bf4e68871c0d0ab9d00d4907e907b47 100644 (file)
@@ -81,7 +81,7 @@ def test_tools_liblttng_ctl_vs_sessiond_basic_listing(tmpdir, client_label, tool
 
         sessiond = utils.sessiond_spawn(runtime_tools)
 
-        cp, out, err = runtime_tools.run('{} create trace'.format(lttng_client), check_return=False)
+        cp, out, err = runtime_tools.run('{} create trace'.format(lttng_client), check_return=False, ld_debug=True)
         if outcome == "Missing symbol":
             assert(cp.returncode != 0)
             assert(utils.file_contains(err, "Missing symbol"))
@@ -89,12 +89,12 @@ def test_tools_liblttng_ctl_vs_sessiond_basic_listing(tmpdir, client_label, tool
 
         assert(cp.returncode == 0)
 
-        runtime_tools.run('lttng enable-event -u tp:tptest')
-        runtime_tools.run('lttng start')
+        runtime_tools.run('{} enable-event -u tp:tptest'.format(lttng_client))
+        runtime_tools.run('{} start'.format(lttng_client))
 
         # Stop tracing
-        runtime_tools.run('lttng stop')
-        runtime_tools.run('lttng destroy -a')
+        runtime_tools.run('{} stop'.format(lttng_client))
+        runtime_tools.run('{} destroy -a'.format(lttng_client))
         cp = runtime_tools.subprocess_terminate(sessiond)
         if cp.returncode != 0:
             pytest.fail("Sessiond return code")
index 716617608c50879f98b6a9ea80146e7ed3a8f1e1..41194e0a71c4eebc38454f596d218ed341141580 100644 (file)
@@ -162,7 +162,8 @@ class Runtime(object):
         _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="", classpath="", timeout=None):
+    def run(self, command_line, cwd=None, check_return=True, ld_preload="",
+            classpath="", timeout=None, ld_debug=False):
         """
         Run the command and return a tuple of a (CompletedProcess, stdout_path,
         stderr_path). The subprocess is already executed and returned. The
@@ -175,7 +176,9 @@ class Runtime(object):
             env['LD_PRELOAD'] = ld_preload
         if classpath:
             env['CLASSPATH'] = classpath
-
+        if ld_debug:
+            # ld debugging switch
+            env["LD_DEBUG"] = "all"
 
         tmp_id = self._run_command_count
         self._run_command_count += 1
@@ -245,6 +248,7 @@ class Runtime(object):
         env = os.environ.copy()
 
         env["LTTNG_HOME"] = self.lttng_home
+        env["LD_BIND_NOW"] = "enabled"
 
         env_fetch = {"CPPFLAGS": (self.get_cppflags(), " "),
                      "LDFLAGS": (self.get_ldflags(), " "),
This page took 0.026174 seconds and 5 git commands to generate.