Skip to content

Commit

Permalink
test: skip sysprof tests with LUAJIT_DISABLE_SYSPROF
Browse files Browse the repository at this point in the history
LuaJIT has a macro LUAJIT_DISABLE_SYSPROF that disables
sysprof support. Sysprof tests don't respect this macro,
and therefore some of them failed when the macro is enabled.

The proposed patch:

- Skips sysprof testcases in a suite tarantool-c-tests.
- Introduces an environment variable LUAJIT_DISABLE_SYSPROF in
  a suite tarantool-tests that is set to 1 when sysprof support is
  disabled.
- Propagates a status of sysprof support to Lua tests and skip
  testing when sysprof is disabled.

Reviewed-by: Maxim Kokryashkin <[email protected]>
Reviewed-by: Sergey Kaplun <[email protected]>
Signed-off-by: Sergey Kaplun <[email protected]>
  • Loading branch information
ligurio authored and Buristan committed Dec 12, 2024
1 parent a272ba9 commit 9a47149
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/tarantool-c-tests/gh-8594-sysprof-ffunc-crash.test.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,12 @@ static int test_tostring_call(void *ctx)

int main(void)
{
#if LUAJIT_DISABLE_SYSPROF
return skip_all("Sysprof is disabled");
#else /* LUAJIT_DISABLE_SYSPROF */
const struct test_unit tgroup[] = {
test_unit_def(test_tostring_call),
};
return test_run_group(tgroup, NULL);
#endif /* LUAJIT_DISABLE_SYSPROF */
}
4 changes: 4 additions & 0 deletions test/tarantool-c-tests/misclib-sysprof-capi.test.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,9 @@ static int profile_func_jiton(void *test_state)

int main(void)
{
#if LUAJIT_DISABLE_SYSPROF
return skip_all("Sysprof is disabled");
#else /* LUAJIT_DISABLE_SYSPROF */
if (LUAJIT_OS != LUAJIT_OS_LINUX)
return skip_all("Sysprof is implemented for Linux only");
if (LUAJIT_TARGET != LUAJIT_ARCH_X86
Expand All @@ -322,4 +325,5 @@ int main(void)
const int test_result = test_run_group(tgroup, L);
utils_lua_close(L);
return test_result;
#endif /* LUAJIT_DISABLE_SYSPROF */
}
4 changes: 4 additions & 0 deletions test/tarantool-tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ if(LUAJIT_ENABLE_TABLE_BUMP)
list(APPEND LUA_TEST_ENV_MORE LUAJIT_TABLE_BUMP=1)
endif()

if(LUAJIT_DISABLE_SYSPROF)
list(APPEND LUA_TEST_ENV_MORE LUAJIT_DISABLE_SYSPROF=1)
endif()

set(TEST_SUITE_NAME "tarantool-tests")

# XXX: The call produces both test and target
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ local test = tap.test('gh-5688-tool-cli-flag'):skipcond({
['No profile tools CLI option integration'] = _TARANTOOL,
-- See also https://github.com/LuaJIT/LuaJIT/issues/606.
['Disabled due to LuaJIT/LuaJIT#606'] = os.getenv('LUAJIT_TABLE_BUMP'),
['Sysprof is disabled'] = os.getenv('LUAJIT_DISABLE_SYSPROF'),
})

test:plan(3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ local test = tap.test("gh-5813-resolving-of-c-symbols"):skipcond({
["Memprof is implemented for Linux only"] = jit.os ~= "Linux",
-- See also https://github.com/LuaJIT/LuaJIT/issues/606.
["Disabled due to LuaJIT/LuaJIT#606"] = os.getenv("LUAJIT_TABLE_BUMP"),
["Sysprof is disabled"] = os.getenv("LUAJIT_DISABLE_SYSPROF")
})

test:plan(5)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ local test = tap.test('gh-7264-add-proto-trace-sysprof-default'):skipcond({
['Sysprof is implemented for Linux only'] = jit.os ~= 'Linux',
-- See also https://github.com/LuaJIT/LuaJIT/issues/606.
['Disabled due to LuaJIT/LuaJIT#606'] = os.getenv('LUAJIT_TABLE_BUMP'),
['Sysprof is disabled'] = os.getenv('LUAJIT_DISABLE_SYSPROF'),
})

test:plan(2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ local test = tap.test('gh-9217-profile-parsers-error-handling'):skipcond({
['No profile tools CLI option integration'] = _TARANTOOL,
-- See also https://github.com/LuaJIT/LuaJIT/issues/606.
['Disabled due to LuaJIT/LuaJIT#606'] = os.getenv('LUAJIT_TABLE_BUMP'),
['Sysprof is disabled'] = os.getenv('LUAJIT_DISABLE_SYSPROF'),
})

jit.off()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ local test = tap.test("misc-sysprof-lapi"):skipcond({
["Sysprof is implemented for Linux only"] = jit.os ~= "Linux",
-- See also https://github.com/LuaJIT/LuaJIT/issues/606.
["Disabled due to LuaJIT/LuaJIT#606"] = os.getenv("LUAJIT_TABLE_BUMP"),
["Sysprof is disabled"] = os.getenv('LUAJIT_DISABLE_SYSPROF'),
})

test:plan(19)
Expand Down

0 comments on commit 9a47149

Please sign in to comment.