forked from LuaJIT/LuaJIT
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
profilers: specific message for disabled profilers
- Loading branch information
Showing
5 changed files
with
83 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
test/tarantool-tests/profilers/misclib-memprof-lapi-disabled.test.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
local tap = require("tap") | ||
local test = tap.test("misclib-memprof-lapi-disabled"):skipcond({ | ||
["Memprof is enabled"] = os.getenv('LUAJIT_DISABLE_MEMPROF'), | ||
}) | ||
|
||
test:plan(6) | ||
|
||
-- Attempt to start memprof when memprof is disabled. | ||
local res, err, errno = misc.memprof.start('') | ||
test:is(res, nil, "result status on start when memprof is disabled") | ||
test:ok(err:match("profiler is disabled"), | ||
"error on start when memprof is disabled") | ||
test:ok(type(errno) == "number", "errno on start when memprof is disabled") | ||
|
||
-- Attempt to stop memprof when memprof is disabled. | ||
res, err, errno = misc.memprof.stop() | ||
test:is(res, nil, "result status on stop when memprof is disabled") | ||
test:ok(err:match("profiler is disabled"), | ||
"error on stop when memprof is disabled") | ||
test:ok(type(errno) == "number", "errno on start when memprof is disabled") | ||
|
||
test:done(true) |
29 changes: 29 additions & 0 deletions
29
test/tarantool-tests/profilers/misclib-sysprof-lapi-disabled.test.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
local tap = require("tap") | ||
local test = tap.test("misclib-sysprof-lapi-disabled"):skipcond({ | ||
["Sysprof is enabled"] = os.getenv('LUAJIT_DISABLE_SYSPROF'), | ||
}) | ||
|
||
test:plan(9) | ||
|
||
-- Attempt to start sysprof when sysprof is disabled. | ||
local res, err, errno = misc.sysprof.start() | ||
test:is(res, nil, "result status on start when sysprof is disabled") | ||
test:ok(err:match("profiler is disabled"), | ||
"error on start when sysprof is disabled") | ||
test:ok(type(errno) == "number", "errno on start when sysprof is disabled") | ||
|
||
-- Attempt to stop sysprof when sysprof is disabled. | ||
res, err, errno = misc.sysprof.stop() | ||
test:is(res, nil, "result status on stop when sysprof is disabled") | ||
test:ok(err:match("profiler is disabled"), | ||
"error on stop when sysprof is disabled") | ||
test:ok(type(errno) == "number", "errno on start when sysprof is disabled") | ||
|
||
-- Attempt to report when sysprof is disabled. | ||
res, err, errno = misc.sysprof.report() | ||
test:is(res, nil, "result status on report when sysprof is disabled") | ||
test:ok(err:match("profiler is disabled"), | ||
"error on stop when sysprof is disabled") | ||
test:ok(type(errno) == "number", "errno on start when sysprof is disabled") | ||
|
||
test:done(true) |