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')