Skip to content

Commit e3ea6fc

Browse files
Oleg Chaplashkinylobankov
authored andcommitted
Add memory leak detection during server process execution
Memory leak detection may occur when working with the server: g.test_foo = function() ... g.server:exec(function() -- there is an error from LeakSanitizer in `stderr` here end) g.server:exec(function() -- server is alive end) t.assert(true) end) g.after_all(function() g.server:drop() -- `test_foo` has passed end) We have added a check for the `LeakSanitizer` substring in `stderr` of the server process. If it's found, an error will be thrown and test will fail. Closes #349
1 parent 9e0776e commit e3ea6fc

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Unreleased
44

55
- Add logging to unified file (gh-324).
6+
- Add memory leak detection during server process execution (gh-349).
67

78
## 1.0.1
89

luatest/server.lua

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,17 @@ function Server:stop()
459459
)
460460
)
461461
end
462+
if self.process.output_beautifier.stderr:find('LeakSanitizer') then
463+
error(
464+
('Memory leak during process execution (alias: %s, workdir: %s, pid: %s)\n%s')
465+
:format(
466+
self.alias,
467+
fio.basename(self.workdir),
468+
self.process.pid,
469+
self.process.output_beautifier.stderr
470+
)
471+
)
472+
end
462473
log.debug('Killed server process PID ' .. self.process.pid)
463474
self.process = nil
464475
end

0 commit comments

Comments
 (0)