Browse Source

Added support for running tor within Valgrind

You can now set the 'valgrind_settings' argument for each node to
enable valgrind and provide options to valgrind. The '--log-file'
option is automatically generated by Chutney.
Steven Engler 2 years ago
parent
commit
c14dbab400
1 changed files with 9 additions and 0 deletions
  1. 9 0
      lib/chutney/TorNet.py

+ 9 - 0
lib/chutney/TorNet.py

@@ -889,6 +889,11 @@ class LocalNodeController(NodeController):
                 '--physcpubind={}'.format(','.join(map(str, processors))),
                 ])
         #
+        if self._env['valgrind_settings'] is not None:
+            cmdline.append('valgrind')
+            cmdline.extend(self._env['valgrind_settings'])
+            cmdline.append('--log-file={}'.format(self._env['valgrind_log']))
+        #
         cmdline.extend([
             tor_path,
             "-f", torrc,
@@ -1085,6 +1090,7 @@ DEFAULTS = {
     'num_cpus': None,
     'numa_settings': None,
     'measureme_log_dir': '${dir}',
+    'valgrind_settings': None,
 }
 
 
@@ -1176,6 +1182,9 @@ class TorEnviron(chutney.Templating.Environ):
     def _get_lockfile(self, my):
         return os.path.join(self['dir'], 'lock')
 
+    def _get_valgrind_log(self, my):
+        return os.path.join(self['dir'], 'valgrind.log')
+
     # A hs generates its key on first run,
     # so check for it at the last possible moment,
     # but cache it in memory to avoid repeatedly reading the file