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 EA89E4E2C34; Sat, 10 Jun 2023 11:07:29 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org EA89E4E2C34 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1686384450; bh=PzohxZDimbBMZ/MgBNPwkWjT06S8wC8gxMHwDwXPWwI=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=sz4dgR9rKYmZYF3RERbJS9irhwWeJCyyxiQOjqzB23nEXut43NQi8k+aR8UBUHprw ioP0mFB1OkMEQRCVNsbW982P4Ppj2A8Ri9GvoyQqUAivP3HRhnZZkXERxiaPQUXW7o ADsZSBDdRAqQxhNi6ulH8BW+VtKMuLdUbqy+GksY= Received: from smtpng3.i.mail.ru (smtpng3.i.mail.ru [94.100.177.149]) (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 07D8441E1C1 for ; Sat, 10 Jun 2023 11:07:28 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 07D8441E1C1 Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1q7td8-0002gO-SY; Sat, 10 Jun 2023 11:07:27 +0300 To: Igor Munkin , Maxim Kokryashkin , Sergey Bronnikov Date: Sat, 10 Jun 2023 11:03:08 +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: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD965EFE7F2AC62B27A60EBF51E0E9FC234AB0E8B90910B6CBE182A05F5380850405447CA10CCCFB8612EDA50F0BCD3ED41B70A04FCC12478A17034BA54C00F9774 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE73B44982FA5E78411EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006377A2EA98384B91C6C8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D80FC40B526CE449BC95E41E6FD61E2E33117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCB37B5D51F58B3735A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F4460429728776938767073520C65AC60A1F0286FEF6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA7E827F84554CEF5019E625A9149C048EE9ECD01F8117BC8BEE2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8B9F5955FECEF5819E75ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: 0D63561A33F958A5537C1500A5F1132D601F57A5D00D2A37A54DD8070DCACA07F87CCE6106E1FC07E67D4AC08A07B9B065B78C30F681404D9C5DF10A05D560A950611B66E3DA6D700B0A020F03D25A0997E3FB2386030E77 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF77DD89D51EBB7742D3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF8E560C895B1E4AC64FD9FEDC7F497384B696EFC6879DAC545E4EC7DDE191F4C1715D154A38A044DCB5655EA6190D4CDAF87EE161AD53C246557AEA3CDE8C8118461A413F07889F2102C26D483E81D6BE5EF9655DD6DEA7D65774BB76CC95456EEC5B5AD62611EEC62B5AFB4261A09AF0 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojRLo8CqjALXgVQGhKHMoOtg== X-DA7885C5: 745323C0BB4B8CF84AAD52CB2238199F2927B39F3C6B58BCDADF13920A0B3388262E2D401490A4A0DB037EFA58388B346E8BC1A9835FDE71 X-Mailru-Sender: 689FA8AB762F73930F533AC2B33E986BF9128901FAA56A8248EE546C0AF246860FBE9A32752B8C9C2AA642CC12EC09F1FB559BB5D741EB962F61BD320559CF1EFD657A8799238ED55FEEDEB644C299C0ED14614B50AE0675 X-Mras: Ok Subject: [Tarantool-patches] [PATCH v4 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. Changes in v4: 1) Describe why the 1st patch is neccessary for this patchset in the commit message. 2) Move adding of the README.md in the second commit with description of directives and assert macros. 3) More verbose comments. 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 | 72 ++++ .../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 | 79 ++++ 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, 1497 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