[Tarantool-patches] [PATCH luajit][v2] Always close profiler output file.
Sergey Bronnikov
sergeyb at tarantool.org
Wed Mar 5 18:09:53 MSK 2025
On 05.03.2025 17:58, Sergey Kaplun wrote:
> Hi, Sergey!
> Thanks for adding the testcases!
> LGTM with a last comment below.
>
>> +
>> +local function close_profile_dump_with_0_samples_with_unload(subtest)
>> + local jit_p = require('jit.p')
>> +
>> +subtest:plan(1)
>> +
>> + collectgarbage('stop')
>> + jit_p.start(jit_p_options, filename)
>> + jit_p.stop()
>> +
>> + -- Unload the module and clean the local.
>> + package.loaded['jit.p'] = nil
>> + jit_p = nil -- luacheck: no unused
>> + collectgarbage('collect')
>> +
>> + local f = io.open(filename, 'r')
>> + local p_content =f:read('a*')
>> +subtest:is(p_content, '[No samples collected]\n',
>> + 'profile dump has no samples')
>> + f.close()
> Typo: s/f./f:/
Thanks!
---
a/test/tarantool-tests/lj-1304-close-profile-dump-with-0-samples.test.lua
+++
b/test/tarantool-tests/lj-1304-close-profile-dump-with-0-samples.test.lua
@@ -51,7 +51,7 @@ local function
close_profile_dump_with_0_samples_with_unload(subtest)
local p_content = f:read('a*')
subtest:is(p_content, '[No samples collected]\n',
'profile dump has no samples')
- f.close()
+ f:close()
-- Teardown.
collectgarbage('restart')
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20250305/23f0c877/attachment.htm>
More information about the Tarantool-patches
mailing list