Skip to content

Commit b49c5fa

Browse files
committed
sysprof: fix a message with stop without run
The function `misc.sysprof.stop()` reports that profiler is already running: | $ ./build/src/luajit -e 'print(misc.sysprof.stop())' | nil profiler is running already 22 The patch fixes that.
1 parent 5dd3f91 commit b49c5fa

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/lj_sysprof.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ int lj_sysprof_stop(lua_State *L)
493493
global_State *g = sp->g;
494494
struct lj_wbuf *out = &sp->out;
495495

496-
if (SPS_IDLE == sp->state)
496+
if (SPS_PROFILE != sp->state)
497497
return PROFILE_ERRRUN;
498498
else if (G(L) != g)
499499
return PROFILE_ERRUSE;

test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ local test = tap.test("misc-sysprof-lapi"):skipcond({
1010
["Disabled due to #10803"] = os.getenv("LUAJIT_TEST_USE_VALGRIND"),
1111
})
1212

13-
test:plan(33)
13+
test:plan(34)
1414

1515
jit.off()
1616
-- XXX: Run JIT tuning functions in a safe frame to avoid errors
@@ -98,7 +98,8 @@ assert(res, err)
9898

9999
-- Not running.
100100
res, err, errno = misc.sysprof.stop()
101-
test:ok(res == nil and err, "res and error with not running")
101+
test:is(res, nil, "res with not running")
102+
test:ok(err:match("profiler is running already"), "error with not running")
102103
test:ok(type(errno) == "number", "errno with not running")
103104

104105
-- Bad path.

0 commit comments

Comments
 (0)