(self, code, what, *, run_workers=False)
| 1280 | |
| 1281 | @support.requires_jit_disabled |
| 1282 | def check_leak(self, code, what, *, run_workers=False): |
| 1283 | test = self.create_test('huntrleaks', code=code) |
| 1284 | |
| 1285 | filename = 'reflog.txt' |
| 1286 | self.addCleanup(os_helper.unlink, filename) |
| 1287 | cmd = ['--huntrleaks', '3:3:'] |
| 1288 | if run_workers: |
| 1289 | cmd.append('-j1') |
| 1290 | cmd.append(test) |
| 1291 | output = self.run_tests(*cmd, |
| 1292 | exitcode=EXITCODE_BAD_TEST, |
| 1293 | stderr=subprocess.STDOUT) |
| 1294 | self.check_executed_tests(output, [test], failed=test, stats=1) |
| 1295 | |
| 1296 | line = r'beginning 6 repetitions. .*\n123:456\n[.0-9X]{3} 111\n' |
| 1297 | self.check_line(output, line) |
| 1298 | |
| 1299 | line2 = '%s leaked [1, 1, 1] %s, sum=3\n' % (test, what) |
| 1300 | self.assertIn(line2, output) |
| 1301 | |
| 1302 | with open(filename) as fp: |
| 1303 | reflog = fp.read() |
| 1304 | self.assertIn(line2, reflog) |
| 1305 | |
| 1306 | @unittest.skipUnless(support.Py_DEBUG, 'need a debug build') |
| 1307 | def check_huntrleaks(self, *, run_workers: bool): |
no test coverage detected