From: Sergey Kaplun via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: Igor Munkin <imun@tarantool.org>, Maxim Kokryashkin <m.kokryashkin@tarantool.org>, Sergey Bronnikov <sergeyb@tarantool.org> Cc: tarantool-patches@dev.tarantool.org Subject: [Tarantool-patches] [PATCH v3 luajit 0/6] Reworking C tests Date: Mon, 5 Jun 2023 13:41:11 +0300 [thread overview] Message-ID: <cover.1685613304.git.skaplun@tarantool.org> (raw) The whole idea of the patch-set introduce module for LuaJIT C tests. It also, can be used for unit tests. * The first patch is the prerequisite for the patch-set. It fixes LD_LIBRARY_PATH definition. * The 2nd and 3d patches provides an API and helper for writing the tests. * The last 3 patches rewrite existing tests that should be written in C in the proper way. Branch: https://github.com/tarantool/luajit/tree/skaplun/gh-noticket-tarantool-c-tests PR: https://github.com/tarantool/tarantool/pull/8444 Related Issue: * https://github.com/tarantool/tarantool/issues/7900 * https://github.com/tarantool/tarantool/issues/781 Changes in v2: 1) use | int _test_run_group(const char *group_name, const struct test_unit tests[], | size_t n_tests, void *test_state); instead of | int _test_run_group(const char *group_name, const struct test_unit *tests, | size_t n_tests, void *test_state); 2) `skip()` `skip_all()` and `todo()` helpers now return values to be return to runner. i.e. change usage from | if (cond) | skip("NIY"); to | if (cond) | return skip("NIY"); `bail_out()` helper still just exits with error code, which corresponding its standard specification. But now some parts of the code start to look "alya cringe": | return todo("Need to replace backtrace with libunwind first"); | lua_State *L = test_state; | utils_get_aux_lfunc(L); | (void)luaJIT_setmode(L, 0, LUAJIT_MODE_ENGINE | LUAJIT_MODE_OFF); | (void)luaJIT_setmode(L, 0, LUAJIT_MODE_ENGINE | LUAJIT_MODE_FLUSH); | check_profile_func(L); | (void)luaJIT_setmode(L, 0, LUAJIT_MODE_ENGINE | LUAJIT_MODE_ON); | return TEST_EXIT_SUCCESS; (Yes, we want to use unconditional `todo()`). So I commented the similar code, helper `check_profile_func()`, etc. with `#if 0`. 3) In 4th patch use subtest group for snap-related tests to skip all at once with disabled JIT. 4) lj-49-bad-lightuserdata is moved in C tests, too. Changes in the v3: 1) Now helper `utils_load_aux_script()` from <utils.h> accepts the filename of the Lua script to load (so, now define for test contains the directory instead of the test filename). 2) Add README.md for the 3rd commit with an example of usage. 3) Add unit tests (ok, skip, todo) for <test.c> lib. 4) Move test builds to the 2nd commit to launch unit test (<unit-tap.test.c>), updating here <.gitignore> too. 5) Fix typos. Sergey Kaplun (6): test: fix setting of {DY}LD_LIBRARY_PATH variables test: introduce module for C tests test: introduce utils.h helper for C tests test: rewrite misclib-getmetrics-capi test in C test: rewrite misclib-sysprof-capi test in C test: rewrite lj-49-bad-lightuserdata test in C .gitignore | 1 + src/CMakeLists.txt | 2 + test/CMakeLists.txt | 2 + test/tarantool-c-tests/CMakeLists.txt | 69 ++++ test/tarantool-c-tests/README.md | 36 ++ .../lj-49-bad-lightuserdata.test.c} | 47 +-- .../misclib-getmetrics-capi-script.lua} | 83 ++--- .../misclib-getmetrics-capi.test.c | 343 ++++++++++++++++++ .../misclib-sysprof-capi-script.lua | 35 ++ .../misclib-sysprof-capi.test.c | 325 +++++++++++++++++ test/tarantool-c-tests/test.c | 251 +++++++++++++ test/tarantool-c-tests/test.h | 217 +++++++++++ test/tarantool-c-tests/unit-tap.test.c | 31 ++ test/tarantool-c-tests/utils.h | 75 ++++ test/tarantool-tests/CMakeLists.txt | 12 +- .../lj-49-bad-lightuserdata.test.lua | 11 - .../lj-49-bad-lightuserdata/CMakeLists.txt | 1 - .../misclib-getmetrics-capi/CMakeLists.txt | 1 - .../misclib-getmetrics-capi/testgetmetrics.c | 270 -------------- .../misclib-sysprof-capi.test.lua | 54 --- .../misclib-sysprof-capi/CMakeLists.txt | 1 - .../misclib-sysprof-capi/testsysprof.c | 260 ------------- 22 files changed, 1457 insertions(+), 670 deletions(-) create mode 100644 test/tarantool-c-tests/CMakeLists.txt create mode 100644 test/tarantool-c-tests/README.md rename test/{tarantool-tests/lj-49-bad-lightuserdata/testlightuserdata.c => tarantool-c-tests/lj-49-bad-lightuserdata.test.c} (55%) rename test/{tarantool-tests/misclib-getmetrics-capi.test.lua => tarantool-c-tests/misclib-getmetrics-capi-script.lua} (68%) create mode 100644 test/tarantool-c-tests/misclib-getmetrics-capi.test.c create mode 100644 test/tarantool-c-tests/misclib-sysprof-capi-script.lua create mode 100644 test/tarantool-c-tests/misclib-sysprof-capi.test.c create mode 100644 test/tarantool-c-tests/test.c create mode 100644 test/tarantool-c-tests/test.h create mode 100644 test/tarantool-c-tests/unit-tap.test.c create mode 100644 test/tarantool-c-tests/utils.h delete mode 100644 test/tarantool-tests/lj-49-bad-lightuserdata.test.lua delete mode 100644 test/tarantool-tests/lj-49-bad-lightuserdata/CMakeLists.txt delete mode 100644 test/tarantool-tests/misclib-getmetrics-capi/CMakeLists.txt delete mode 100644 test/tarantool-tests/misclib-getmetrics-capi/testgetmetrics.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 -- 2.34.1
next reply other threads:[~2023-06-05 10:45 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-06-05 10:41 Sergey Kaplun via Tarantool-patches [this message] 2023-06-05 10:41 ` [Tarantool-patches] [PATCH v3 luajit 1/6] test: fix setting of {DY}LD_LIBRARY_PATH variables Sergey Kaplun via Tarantool-patches 2023-06-05 14:21 ` Sergey Bronnikov via Tarantool-patches 2023-06-05 10:41 ` [Tarantool-patches] [PATCH v3 luajit 2/6] test: introduce module for C tests Sergey Kaplun via Tarantool-patches 2023-06-05 15:08 ` Sergey Bronnikov via Tarantool-patches 2023-06-07 15:51 ` Sergey Bronnikov via Tarantool-patches 2023-06-05 10:41 ` [Tarantool-patches] [PATCH v3 luajit 3/6] test: introduce utils.h helper " Sergey Kaplun via Tarantool-patches 2023-06-05 15:11 ` Sergey Bronnikov via Tarantool-patches 2023-06-05 10:41 ` [Tarantool-patches] [PATCH v3 luajit 4/6] test: rewrite misclib-getmetrics-capi test in C Sergey Kaplun via Tarantool-patches 2023-06-07 16:25 ` Sergey Bronnikov via Tarantool-patches 2023-06-05 10:41 ` [Tarantool-patches] [PATCH v3 luajit 5/6] test: rewrite misclib-sysprof-capi " Sergey Kaplun via Tarantool-patches 2023-06-07 16:18 ` Sergey Bronnikov via Tarantool-patches 2023-06-05 10:41 ` [Tarantool-patches] [PATCH v3 luajit 6/6] test: rewrite lj-49-bad-lightuserdata " Sergey Kaplun via Tarantool-patches 2023-06-07 16:14 ` 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=cover.1685613304.git.skaplun@tarantool.org \ --to=tarantool-patches@dev.tarantool.org \ --cc=imun@tarantool.org \ --cc=m.kokryashkin@tarantool.org \ --cc=sergeyb@tarantool.org \ --cc=skaplun@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH v3 luajit 0/6] Reworking C tests' \ /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