After the tests run, look through all the valgrind logs. Exceptions are raised if textual errors occurred in the logs, or if valgrind exceptions were detected in the logs. :param ctx: Context :param config: Configuration
(ctx, config)
| 317 | |
| 318 | @contextlib.contextmanager |
| 319 | def valgrind_post(ctx, config): |
| 320 | """ |
| 321 | After the tests run, look through all the valgrind logs. Exceptions are raised |
| 322 | if textual errors occurred in the logs, or if valgrind exceptions were detected in |
| 323 | the logs. |
| 324 | |
| 325 | :param ctx: Context |
| 326 | :param config: Configuration |
| 327 | """ |
| 328 | try: |
| 329 | yield |
| 330 | finally: |
| 331 | valgrind_exception = None |
| 332 | valgrind_yaml = os.path.join(ctx.archive, 'valgrind.yaml') |
| 333 | for remote in ctx.cluster.remotes.keys(): |
| 334 | scanner = ValgrindScanner(remote) |
| 335 | errors = scanner.scan_all_files('/var/log/ceph/valgrind/*') |
| 336 | scanner.write_summary(valgrind_yaml) |
| 337 | if errors and not valgrind_exception: |
| 338 | log.debug('valgrind exception message: %s', errors[0]) |
| 339 | valgrind_exception = Exception(errors[0]) |
| 340 | |
| 341 | if config.get('expect_valgrind_errors'): |
| 342 | if not valgrind_exception: |
| 343 | raise Exception('expected valgrind issues and found none') |
| 344 | else: |
| 345 | if valgrind_exception: |
| 346 | raise valgrind_exception |
| 347 | |
| 348 | |
| 349 | @contextlib.contextmanager |