[Tarantool-patches] [PATCH luajit v1] profilers: print user-friendly errors

Maxim Kokryashkin m.kokryashkin at tarantool.org
Mon Apr 8 12:33:26 MSK 2024


Hi, Sergey!
Thanks for the review!
Fixed your comments, branch is rebased and force-pushed.
Here is the diff with fixes:
===
diff --git a/test/tarantool-tests/gh-9217-profile-parsers-error-handling.test.lua b/test/tarantool-tests/gh-9217-profile-parsers-error-handling.test.lua
index c2e0f0a6..0b7ee2dd 100644
--- a/test/tarantool-tests/gh-9217-profile-parsers-error-handling.test.lua
+++ b/test/tarantool-tests/gh-9217-profile-parsers-error-handling.test.lua
@@ -16,7 +16,7 @@ local utils = require('utils')

 local BAD_PATH = utils.tools.profilename('bad-path-tmp.bin')
 local NON_PROFILE_DATA = utils.tools.profilename('not-profile-data.tmp.bin')
-local CORRUPT_PROFILE = utils.tools.profilename('profdata.tmp.bin')
+local CORRUPT_PROFILE_DATA = utils.tools.profilename('profdata.tmp.bin')

 local EXECUTABLE = utils.exec.luacmd(arg)
 local PARSERS = {
@@ -37,7 +37,7 @@ local TEST_CASES = {
     err_msg = 'Failed to parse symtab from'
   },
   {
-    path = CORRUPT_PROFILE,
+    path = CORRUPT_PROFILE_DATA,
     err_msg = 'Failed to parse profile data from'
   },
 }
@@ -50,7 +50,7 @@ local function generate_non_profile_data(path)
   file:close()
 end

-local function generate_corrupt_profile(path)
+local function generate_corrupt_profile_data(path)
   local res, err = misc.memprof.start(path)
   -- Should start successfully.
   assert(res, err)
@@ -74,7 +74,7 @@ local function generate_corrupt_profile(path)
 end

 generate_non_profile_data(NON_PROFILE_DATA)
-generate_corrupt_profile(CORRUPT_PROFILE)
+generate_corrupt_profile_data(CORRUPT_PROFILE_DATA)

 for _, case in ipairs(TEST_CASES) do
   for profiler, parser in pairs(PARSERS) do
@@ -86,5 +86,5 @@ for _, case in ipairs(TEST_CASES) do
 end

 os.remove(NON_PROFILE_DATA)
-os.remove(CORRUPT_PROFILE)
+os.remove(CORRUPT_PROFILE_DATA)
 test:done(true)
diff --git a/tools/utils/symtab.lua b/tools/utils/symtab.lua
index e80b9f33..f00d6bc0 100644
--- a/tools/utils/symtab.lua
+++ b/tools/utils/symtab.lua
@@ -100,8 +100,8 @@ function M.parse(reader)

   if string.byte(version) ~= LJS_CURRENT_VERSION then
     error(string_format(
-         "LuaJIT symbol table format version mismatch:"..
-         " the tool expects %d, but your data is %d",
+         "LuaJIT symbol table format version mismatch: "..
+         "the tool expects %d, but your data is %d",
          LJS_CURRENT_VERSION,
          string.byte(version)
     ))
===


More information about the Tarantool-patches mailing list