commit b7c57e74dd146c44003d9c5a6b1fe5a648e25c3a from: Sergey Bronnikov date: Fri Aug 02 18:52:10 2024 UTC tests: updates commit - 9b5f9d983e517c43158c645b68535269249f8551 commit + b7c57e74dd146c44003d9c5a6b1fe5a648e25c3a blob - 979e51f1e54d908eadbee45238dce48c9da77a8f blob + 69b802d498d2d2916a0c839ae444e017c5b0483f --- tests/tarantool_box_GHSA-74jr-2fq7-vp42.lua +++ tests/tarantool_box_GHSA-74jr-2fq7-vp42.lua @@ -12,10 +12,7 @@ local function TestOneInput(buf) assert(rawget(_G, 'res') == false) end -local script_path = debug.getinfo(1).source:match("@?(.*/)") - local args = { - max_total_time = 100 * 60, - corpus = script_path .. "/tarantool-corpus/box_GHSA-74jr-2fq7-vp42", + max_total_time = 60, } luzer.Fuzz(TestOneInput, nil, args) blob - cc92932dc7dfda8779ef4019f49a44ec5ff11180 blob + 4c02db65b1c733076c9cbcc42113ef5d8af8537e --- tests/tarantool_box_execute-mutator.lua +++ tests/tarantool_box_execute-mutator.lua @@ -84,14 +84,17 @@ end local function debug(grammar, printer) printer = printer or printf for k, p in pairs(grammar) do + -- luacheck: no unused local enter = lpeg.Cmt(lpeg.P(true), function(s, p, ...) printer("ENTER %s", k) return p end) + -- luacheck: no unused local leave = lpeg.Cmt(lpeg.P(true), function(s, p, ...) printer("LEAVE %s", k) return p end) * (lpeg.P("k") - lpeg.P "k") + -- luacheck: no unused grammar[k] = lpeg.Cmt(enter * p + leave, function(s, p, ...) printer("---%s---", k) printer("pos: %d, [%s]", p, s:sub(1, p-1)) blob - 9c54f2f9616afd08ee056e7197ddaf3ff0a807b7 blob + 10dc320fd7597db8ee235e8e379063398ff59a2b --- tests/tarantool_box_execute.lua +++ tests/tarantool_box_execute.lua @@ -6,24 +6,13 @@ local luzer = require("luzer") local function TestOneInput(buf) os.execute("rm -f *.snap") require("fiber").sleep(0.1) - box.cfg{} + box.cfg({}) box.execute(buf) end -if arg[1] then - local fh = io.open(arg[1]) - local testcase = fh:read("*all") - TestOneInput(testcase) - os.exit() -end - -local script_path = debug.getinfo(1).source:match("@?(.*/)") - local args = { max_len = 4096, - corpus = script_path .. "tarantool-corpus/box_execute", print_pcs = 1, - print_final_stats = 1, artifact_prefix = "box_execute_", max_total_time = 60, } blob - 888c8428dba04a484e40e95d0f10999e440f32e2 blob + c13bde5014caf5f383f16f1eb0464e26316ac9d1 --- tests/tarantool_csv_load.lua +++ tests/tarantool_csv_load.lua @@ -8,24 +8,13 @@ local function TestOneInput(buf) if ok == true then assert(res ~= nil) end - ok, res = pcall(csv.dump, res) - assert(ok == true) - assert(res) + ok, res = pcall(csv.dump, res) + assert(ok == true) + assert(res) end -if arg[1] then - local testcase = io.open(arg[1]):read("*all") - TestOneInput(testcase) - os.exit() -end - -local script_path = debug.getinfo(1).source:match("@?(.*/)") - local args = { - dict = script_path .. "tarantool-corpus/csv.dict", - corpus = script_path .. "tarantool-corpus/csv_load", artifact_prefix = "csv_load_", max_total_time = 60, - print_final_stats = 1, } luzer.Fuzz(TestOneInput, nil, args) blob - b0f71bb1962c66a04af096b7dccd8ddd0920b2fe blob + 7f3e1c7aeba4e698b228eabbed6b21e6560cd5c3 --- tests/tarantool_datetime_new.lua +++ tests/tarantool_datetime_new.lua @@ -78,8 +78,8 @@ local MIN_DATE_YEAR = -5879610 local MAX_DATE_YEAR = 5879611 local function new_dt_fmt(fdp) - -- Field descriptors. - local desc = { + -- Field descriptors. + local desc = { '%a', '%A', '%b', @@ -109,24 +109,24 @@ local function new_dt_fmt(fdp) '%X', '%y', '%Y', - } - local n = fdp:consume_integer(1, 5) - local fmt = '' - for i = 1, n do + } + local n = fdp:consume_integer(1, 5) + local fmt = '' + for _ = 1, n do local field_idx = fdp:consume_integer(1, #desc) fmt = ("%s%s"):format(fmt, desc[field_idx]) - end + end - return fmt + return fmt end local function new_dt(fdp) local tz_idx = fdp:consume_integer(1, #datetime.TZ) local d = 0 - --[[ - Day number. Value range: 1 - 31. The special value -1 generates the last - day of a particular month. - ]] + --[[ + Day number. Value range: 1 - 31. The special value -1 generates the last + day of a particular month. + ]] while d == 0 do d = fdp:consume_integer(-1, 31) end @@ -148,6 +148,7 @@ local function new_dt(fdp) end -- Minimum supported date - -5879610-06-22. +-- luacheck: no unused local min_dt = { nsec = 0, sec = 0, @@ -160,6 +161,7 @@ local min_dt = { } -- Maximum supported date - 5879611-07-11. +-- luacheck: no unused local max_dt = { nsec = 1000000000, sec = 60, @@ -209,12 +211,12 @@ local function TestOneInput(buf) local datetime_fmt = new_dt_fmt(fdp) -- Property: datetime.parse(dt:format(random_format)) == dt - --[[ + --[[ dt1 = datetime.new(time_units1) local dt1_str = dt1:format(datetime_fmt) local dt_parsed = datetime.parse(dt1_str, { format = datetime_fmt }) assert(dt_parsed == dt1) - ]] + ]] -- Property: B - (B - A) == A -- Blocked by: https://github.com/tarantool/tarantool/issues/7145 @@ -337,22 +339,11 @@ local function TestOneInput(buf) -- TODO: assert(dt1 - dt2 == single_sec, ('%s - %s != 1 sec (%s)'):format(dt1, dt2, dt1 - dt2)) end -if arg[1] then - local fh = io.open(arg[1]) - local testcase = fh:read("*all") - TestOneInput(testcase) - os.exit() -end - -local script_path = debug.getinfo(1).source:match("@?(.*/)") - local args = { max_len = 2048, print_pcs = 1, detect_leaks = 1, - corpus = script_path .. "tarantool-corpus/datetime_new", artifact_prefix = "datetime_new_", max_total_time = 60, - print_final_stats = 1, } luzer.Fuzz(TestOneInput, nil, args) blob - a4135b067b0fed8f3c37b75481c1ad283aa7776e blob + abadb02226f61ebc601fb2d883f3e5c68e686b4e --- tests/tarantool_datetime_parse.lua +++ tests/tarantool_datetime_parse.lua @@ -5,22 +5,10 @@ local function TestOneInput(buf) pcall(datetime.parse, buf) end -if arg[1] then - local fh = io.open(arg[1]) - local testcase = fh:read("*all") - TestOneInput(testcase) - os.exit() -end - -local script_path = debug.getinfo(1).source:match("@?(.*/)") - local args = { - detect_leaks = 1, print_pcs = 1, - corpus = script_path .. "tarantool-corpus/datetime_parse", artifact_prefix = "datetime_parse_", max_len = 2048, max_total_time = 60, - print_final_stats = 1, } luzer.Fuzz(TestOneInput, nil, args) blob - 721c9bca137ff1f8dc728e5f2f352a39237939e7 blob + 4ab8d9b49d037b9f141b14257a77143900c117e1 --- tests/tarantool_decimal_new.lua +++ tests/tarantool_decimal_new.lua @@ -6,28 +6,17 @@ local decimal = require("decimal") local function TestOneInput(buf) local ok, res = pcall(decimal.new, buf) if ok == false then - return + return end assert(res ~= nil) assert(decimal.is_decimal(res) == true) assert(res - res == 0) end -if arg[1] then - local testcase = io.open(arg[1]):read("*all") - TestOneInput(testcase) - os.exit() -end - -local script_path = debug.getinfo(1).source:match("@?(.*/)") - local args = { max_len = 4096, - corpus = script_path .. "tarantool-corpus/decimal_new", print_pcs = 1, - detect_leaks = 1, artifact_prefix = "decimal_new_", max_total_time = 60, - print_final_stats = 1, } luzer.Fuzz(TestOneInput, nil, args) blob - f100719f4f1c8061b588944b4f9204e6308a71a9 blob + abfbc3b289a22f5df8d20fbf790f39043a8d08c5 --- tests/tarantool_json_decode.lua +++ tests/tarantool_json_decode.lua @@ -16,21 +16,9 @@ local function TestOneInput(buf) end end -if arg[1] then - local fh = io.open(arg[1]) - local testcase = fh:read("*all") - TestOneInput(testcase) - os.exit() -end - -local script_path = debug.getinfo(1).source:match("@?(.*/)") - local args = { max_len = 4096, - dict = script_path .. "/tarantool-corpus/json_decode.dict", - corpus = script_path .. "/tarantool-corpus/json_decode", artifact_prefix = "json_decode_", max_total_time = 60, - print_final_stats = 1, } luzer.Fuzz(TestOneInput, nil, args) blob - 30e6d1e1e38f59482865b7ea1467e6bdd435dea5 blob + f9f3fe63f143cfbe7fbed12e817f19ab65672e47 --- tests/tarantool_msgpack_decode.lua +++ tests/tarantool_msgpack_decode.lua @@ -26,21 +26,10 @@ local function TestOneInput(buf) end end -if arg[1] then - local testcase = io.open(arg[1]):read("*all") - TestOneInput(testcase) - os.exit() -end - -local script_path = debug.getinfo(1).source:match("@?(.*/)") - local args = { print_pcs = 1, - corpus = script_path .. "tarantool-corpus/msgpack_decode", - dict = script_path .. "tarantool-corpus/msgpack_decode.dict", max_len = 4096, artifact_prefix = "msgpack_decode_", max_total_time = 60, - print_final_stats = 1, } luzer.Fuzz(TestOneInput, nil, args) blob - 303e9867472042ffeb5d6f1cc8de5503a59841f3 blob + 962b54dcf5ddea50fedeaabc3346dd3a0b075bcb --- tests/tarantool_net_box_call.lua +++ tests/tarantool_net_box_call.lua @@ -15,21 +15,10 @@ local function TestOneInput(buf) pcall(conn.call, conn, buf) end -if arg[1] then - local fh = io.open(arg[1]) - local testcase = fh:read("*all") - TestOneInput(testcase) - os.exit(0) -end - -local script_path = debug.getinfo(1).source:match("@?(.*/)") - local args = { max_len = 4096, - corpus = script_path .. "tarantool-corpus/net_box_call", print_pcs = 1, artifact_prefix = "net_box_call_", max_total_time = 60, - print_final_stats = 1, } luzer.Fuzz(TestOneInput, nil, args) blob - ec43c7b32131199a5d2e8c2d51d00ede97fcf9f0 blob + 2aee98d582ffd4691d8117098fda0987cf761798 --- tests/tarantool_pickle_unpack.lua +++ tests/tarantool_pickle_unpack.lua @@ -11,19 +11,9 @@ local function TestOneInput(buf) end end -if arg[1] then - local testcase = io.open(arg[1]):read("*all") - TestOneInput(testcase) - os.exit() -end - -local script_path = debug.getinfo(1).source:match("@?(.*/)") - local args = { max_len = 4096, - corpus = script_path .. "tarantool-corpus/pickle_unpack", artifact_prefix = "pickle_unpack_", max_total_time = 60, - print_final_stats = 1, } luzer.Fuzz(TestOneInput, nil, args) blob - f6e55cf26c42f99497b49487e91ae02e575e60b6 blob + b8b622936e61b08f392d2803f9e04c3991133849 --- tests/tarantool_stdio.lua +++ tests/tarantool_stdio.lua @@ -14,9 +14,9 @@ local function TestOneInput(buf) stderr = popen.opts.INHERIT, stdin = popen.opts.PIPE, }) - if not ph then - return - end + if not ph then + return + end assert(ph) ph:write(buf .. "\n") ph:shutdown({ stdin = true }) blob - b252d628481757d5a69c27047c91663a211d3559 blob + 68121c190a8312f2b4f7ca01e2dbf0c0a289d67f --- tests/tarantool_string_byte.lua +++ tests/tarantool_string_byte.lua @@ -11,16 +11,9 @@ local function TestOneInput(buf) end end -if arg[1] then - local testcase = io.open(arg[1]):read("*all") - TestOneInput(testcase) - os.exit() -end - local args = { max_len = 4096, artifact_prefix = "string_byte", max_total_time = 60, - print_final_stats = 1, } luzer.Fuzz(TestOneInput, nil, args) blob - 73291ea81f39fe53f2a129a6581110a0d1e13ab0 blob + d63a419cffda6a79e6c3c60bda51eab368305d10 --- tests/tarantool_uri_escape.lua +++ tests/tarantool_uri_escape.lua @@ -10,12 +10,6 @@ local function TestOneInput(buf) end end -if arg[1] then - local testcase = io.open(arg[1]):read("*all") - TestOneInput(testcase) - os.exit() -end - local args = { max_len = 1024, artifact_prefix = "uri_escape_", blob - b689b156fe8999b757baf29a3731d942a8f63832 blob + 8da58343f0de1b364af1b0d835f185e4bf216065 --- tests/tarantool_uri_parse.lua +++ tests/tarantool_uri_parse.lua @@ -12,20 +12,9 @@ local function TestOneInput(buf) end end -if arg[1] then - local testcase = io.open(arg[1]):read("*all") - TestOneInput(testcase) - print(arg[1]) - os.exit() -end - -local script_path = debug.getinfo(1).source:match("@?(.*/)") - local args = { max_len = 1024, - corpus = script_path .. "tarantool-corpus/uri_parse", artifact_prefix = "uri_parse_", max_total_time = 60, - print_final_stats = 1, } luzer.Fuzz(TestOneInput, nil, args) blob - ed9f5684a3d8d01c3a1f569090c1a1dc761a7c22 blob + 30b9f3b4cace168339d8d6738feb5e4c2ec105a7 --- tests/tarantool_uuid_frombin.lua +++ tests/tarantool_uuid_frombin.lua @@ -12,20 +12,10 @@ local function TestOneInput(buf) end end -if arg[1] then - local testcase = io.open(arg[1]):read("*all") - TestOneInput(testcase) - os.exit() -end - -local script_path = debug.getinfo(1).source:match("@?(.*/)") - local args = { print_pcs = 1, max_len = 1024, - corpus = script_path .. "tarantool-corpus/uuid_frombin", artifact_prefix = "uuid_frombin_", max_total_time = 60, - print_final_stats = 1, } luzer.Fuzz(TestOneInput, nil, args) blob - 5bf72dd111f11ba94e9506d253ad2ff06ddff95a blob + b0abd8b231c837f75258830f55cfd900c0a5296a --- tests/tarantool_yaml_decode.lua +++ tests/tarantool_yaml_decode.lua @@ -12,21 +12,10 @@ local function TestOneInput(buf) yaml.encode(res) end -if arg[1] then - local testcase = io.open(arg[1]):read("*all") - TestOneInput(testcase) - os.exit() -end - -local script_path = debug.getinfo(1).source:match("@?(.*/)") - local args = { max_len = 128, - dict = script_path .. "tarantool-corpus/tarantool_yaml.dict", - corpus = script_path .. "tarantool-corpus/tarantool_yaml", print_pcs = 1, artifact_prefix = "tarantool_yaml_", max_total_time = 60, - print_final_stats = 1, } luzer.Fuzz(TestOneInput, nil, args)