From: Sergey Bronnikov via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: tarantool-patches@dev.tarantool.org,
Sergey Kaplun <skaplun@tarantool.org>
Subject: [Tarantool-patches] [PATCH luajit 1/4] test: add descriptions to sysprof testcases
Date: Tue, 4 Feb 2025 13:03:32 +0300 [thread overview]
Message-ID: <6b70bd32f156ff24015bd48c45a404eafacd468a.1738663201.git.sergeyb@tarantool.org> (raw)
In-Reply-To: <cover.1738663201.git.sergeyb@tarantool.org>
The patch add descriptions to sysprof testcases to make TAP report
more usable.
---
.../profilers/misclib-sysprof-lapi.test.lua | 36 ++++++++++---------
1 file changed, 20 insertions(+), 16 deletions(-)
diff --git a/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua b/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua
index b2c38c49..581fb7fd 100644
--- a/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua
+++ b/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua
@@ -65,34 +65,35 @@ end
-- Wrong profiling mode.
local res, err, errno = misc.sysprof.start{ mode = "A" }
-test:ok(res == nil and err:match("profiler misuse"))
-test:ok(type(errno) == "number")
+test:ok(res == nil and err:match("profiler misuse"), "res with no parameters")
+test:ok(type(errno) == "number", "errno with no parameters")
-- Already running.
res, err = misc.sysprof.start{ mode = "D" }
assert(res, err)
res, err, errno = misc.sysprof.start{ mode = "D" }
-test:ok(res == nil and err:match("profiler is running already"))
-test:ok(type(errno) == "number")
+test:ok(res == nil and err:match("profiler is running already"),
+ "ok with already running")
+test:ok(type(errno) == "number", "errno with already running")
res, err = misc.sysprof.stop()
assert(res, err)
-- Not running.
res, err, errno = misc.sysprof.stop()
-test:ok(res == nil and err)
-test:ok(type(errno) == "number")
+test:ok(res == nil and err, "res and error with not running")
+test:ok(type(errno) == "number", "errno with not running")
-- Bad path.
res, err, errno = misc.sysprof.start({ mode = "C", path = BAD_PATH })
-test:ok(res == nil and err:match("No such file or directory"))
-test:ok(type(errno) == "number")
+test:ok(res == nil and err:match("No such file or directory"), "res and error with bad path")
+test:ok(type(errno) == "number", "errno with bad path")
-- Bad interval.
res, err, errno = misc.sysprof.start{ mode = "C", interval = -1 }
-test:ok(res == nil and err:match("profiler misuse"))
-test:ok(type(errno) == "number")
+test:ok(res == nil and err:match("profiler misuse"), "res and error with bad interval")
+test:ok(type(errno) == "number", "errno with bad interval")
-- DEFAULT MODE
@@ -102,20 +103,23 @@ end
local report = misc.sysprof.report()
--- Check the profile is not empty
-test:ok(report.samples > 0)
+-- Check the profile is not empty.
+test:ok(report.samples > 0, "number of samples is greater than 0")
-- There is a Lua function with FNEW bytecode in it. Hence there
-- are only three possible sample types:
-- * LFUNC -- Lua payload is sampled.
-- * GC -- Lua GC machinery triggered in scope of FNEW bytecode
-- is sampled.
-- * INTERP -- VM is in a specific state when the sample is taken.
-test:ok(report.vmstate.LFUNC + report.vmstate.GC + report.vmstate.INTERP > 0)
+test:ok(report.vmstate.LFUNC + report.vmstate.GC + report.vmstate.INTERP > 0,
+ "total number of LFUNC, GC and INTERP samples is greater than 0")
-- There is no fast functions and C function in default payload.
-test:ok(report.vmstate.FFUNC + report.vmstate.CFUNC == 0)
+test:ok(report.vmstate.FFUNC + report.vmstate.CFUNC == 0,
+ "total number of FFUNC and CFUNC samples is equal to 0")
-- Check all JIT-related VM states are not sampled.
for _, vmstate in pairs({ 'TRACE', 'RECORD', 'OPT', 'ASM', 'EXIT' }) do
- test:ok(report.vmstate[vmstate] == 0)
+ local msg = ("total number of VM state %s is equal to 0"):format(vmstate)
+ test:ok(report.vmstate[vmstate] == 0, msg)
end
-- With very big interval.
@@ -124,7 +128,7 @@ if not pcall(generate_output, { mode = "D", interval = 1000 }) then
end
report = misc.sysprof.report()
-test:ok(report.samples == 0)
+test:ok(report.samples == 0, "total number of samples is equal to 0")
-- LEAF MODE
check_mode("L", 100)
--
2.34.1
next prev parent reply other threads:[~2025-02-04 10:07 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-04 10:03 [Tarantool-patches] [PATCH luajit 0/4] Fix sysprof issues Sergey Bronnikov via Tarantool-patches
2025-02-04 10:03 ` Sergey Bronnikov via Tarantool-patches [this message]
2025-02-10 14:51 ` [Tarantool-patches] [PATCH luajit 1/4] test: add descriptions to sysprof testcases Sergey Kaplun via Tarantool-patches
2025-02-11 8:16 ` Sergey Bronnikov via Tarantool-patches
2025-02-04 10:03 ` [Tarantool-patches] [PATCH luajit 2/4] sysprof: fix typo in the comment Sergey Bronnikov via Tarantool-patches
2025-02-10 14:51 ` Sergey Kaplun via Tarantool-patches
2025-02-11 8:21 ` Sergey Bronnikov via Tarantool-patches
2025-02-04 10:03 ` [Tarantool-patches] [PATCH luajit 3/4] sysprof: introduce specific errors and default mode Sergey Bronnikov via Tarantool-patches
2025-02-10 14:51 ` Sergey Kaplun via Tarantool-patches
2025-02-13 11:14 ` Sergey Bronnikov via Tarantool-patches
2025-02-04 10:03 ` [Tarantool-patches] [PATCH luajit 4/4] sysprof: fix a message with stop without run Sergey Bronnikov via Tarantool-patches
2025-02-10 14:52 ` Sergey Kaplun via Tarantool-patches
2025-02-11 9:49 ` Sergey Bronnikov 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=6b70bd32f156ff24015bd48c45a404eafacd468a.1738663201.git.sergeyb@tarantool.org \
--to=tarantool-patches@dev.tarantool.org \
--cc=estetus@gmail.com \
--cc=skaplun@tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH luajit 1/4] test: add descriptions to sysprof testcases' \
/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