Relates to tarantool/tarantool#781
Part of tarantool/tarantool#7900
---
.../misclib-sysprof-capi-script.lua | 35 ++
.../misclib-sysprof-capi.test.c | 317 ++++++++++++++++++
test/tarantool-tests/CMakeLists.txt | 1 -
.../misclib-sysprof-capi.test.lua | 54 ---
.../misclib-sysprof-capi/CMakeLists.txt | 1 -
.../misclib-sysprof-capi/testsysprof.c | 260 --------------
6 files changed, 352 insertions(+), 316 deletions(-)
create mode 100644 test/tarantool-c-tests/misclib-sysprof-capi-script.lua
create mode 100644 test/tarantool-c-tests/misclib-sysprof-capi.test.c
delete mode 100644 test/tarantool-tests/misclib-sysprof-capi.test.lua
delete mode 100644 test/tarantool-tests/misclib-sysprof-capi/CMakeLists.txt
delete mode 100644 test/tarantool-tests/misclib-sysprof-capi/testsysprof.c
diff --git a/test/tarantool-c-tests/misclib-sysprof-capi-script.lua b/test/tarantool-c-tests/misclib-sysprof-capi-script.lua
new file mode 100644
index 00000000..dd8387db
--- /dev/null
+++ b/test/tarantool-c-tests/misclib-sysprof-capi-script.lua
@@ -0,0 +1,35 @@
+local M = {}
+
+-- luacheck: no global
+assert(c_payload, 'c_payload global function should be set via script loader')
+
+local function lua_payload(n)
+ if n <= 1 then
+ return n
+ end
+ return lua_payload(n - 1) + lua_payload(n - 2)
+end
+
+local function payload()
+ local n_iterations = 500000
+
+ local co = coroutine.create(function()
+ for i = 1, n_iterations do
+ if i % 2 == 0 then
+ c_payload(10)
+ else
+ lua_payload(10)
+ end
+ coroutine.yield()
+ end
+ end)
+
+ for _ = 1, n_iterations do
+ coroutine.resume(co)
+ end
+end
+
+M.profile_func_jiton = payload
+M.profile_func_jitoff = payload
+
+return M
diff --git a/test/tarantool-c-tests/misclib-sysprof-capi.test.c b/test/tarantool-c-tests/misclib-sysprof-capi.test.c
new file mode 100644
index 00000000..4c54877e
--- /dev/null
+++ b/test/tarantool-c-tests/misclib-sysprof-capi.test.c
@@ -0,0 +1,317 @@
+#include "lauxlib.h"
+#include "lmisclib.h"
+#include "lua.h"
+#include "luajit.h"
+
+#include "test.h"
+#include "utils.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+/* XXX: Still need normal assert inside writer functions. */
+#undef NDEBUG
+#include <assert.h>
+
+/* Need for skipcond for OS and ARCH. */
+#include "lj_arch.h"