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 0937859C9D2; Mon, 14 Aug 2023 11:14:48 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 0937859C9D2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1692000888; bh=pUjufHxyvv73Dlu5d+yVtJe64NK6ofJzMGXKEa2aCaM=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=i7+q620vFoAX17BASdgipsYUz3whRfL3PBJLiAmL+ModMoCvEPzDWN+qxtJ7xUfJ1 +pGC6v71rw5KqX6flIYxp/wMG5fKc2L059JbBFXVUC+Sa/EXfiZEOIkUzkBvhvWSyL aQsbgJU3V5Nq4n6gvopdfOpgeAGU75eEWJCW0jzE= Received: from smtp60.i.mail.ru (smtp60.i.mail.ru [95.163.41.98]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 82CB93AB05E for ; Mon, 14 Aug 2023 11:14:46 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 82CB93AB05E Received: by smtp60.i.mail.ru with esmtpa (envelope-from ) id 1qVSir-005i5E-1N for tarantool-patches@dev.tarantool.org; Mon, 14 Aug 2023 11:14:45 +0300 Message-ID: Date: Mon, 14 Aug 2023 11:14:44 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 To: tarantool-patches@dev.tarantool.org References: <738d30841b4fb39c094e3fe53317c8f7915e268a.1690300762.git.sergeyb@tarantool.org> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Mailru-Src: smtp X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD969E04B5EED670DC836E8CADCCFC7EB90264FE23C7F795239182A05F5380850407B6A602E60D376C442B7894CA7AF71C07F64A1DDB0938376583FE5FF2D9F9387 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE72F22E6DC541F75D9EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637E149C29A36E092738638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8B32C10951ADB7EC671C92EA1BD6FC170117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCF84B8A2F7AA0758EA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD1828451B159A507268D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE1E561CDFBCA1751F1B780A39BCC1DD35D8FC6C240DEA76429C9F4D5AE37F343AA9539A8B242431040A6AB1C7CE11FEE386A7C529F68B8E5C302FCEF25BFAB345C4224003CC836476E2F48590F00D11D6E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407978DA827A17800CE705056152E029236E2DBA43225CD8A89F0A35B161A8BF67C1A91E23F1B6B78B78B5C8C57E37DE458BEDA766A37F9254B7 X-C1DE0DAB: 0D63561A33F958A5F329DCF91C38FF2076FD70AC584CAA081FD73F860CF6432CF87CCE6106E1FC07E67D4AC08A07B9B0AD0E433DBF1FBFA3CB5012B2E24CD356 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF77DD89D51EBB7742D3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF30963B40E1F44DFEC7FBC8F810168E0FF045DBCA7745E7345CA564A66E53DF04FB9773CE30426B0E90ABE3E74E35EA6FEA58CF204F58B25F5637EA6B946E0357CAACD699CDC6F98202C26D483E81D6BE0DBAE6F56676BC7117BB6831D7356A2DEC5B5AD62611EEC62B5AFB4261A09AF0 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojJ1ceUZTkowlHrTalf+1QLw== X-Mailru-Sender: C4F68CFF4024C8867DFDF7C7F25884580640070D32693AE0E1902B18688D5B6B57BF939C6BBDF487282EC151BADDC1D3523A6D01B4765B2DFB59E2DDD9FE06B14FA522850F29BC30B0DAF586E7D11B3E67EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH 2/2] Followup fix for embedded bytecode loader. 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 Bronnikov via Tarantool-patches Reply-To: Sergey Bronnikov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi, Max On 8/1/23 12:53, Sergey Bronnikov via Tarantool-patches wrote: >>> +         * platforms. >>> +         */ >>> +        return skip_all("Enabled on Linux/x86_64 with disabled GC64"); >> We prefer to run tests like that on all paltforms, just to be sure. >> We usually >> exclude tests from platforms only if those are completely irrelevant >> to the test, >> or there is some kind of major issue. > > Yes, for this test the rule was ignored because bytecode is not portable > > and following the rule will make maintenance difficult. Therefore > supported platforms limited by x86_64 only. > Test has been updated: bytecode is not needed and now test runs on all platforms. See patch below: diff --git a/test/tarantool-c-tests/lj-549-lua_load.test.c b/test/tarantool-c-tests/lj-549-lua_load.test.c index fd1e20ed..669b6b27 100644 --- a/test/tarantool-c-tests/lj-549-lua_load.test.c +++ b/test/tarantool-c-tests/lj-549-lua_load.test.c @@ -19,20 +19,11 @@  #define LJ_MAX_MEM32    0x7fffff00      /* Max. 32 bit memory allocation. */  #define LJ_MAX_BUF      LJ_MAX_MEM32    /* Max. buffer length. */ -#define UNUSED(x) ((void)(x)) +/* Defined in lua.h. */ +/* mark for precompiled code (`Lua') */ +#define    LUA_SIGNATURE    "\033Lua" -/** - * Array with bytecode was generated using commands below: - * - * cat << EOF > a.lua - * local a = 1 - * EOF - * luajit -b a.lua a.h - */ -#define luaJIT_BC_x86_64_sample_SIZE 22 -static const unsigned char luaJIT_BC_x86_64_sample[] = { -    27, 76, 74, 2, 2, 15, 2, 0, 1, 0, 0, 0, 2, 41, 0, 1, 0, 75, 0, 1, 0, 0 -}; +#define UNUSED(x) ((void)(x))  /**   * Function generates a huge chunk of "bytecode" with a size bigger than @@ -50,15 +41,14 @@ bc_reader_with_endmark(lua_State *L, void *data, size_t *size)      assert(bc_chunk != NULL);      /** -     * Put a chunk a valid bytecode at the beginning of the allocated -     * region. `lua_load` automatically detects whether the chunk is text -     * or binary, and loads it accordingly. We need a trace for bytecode -     * input, so it is necessary to deceive a check in lj_lex_setup, that +     * `lua_load` automatically detects whether the chunk is text or binary, +     * and loads it accordingly. We need a trace for bytecode input, +     * so it is necessary to deceive a check in lj_lex_setup, that       * makes a sanity check and detects whether input is bytecode or text -     * by the first char. Strictly speaking, it is enough to put -     * LUA_SIGNATURE[0] as the first symbol in the produced chunk. +     * by the first char. Put LUA_SIGNATURE[0] at the beginning of the +     * allocated region.       */ -    memcpy(bc_chunk, luaJIT_BC_x86_64_sample, luaJIT_BC_x86_64_sample_SIZE); +    bc_chunk[0] = LUA_SIGNATURE[0];      *size = bc_chunk_size; @@ -105,9 +95,10 @@ bc_reader_with_eof(lua_State *L, void *data, size_t *size)          return NULL;      } -    char *bc_chunk = malloc(luaJIT_BC_x86_64_sample_SIZE); -    memcpy(bc_chunk, luaJIT_BC_x86_64_sample, luaJIT_BC_x86_64_sample_SIZE); -    *size = luaJIT_BC_x86_64_sample_SIZE; +    size_t sz = 10; +    char *bc_chunk = malloc(sz); +    bc_chunk[0] = LUA_SIGNATURE[0]; +    *size = sz;      return bc_chunk;  } @@ -128,15 +119,6 @@ static int bc_loader_with_eof(void *test_state)  int main(void)  { -    if (LJ_GC64 || !LUAJIT_ARCH_X64 || !LJ_TARGET_LINUX) -        /** -         * `lua_load` source code is common on all platforms, -         * when bytecode is not portable. -         * So the test runs on Linux/x86_64 only and is skipped on other -         * platforms. -         */ -        return skip_all("Enabled on Linux/x86_64 with disabled GC64"); -      lua_State *L = utils_lua_init();      const struct test_unit tgroup[] = {          test_unit_def(bc_loader_with_endmark), >>> + >>> +    lua_State *L = utils_lua_init(); >>> +    const struct test_unit tgroup[] = { >>> +        test_unit_def(bc_loader_with_endmark), >>> +        test_unit_def(bc_loader_with_eof) >>> +    }; >>> + >>> +    const int test_result = test_run_group(tgroup, L); >>> +    utils_lua_close(L); >>> +    return test_result; >>> +} >>> -- >>> 2.34.1 >>>