Build a command line for running valgrind. testdir - test results directory name - name of daemon (for naming hte log file) preamble - stuff we should run before valgrind v - valgrind arguments
(testdir, name, preamble, v, exit_on_first_error=True, cd=True)
| 86 | run.wait(writes) |
| 87 | |
| 88 | def get_valgrind_args(testdir, name, preamble, v, exit_on_first_error=True, cd=True): |
| 89 | """ |
| 90 | Build a command line for running valgrind. |
| 91 | |
| 92 | testdir - test results directory |
| 93 | name - name of daemon (for naming hte log file) |
| 94 | preamble - stuff we should run before valgrind |
| 95 | v - valgrind arguments |
| 96 | """ |
| 97 | if v is None: |
| 98 | return preamble |
| 99 | if not isinstance(v, list): |
| 100 | v = [v] |
| 101 | |
| 102 | # https://tracker.ceph.com/issues/44362 |
| 103 | preamble.extend([ |
| 104 | 'env', 'OPENSSL_ia32cap=~0x1000000000000000', |
| 105 | ]) |
| 106 | |
| 107 | val_path = '/var/log/ceph/valgrind' |
| 108 | if '--tool=memcheck' in v or '--tool=helgrind' in v: |
| 109 | extra_args = [ |
| 110 | 'valgrind', |
| 111 | '--trace-children=no', |
| 112 | '--child-silent-after-fork=yes', |
| 113 | '--soname-synonyms=somalloc=*tcmalloc*', |
| 114 | '--num-callers=50', |
| 115 | '--suppressions={tdir}/valgrind.supp'.format(tdir=testdir), |
| 116 | '--gen-suppressions=all', |
| 117 | '--xml=yes', |
| 118 | '--xml-file={vdir}/{n}.log'.format(vdir=val_path, n=name), |
| 119 | '--time-stamp=yes', |
| 120 | '--vgdb=yes', |
| 121 | ] |
| 122 | else: |
| 123 | extra_args = [ |
| 124 | 'valgrind', |
| 125 | '--trace-children=no', |
| 126 | '--child-silent-after-fork=yes', |
| 127 | '--soname-synonyms=somalloc=*tcmalloc*', |
| 128 | '--suppressions={tdir}/valgrind.supp'.format(tdir=testdir), |
| 129 | '--gen-suppressions=all', |
| 130 | '--log-file={vdir}/{n}.log'.format(vdir=val_path, n=name), |
| 131 | '--time-stamp=yes', |
| 132 | '--vgdb=yes', |
| 133 | ] |
| 134 | if exit_on_first_error: |
| 135 | extra_args.extend([ |
| 136 | # at least Valgrind 3.14 is required |
| 137 | '--exit-on-first-error=yes', |
| 138 | '--error-exitcode=42', |
| 139 | ]) |
| 140 | args = [] |
| 141 | if cd: |
| 142 | args += ['cd', testdir, run.Raw('&&')] |
| 143 | args += preamble + extra_args + v |
| 144 | log.debug('running %s under valgrind with args %s', name, args) |
| 145 | return args |
no test coverage detected