From: sergeyb@tarantool.org To: tarantool-patches@dev.tarantool.org, v.shpilevoy@tarantool.org, imun@tarantool.org Cc: alexander.turenko@tarantool.org Subject: [Tarantool-patches] [PATCH 14/19] Fix luacheck warnings in test/vinyl Date: Thu, 16 Jul 2020 17:11:46 +0300 [thread overview] Message-ID: <42d90b9689116e1e94b6ed5a8230829f9f6b6b10.1594907318.git.sergeyb@tarantool.org> (raw) In-Reply-To: <cover.1594907318.git.sergeyb@tarantool.org> From: Sergey Bronnikov <sergeyb@tarantool.org> Part of #4681 Reviewed-by: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> Reviewed-by: Igor Munkin <imun@tarantool.org> Co-authored-by: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> Co-authored-by: Igor Munkin <imun@tarantool.org> --- .luacheckrc | 2 +- test/vinyl/large.lua | 3 +-- test/vinyl/stress.lua | 22 +++++++++++----------- test/vinyl/txn_proxy.lua | 6 +++--- test/vinyl/upgrade/fill.lua | 8 ++++---- test/vinyl/vinyl.lua | 17 ----------------- 6 files changed, 20 insertions(+), 38 deletions(-) diff --git a/.luacheckrc b/.luacheckrc index fd0c5c54a..aa79622d6 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -47,7 +47,7 @@ exclude_files = { "test/sql/*.test.lua", "test/swim/*.test.lua", "test/var/**/*.lua", - "test/vinyl/**/*.lua", + "test/vinyl/*.test.lua", "test/wal_off/*.lua", "test/xlog/**/*.lua", "test/xlog-py/**/*.lua", diff --git a/test/vinyl/large.lua b/test/vinyl/large.lua index e10e94c1a..a997aec7e 100644 --- a/test/vinyl/large.lua +++ b/test/vinyl/large.lua @@ -1,5 +1,4 @@ -fiber = require('fiber') -digest = require('digest') +local digest = require('digest') local PAGE_SIZE = 1024 local RANGE_SIZE = 64 * PAGE_SIZE diff --git a/test/vinyl/stress.lua b/test/vinyl/stress.lua index 5e8d89795..15a999393 100644 --- a/test/vinyl/stress.lua +++ b/test/vinyl/stress.lua @@ -33,8 +33,8 @@ local spaces = {box.space.s1, box.space.s2, box.space.s3, box.space.s4, local max_data_size = box.cfg.vinyl_page_size * 1.5 local function t1(ch, time_limit) - local t1 = fiber.time() - while fiber.time() - t1 < time_limit do + local time = fiber.time() + while fiber.time() - time < time_limit do local k = math.random(10000) local t = math.random(80) local data = string.char(math.random(string.byte('Z') - string.byte('A')) + string.byte('A') - 1) @@ -56,13 +56,13 @@ local function t1(ch, time_limit) end; local function t2(ch, time_limit) - local t1 = fiber.time() - while fiber.time() - t1 < time_limit do + local time = fiber.time() + while fiber.time() - time < time_limit do local k = math.random(10000) local t = math.random(16) local space = spaces[math.fmod(t, #spaces) + 1] if t < 12 then - local l = space:get({k}) + space:get({k}) else space:delete({k}) end @@ -71,9 +71,9 @@ local function t2(ch, time_limit) end; local function t3(ch, time_limit) - local t1 = fiber.time() + local time = fiber.time() local i = 0 - while fiber.time() - t1 < time_limit do + while fiber.time() - time < time_limit do i = i + 1 local k = math.random(10000) local t = math.random(20) @@ -99,19 +99,19 @@ local function stress(time_limit) math.randomseed(os.time()); - for i = 1, 6 do + for _ = 1, 6 do fiber.create(t1, ch, time_limit) end; - for i = 1, 6 do + for _ = 1, 6 do fiber.create(t2, ch, time_limit) end; - for i = 1, 4 do + for _ = 1, 4 do fiber.create(t3, ch, time_limit) end; - for i = 1, 16 do + for _ = 1, 16 do ch:get() end; end diff --git a/test/vinyl/txn_proxy.lua b/test/vinyl/txn_proxy.lua index 7a4d0b865..15b0e4add 100644 --- a/test/vinyl/txn_proxy.lua +++ b/test/vinyl/txn_proxy.lua @@ -1,11 +1,11 @@ --- A fiber can't use multiple transactions simultaneously; +-- A fiber can't use multiple transactions simultaneously; -- i.e. [fiber] --? [transaction] in UML parlor. -- -- This module provides a simple transaction proxy facility --- to control multiple transactions at once. A proxy executes +-- to control multiple transactions at once. A proxy executes -- statements in a worker fiber in order to overcome -- "one transaction per fiber" limitation. --- +-- -- Ex: -- proxy = require('txn_proxy').new() -- proxy:begin() diff --git a/test/vinyl/upgrade/fill.lua b/test/vinyl/upgrade/fill.lua index 547777330..0164b9316 100644 --- a/test/vinyl/upgrade/fill.lua +++ b/test/vinyl/upgrade/fill.lua @@ -2,11 +2,11 @@ -- This script generates a vinyl metadata log -- containing all possible record types. -- -fiber = require 'fiber' +local fiber = require 'fiber' box.cfg{vinyl_memory = 1024 * 1024, vinyl_timeout = 1e-9, checkpoint_count = 1} -dump_trigger = box.schema.space.create('dump_trigger', {engine = 'vinyl'}) +local dump_trigger = box.schema.space.create('dump_trigger', {engine = 'vinyl'}) dump_trigger:create_index('pk', {run_count_per_level = 1}) -- Trigger dump of all indexes and wait for it to finish. @@ -15,7 +15,7 @@ dump_trigger:create_index('pk', {run_count_per_level = 1}) -- to trigger system-wide memory dump, it is enough to insert a -- huge tuple into one space. -- -function dump() +local function dump() local pad = string.rep('x', box.cfg.vinyl_memory / 2) dump_trigger:replace{1, pad} -- Must fail due to quota timeout, but still trigger dump. @@ -38,7 +38,7 @@ end -- VY_LOG_CREATE_INDEX -- VY_LOG_INSERT_RANGE -- -s = box.schema.space.create('test', {engine = 'vinyl'}) +local s = box.schema.space.create('test', {engine = 'vinyl'}) s:create_index('i1', {parts = {1, 'unsigned'}, run_count_per_level = 1}) s:create_index('i2', {parts = {2, 'string'}, run_count_per_level = 2}) diff --git a/test/vinyl/vinyl.lua b/test/vinyl/vinyl.lua index 31307f4bc..1d313b4e4 100644 --- a/test/vinyl/vinyl.lua +++ b/test/vinyl/vinyl.lua @@ -15,21 +15,4 @@ box.cfg { vinyl_max_tuple_size = 1024 * 1024 * 6, } -function box_info_sort(data) - if type(data)~='table' then - return data - end - local keys = {} - for k in pairs(data) do - table.insert(keys, k) - end - table.sort(keys) - local result = {} - for _,k in pairs(keys) do - local v = data[k] - table.insert(result, {[k] = box_info_sort(v) }) - end - return result -end - require('console').listen(os.getenv('ADMIN')) -- 2.26.2
next prev parent reply other threads:[~2020-07-16 14:13 UTC|newest] Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-07-16 14:11 [Tarantool-patches] [PATCH 00/19] Add static analysis of Lua code in test/ with luacheck sergeyb 2020-07-16 14:11 ` [Tarantool-patches] [PATCH 01/19] Fix luacheck warnings in test/app-tap sergeyb 2020-07-16 14:11 ` [Tarantool-patches] [PATCH 02/19] Fix luacheck warnings in test/app sergeyb 2020-07-16 14:11 ` [Tarantool-patches] [PATCH 03/19] Fix luacheck warnings in test/box sergeyb 2020-07-16 14:11 ` [Tarantool-patches] [PATCH 04/19] Fix luacheck warnings in test/box-py sergeyb 2020-07-16 14:11 ` [Tarantool-patches] [PATCH 05/19] Fix luacheck warnings in test/box-tap sergeyb 2020-07-16 14:11 ` [Tarantool-patches] [PATCH 06/19] Fix luacheck warnings in test/engine sergeyb 2020-07-16 14:11 ` [Tarantool-patches] [PATCH 07/19] Fix luacheck warnings in test/engine_long sergeyb 2020-07-16 14:11 ` [Tarantool-patches] [PATCH 08/19] Fix luacheck warnings in test/long_run-py sergeyb 2020-07-16 14:11 ` [Tarantool-patches] [PATCH 09/19] Fix luacheck warnings in test/replication sergeyb 2020-07-16 14:11 ` [Tarantool-patches] [PATCH 10/19] Fix luacheck warnings in test/replication-py sergeyb 2020-07-16 14:11 ` [Tarantool-patches] [PATCH 11/19] Fix luacheck warnings in test/sql sergeyb 2020-07-16 14:11 ` [Tarantool-patches] [PATCH 12/19] Fix luacheck warnings in test/sql-tap sergeyb 2020-07-16 14:11 ` [Tarantool-patches] [PATCH 13/19] Fix luacheck warnings in test/swim sergeyb 2020-07-16 14:11 ` sergeyb [this message] 2020-07-16 14:11 ` [Tarantool-patches] [PATCH 15/19] Fix luacheck warnings in test/wal_off sergeyb 2020-07-16 14:11 ` [Tarantool-patches] [PATCH 16/19] Fix luacheck warnings in test/xlog sergeyb 2020-07-16 14:11 ` [Tarantool-patches] [PATCH 17/19] Fix luacheck warnings in test/xlog-py sergeyb 2020-07-16 14:11 ` [Tarantool-patches] [PATCH 18/19] Add luacheck supression for luajit test sergeyb 2020-07-20 19:46 ` Igor Munkin 2020-07-21 11:52 ` Sergey Bronnikov 2020-07-21 12:38 ` Igor Munkin 2020-07-16 14:11 ` [Tarantool-patches] [PATCH 19/19] luajit: bump new version sergeyb 2020-07-16 14:18 ` [Tarantool-patches] [PATCH] test: fix warnings spotted by luacheck sergeyb 2020-07-20 18:26 ` Igor Munkin 2020-10-30 13:59 ` Kirill Yukhin 2020-07-17 8:09 ` [Tarantool-patches] [PATCH 00/19] Add static analysis of Lua code in test/ with luacheck Sergey Bronnikov 2020-08-07 9:19 ` Igor Munkin
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=42d90b9689116e1e94b6ed5a8230829f9f6b6b10.1594907318.git.sergeyb@tarantool.org \ --to=sergeyb@tarantool.org \ --cc=alexander.turenko@tarantool.org \ --cc=imun@tarantool.org \ --cc=tarantool-patches@dev.tarantool.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH 14/19] Fix luacheck warnings in test/vinyl' \ /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