Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Kaplun via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Maxim Kokryashkin <m.kokryashkin@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v2 luajit 0/6] Revorking C tests
Date: Sat, 20 May 2023 11:38:26 +0300	[thread overview]
Message-ID: <ZGiHAqbqA27gTqxS@root> (raw)
In-Reply-To: <1684506553.475278652@f161.i.mail.ru>

Hi, Maxim!
Thanks for the reply!

On 19.05.23, Maxim Kokryashkin wrote:
> 
> Hi!
> Thanks for the comments.
>  
> > 
> >>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
> >>
> >>Thanks Maxim, for the review!
> >>
> >>I've fixed some Maxim comments and suggestions for the previous series.
> >>Some ignorable comments about wording are ignored:).
> >>
> >>Also, see answers for your questions below:
> >>
> >>> >+if(NOT PROVE)
> >>> >+ message(WARNING "`prove' is not found, so tarantool-c-tests target is not generated")
> >>> >+ return()
> >>> >+endif()
> >>> There is the same check in the test/tarantool-tests/CMakeLists.txt. Maybe
> >>> we should move it to the higher-level CMake so the lower-level CMakeLists
> >>> inherit it.
> >>
> >>I agree it maybe done, but not within this particular patchsett, so
> >>ignoring for now.
> >Don’t see any reason to postpone it, tbh. New module requires the same
> >checks as the already present one. It seems logical to do necessary changes
> >in this patchset.

There are two testing suite (except the new one), that use this
approach:
* tarantool-tests
* lua-Harness-tests
So, for this patchset I just use the same beaten path.
Also, we may try to build tests-target (suite) independently, and in
this case the check should be in low-level CMake.

> >>

<snipped>

> >>
> >>> >+#include "lj_arch.h"
> >>> Side note: I don't like the approach with private headers, but
> >>> I couldn't find any better way to check that. Maybe it is a good
> >>> idea to implement a public C API function to get the information
> >>> about OS and ARCH, since it is a really common to check them?
> >>
> >>I think, that this is the best option, espessialy if we want to write
> >>some unit test for some specific module (I mean <src/lj_*>).
> >>
> >>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;
> >Well, what is cringe here? There are a few unreachable lines, but now it is
> >obvious that those are skipped.

Yes, unreachable lines looks very strange to me.

> >>
> >>(Yes, we want to use unconditional `todo()`).
> >>So I commented the similar code, helper `check_profile_func()`, etc.
> >>with `#if 0`.
> >Do we really need to that though? Again, it is clearly visible that those are
> >unreachable. Comment in `todo` is sufficient.

I'm not sure about that, so I'll wait for the 2nd reviewer opinion.

> >
> ><snipped>
> >--
> >Best regards,
> >Maxim Kokryashkin
> > 

-- 
Best regards,
Sergey Kaplun

      reply	other threads:[~2023-05-20  8:42 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-18 20:44 Sergey Kaplun via Tarantool-patches
2023-05-18 20:44 ` [Tarantool-patches] [PATCH v2 luajit 1/6] test: fix setting of {DY}LD_LIBRARY_PATH variables Sergey Kaplun via Tarantool-patches
2023-05-19 11:23   ` Maxim Kokryashkin via Tarantool-patches
2023-05-22 11:03   ` Sergey Bronnikov via Tarantool-patches
2023-05-23  6:47     ` Sergey Kaplun via Tarantool-patches
2023-05-29 14:37       ` Sergey Bronnikov via Tarantool-patches
2023-05-18 20:44 ` [Tarantool-patches] [PATCH v2 luajit 2/6] test: introduce module for C tests Sergey Kaplun via Tarantool-patches
2023-05-19 11:46   ` Maxim Kokryashkin via Tarantool-patches
2023-05-22 12:33   ` Sergey Bronnikov via Tarantool-patches
2023-05-24  6:41     ` Sergey Kaplun via Tarantool-patches
2023-05-25 17:33       ` Sergey Bronnikov via Tarantool-patches
2023-05-29 10:03         ` Sergey Kaplun via Tarantool-patches
2023-05-29 14:38           ` Sergey Bronnikov via Tarantool-patches
2023-05-31 13:32             ` Sergey Kaplun via Tarantool-patches
2023-05-18 20:44 ` [Tarantool-patches] [PATCH v2 luajit 3/6] test: introduce utils.h helper " Sergey Kaplun via Tarantool-patches
2023-05-19 11:58   ` Maxim Kokryashkin via Tarantool-patches
2023-05-20  7:52     ` Sergey Kaplun via Tarantool-patches
2023-05-29 15:26   ` Sergey Bronnikov via Tarantool-patches
2023-05-18 20:44 ` [Tarantool-patches] [PATCH v2 luajit 4/6] test: rewrite misclib-getmetrics-capi test in C Sergey Kaplun via Tarantool-patches
2023-05-19 12:17   ` Maxim Kokryashkin via Tarantool-patches
2023-05-20  8:08     ` Sergey Kaplun via Tarantool-patches
2023-05-29 16:15   ` Sergey Bronnikov via Tarantool-patches
2023-05-18 20:44 ` [Tarantool-patches] [PATCH v2 luajit 5/6] test: rewrite misclib-sysprof-capi " Sergey Kaplun via Tarantool-patches
2023-05-19 13:00   ` Maxim Kokryashkin via Tarantool-patches
2023-05-20  7:28     ` Sergey Kaplun via Tarantool-patches
2023-05-18 20:44 ` [Tarantool-patches] [PATCH v2 luajit 6/6] test: rewrite lj-49-bad-lightuserdata " Sergey Kaplun via Tarantool-patches
2023-05-19 12:40   ` Maxim Kokryashkin via Tarantool-patches
2023-05-19 14:29 ` [Tarantool-patches] [PATCH v2 luajit 0/6] Revorking C tests Maxim Kokryashkin via Tarantool-patches
2023-05-20  8:38   ` Sergey Kaplun via Tarantool-patches [this message]

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=ZGiHAqbqA27gTqxS@root \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=m.kokryashkin@tarantool.org \
    --cc=skaplun@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v2 luajit 0/6] Revorking 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