From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 067664A0A18; Mon, 5 Jun 2023 13:45:30 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 067664A0A18 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1685961930; bh=qV2A1B2evlegsuMyKLzOlN+Qr+APsaIQYW9x5yt7PXU=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=a5Yq1EULplKis4vNgI0Ub7BeIViquVnJOGb7ni2FVML2vsqMky550qO03TQKoS9r1 AIt+lIL8E+m4vrSmN6zLceXKtzmKihgH0Ud4Y5XW02ZZ9L5CaUN3p9tJzhg+r36gvE yMUCq5rxh7oGMzbiIZzuVANgIxzk4fN55YJQkN3E= Received: from smtp61.i.mail.ru (smtp61.i.mail.ru [95.163.41.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id BF4EB499517 for ; Mon, 5 Jun 2023 13:45:28 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org BF4EB499517 Received: by smtp61.i.mail.ru with esmtpa (envelope-from ) id 1q67iJ-00BFih-JI; Mon, 05 Jun 2023 13:45:28 +0300 To: Igor Munkin , Maxim Kokryashkin , Sergey Bronnikov Date: Mon, 5 Jun 2023 13:41:11 +0300 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailru-Src: smtp X-7564579A: 78E4E2B564C1792B X-77F55803: 4F1203BC0FB41BD988F25420CCA9469A00ED12DDEDD8E56A1B2FC461420D33EE182A05F538085040E7A8AA9C55EF2341155AABF72A44328B3B8769B0307784471C3FA36E388436EA X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE742D9BD90C58D50E0EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637531CC3E3F637A59A8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D886D664DC669C3850B9F2FBB372D5B7B7117882F4460429728776938767073520437C869540D2AB0F6FD1C55BDD38FC3FD2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EEC8105B04EFE076287C6FCE95544A9834D8FC6C240DEA7642DBF02ECDB25306B2B78CF848AE20165D0A6AB1C7CE11FEE30085B890FD2717DA040F9FF01DFDA4A8C4224003CC836476E2F48590F00D11D6E2021AF6380DFAD1A18204E546F3947C062BEEFFB5F8EA3E2E808ACE2090B5E1725E5C173C3A84C3C5EA940A35A165FF2DBA43225CD8A89F83C798A30B85E16B156CCFE7AF13BCA4B5C8C57E37DE458BEDA766A37F9254B7 X-C1DE0DAB: 0D63561A33F958A5E239F666F3C45C34290AA7B82D7AB259F637A17335C96D7AF87CCE6106E1FC07E67D4AC08A07B9B065B78C30F681404D9C5DF10A05D560A950611B66E3DA6D700B0A020F03D25A0997E3FB2386030E77 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF77DD89D51EBB7742D3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CFBAF1F82FCE2C73DFD1045AAF914B4A7B3D8A6FC2DDF328E567338EF0BB51394160849098BFF6585A588A46A5EBCE8E37E8F09C1B07B016483CCF297757C23519461A413F07889F2102C26D483E81D6BE5EF9655DD6DEA7D65774BB76CC95456EEC5B5AD62611EEC62B5AFB4261A09AF0 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojbL9S8ysBdXhLPelb+eUiUKUdcLkHr9vF X-Mailru-Sender: 11C2EC085EDE56FAC07928AF2646A769450F3FCB0028EA91155AABF72A44328BD776CA2DFBE07C79DEDBA653FF35249392D99EB8CC7091A70E183A470755BFD208F19895AA18418972D6B4FCE48DF648AE208404248635DF X-Mras: Ok Subject: [Tarantool-patches] [PATCH v3 luajit 0/6] Reworking C tests X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Sergey Kaplun via Tarantool-patches Reply-To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 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 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 lib. 4) Move test builds to the 2nd commit to launch unit test (), 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