From: Sergey Bronnikov via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Sergey Kaplun <skaplun@tarantool.org>
Cc: Sergey Bronnikov <estetus@gmail.com>,
tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH luajit 8/8][v3] memprof: set default path to profiling output file
Date: Wed, 5 Mar 2025 17:29:04 +0300 [thread overview]
Message-ID: <7c01b6c6-36f0-45d4-acb8-d26577254796@tarantool.org> (raw)
In-Reply-To: <Z8guGWHLs6jPHS3T@root>
[-- Attachment #1: Type: text/plain, Size: 3103 bytes --]
Hi, Sergey!
Updated and force-pushed.
Sergey
On 05.03.2025 13:57, Sergey Kaplun wrote:
> Hi, Sergey!
> See my answer below.
>
> On 24.02.25, Sergey Bronnikov wrote:
>> Hi, Sergey,
>>
>> thanks for review!
> <snipped>
>
>>>> ---
>>>> +
>>>> + local default_output_file = 'memprof.bin'
>>>> + os.remove(default_output_file)
>>>> +
>>>> + local _, _ = misc.memprof.start()
>>> Minor: Do we want to check that the profiler starts successfully?
>>> I suppose we should, since this is the expected behaviour for this
>>> feature. In case the profiler is not started (old behaviour) we would
>>> get an error from the branch below: profiler not running. This isn't a
>>> verbose definition of what goes wrong.
>> I don't get why we should check that profiler is started in a test for
>> default output file.
> If the `memprof.start()` call will fail in the test (for any reason),
> the next call of `memprof.stop()` will return `false, "profiler is not
> running"`. So, when debugging the test, we have no clue about the reason
> for the not-started profiler, which is not very convenient.
The patch below handles error from memprof start and stop:
diff --git
a/test/tarantool-tests/profilers/misclib-memprof-lapi-default-file.test.lua
b/test/tarantool-tests/profilers/misclib-memprof-lapi-default-file.test.lua
index ae8a73c9..55b5c60b 100644
---
a/test/tarantool-tests/profilers/misclib-memprof-lapi-default-file.test.lua
+++
b/test/tarantool-tests/profilers/misclib-memprof-lapi-default-file.test.lua
@@ -16,21 +16,26 @@ test:test('default-output-file', function(subtest)
local default_output_file = 'memprof.bin'
os.remove(default_output_file)
- local _, _ = misc.memprof.start()
-
- local res, err = misc.memprof.stop()
+ local res, err = misc.memprof.start()
+ -- Want to cleanup carefully if something went wrong.
+ if not res then
+ test:fail('sysprof was not started: ' .. err)
+ os.remove(default_output_file)
+ end
+ res, err = misc.memprof.stop()
-- Want to cleanup carefully if something went wrong.
if not res then
+ test:fail('sysprof was not started: ' .. err)
os.remove(default_output_file)
- error(err)
end
+
local profile_buf = tools.read_file(default_output_file)
subtest:ok(profile_buf ~= nil and #profile_buf ~= 0,
'default output file is not empty')
- -- We don't need it any more.
+ -- We don't need it anymore.
os.remove(default_output_file)
end)
>
>>> I suppose we may use `goto` here like the following:
>>>
>>> | local res, err = misc.memprof.start()
>>> | -- Should start successfully.
>>> | if not res then
>>> | goto err_handling
>>> | end
>>> |
>>> | res, err = misc.memprof.stop()
>>> |
>>> | ::err_handling::
>>> | -- Want to cleanup carefully if something went wrong.
>>> | if not res then
>>>
>>>> +
>>>> + local res, err = misc.memprof.stop()
>>>> +
>>>> + -- Want to cleanup carefully if something went wrong.
>>>> + if not res then
>>>> + os.remove(default_output_file)
>>>> + error(err)
>>>> + end
> <snipped>
>
[-- Attachment #2: Type: text/html, Size: 5030 bytes --]
next prev parent reply other threads:[~2025-03-05 14:29 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-20 11:21 [Tarantool-patches] [PATCH luajit 0/8][v3] Fix profilers issues Sergey Bronnikov via Tarantool-patches
2025-02-20 11:21 ` [Tarantool-patches] [PATCH luajit 1/8][v3] test: add descriptions to sysprof testcases Sergey Bronnikov via Tarantool-patches
2025-02-24 11:15 ` Sergey Kaplun via Tarantool-patches
2025-02-20 11:21 ` [Tarantool-patches] [PATCH luajit 2/8][v3] test: align test title with test filename Sergey Bronnikov via Tarantool-patches
2025-02-24 9:40 ` Sergey Kaplun via Tarantool-patches
2025-02-24 15:27 ` Sergey Bronnikov via Tarantool-patches
2025-02-20 11:21 ` [Tarantool-patches] [PATCH luajit 3/8][v3] sysprof: fix typo in the comment Sergey Bronnikov via Tarantool-patches
2025-02-24 11:15 ` Sergey Kaplun via Tarantool-patches
2025-02-20 11:21 ` [Tarantool-patches] [PATCH luajit 4/8][v3] sysprof: introduce specific errors and default mode Sergey Bronnikov via Tarantool-patches
2025-02-24 12:46 ` Sergey Kaplun via Tarantool-patches
2025-02-24 18:05 ` Sergey Bronnikov via Tarantool-patches
2025-03-05 7:55 ` Sergey Kaplun via Tarantool-patches
2025-03-05 10:48 ` Sergey Bronnikov via Tarantool-patches
2025-03-05 14:48 ` Sergey Bronnikov via Tarantool-patches
2025-03-05 15:17 ` Sergey Kaplun via Tarantool-patches
2025-02-20 11:21 ` [Tarantool-patches] [PATCH luajit 5/8][v3] test: introduce flag LUAJIT_DISABLE_MEMPROF Sergey Bronnikov via Tarantool-patches
2025-02-24 9:45 ` Sergey Kaplun via Tarantool-patches
2025-02-24 18:06 ` Sergey Bronnikov via Tarantool-patches
2025-02-20 11:21 ` [Tarantool-patches] [PATCH luajit 6/8][v3] ci: add workflow with disabled profilers Sergey Bronnikov via Tarantool-patches
2025-02-24 9:48 ` Sergey Kaplun via Tarantool-patches
2025-02-24 18:16 ` Sergey Bronnikov via Tarantool-patches
2025-02-20 11:21 ` [Tarantool-patches] [PATCH luajit 7/8][v3] misc: specific message for " Sergey Bronnikov via Tarantool-patches
2025-02-24 11:28 ` Sergey Kaplun via Tarantool-patches
2025-02-24 18:37 ` Sergey Bronnikov via Tarantool-patches
2025-03-05 8:24 ` Sergey Kaplun via Tarantool-patches
2025-02-20 11:21 ` [Tarantool-patches] [PATCH luajit 8/8][v3] memprof: set default path to profiling output file Sergey Bronnikov via Tarantool-patches
2025-02-24 11:14 ` Sergey Kaplun via Tarantool-patches
2025-02-24 18:40 ` Sergey Bronnikov via Tarantool-patches
2025-03-05 10:57 ` Sergey Kaplun via Tarantool-patches
2025-03-05 14:29 ` Sergey Bronnikov via Tarantool-patches [this message]
2025-03-05 15:12 ` Sergey Kaplun via Tarantool-patches
2025-03-06 6:01 ` Sergey Bronnikov via Tarantool-patches
2025-03-12 11:11 ` [Tarantool-patches] [PATCH luajit 0/8][v3] Fix profilers issues Sergey Kaplun via Tarantool-patches
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7c01b6c6-36f0-45d4-acb8-d26577254796@tarantool.org \
--to=tarantool-patches@dev.tarantool.org \
--cc=estetus@gmail.com \
--cc=sergeyb@tarantool.org \
--cc=skaplun@tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH luajit 8/8][v3] memprof: set default path to profiling output file' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox