commit a252cb8bb9f2abf84ce11a569e92d659761ab754 from: Sergey Bronnikov via: Sergey Bronnikov date: Mon May 29 12:01:48 2023 UTC tests: add a method as postfix in filename commit - 9107d4316c312c83240732273acb529314291021 commit + a252cb8bb9f2abf84ce11a569e92d659761ab754 blob - 888c8428dba04a484e40e95d0f10999e440f32e2 (mode 644) blob + /dev/null --- tests/tarantool_csv.lua +++ /dev/null @@ -1,31 +0,0 @@ --- https://www.tarantool.io/en/doc/latest/reference/reference_lua/csv/ - -local csv = require("csv") -local luzer = require("luzer") - -local function TestOneInput(buf) - local ok, res = pcall(csv.load, buf) - if ok == true then - assert(res ~= nil) - end - 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 - /dev/null blob + 888c8428dba04a484e40e95d0f10999e440f32e2 (mode 644) --- /dev/null +++ tests/tarantool_csv_load.lua @@ -0,0 +1,31 @@ +-- https://www.tarantool.io/en/doc/latest/reference/reference_lua/csv/ + +local csv = require("csv") +local luzer = require("luzer") + +local function TestOneInput(buf) + local ok, res = pcall(csv.load, buf) + if ok == true then + assert(res ~= nil) + end + 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 - 721c9bca137ff1f8dc728e5f2f352a39237939e7 (mode 644) blob + /dev/null --- tests/tarantool_decimal.lua +++ /dev/null @@ -1,33 +0,0 @@ --- https://www.tarantool.io/en/doc/latest/reference/reference_lua/decimal/ - -local luzer = require("luzer") -local decimal = require("decimal") - -local function TestOneInput(buf) - local ok, res = pcall(decimal.new, buf) - if ok == false then - 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 - /dev/null blob + 721c9bca137ff1f8dc728e5f2f352a39237939e7 (mode 644) --- /dev/null +++ tests/tarantool_decimal_new.lua @@ -0,0 +1,33 @@ +-- https://www.tarantool.io/en/doc/latest/reference/reference_lua/decimal/ + +local luzer = require("luzer") +local decimal = require("decimal") + +local function TestOneInput(buf) + local ok, res = pcall(decimal.new, buf) + if ok == false then + 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 (mode 644) blob + /dev/null --- tests/tarantool_json.lua +++ /dev/null @@ -1,36 +0,0 @@ --- https://github.com/tarantool/tarantool/issues/4366 --- https://www.tarantool.io/en/doc/latest/reference/reference_lua/json/ - -local json = require("json") -local luzer = require("luzer") -local math = require("math") - -local function TestOneInput(buf) - local ok, obj = pcall(json.decode, buf) - if obj == math.inf or - obj == 0/0 then - return -1 - end - if ok == true then - assert(json.encode(obj) ~= nil) - 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 - /dev/null blob + f100719f4f1c8061b588944b4f9204e6308a71a9 (mode 644) --- /dev/null +++ tests/tarantool_json_decode.lua @@ -0,0 +1,36 @@ +-- https://github.com/tarantool/tarantool/issues/4366 +-- https://www.tarantool.io/en/doc/latest/reference/reference_lua/json/ + +local json = require("json") +local luzer = require("luzer") +local math = require("math") + +local function TestOneInput(buf) + local ok, obj = pcall(json.decode, buf) + if obj == math.inf or + obj == 0/0 then + return -1 + end + if ok == true then + assert(json.encode(obj) ~= nil) + 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 (mode 644) blob + /dev/null --- tests/tarantool_msgpack.lua +++ /dev/null @@ -1,46 +0,0 @@ ---[[ -https://github.com/tarantool/tarantool/issues/5184 -https://github.com/tarantool/tarantool/issues/4724 -https://github.com/tarantool/tarantool/issues/3900 -https://github.com/tarantool/tarantool/issues/5014 "\xd4\x02\x00" -https://github.com/tarantool/tarantool/issues/5016 "\xd4\xfe\x00" -https://github.com/tarantool/tarantool/issues/5017 "\xd4\x0f\x00" -https://github.com/tarantool/tarantool/issues/206 - -https://www.tarantool.io/ru/doc/latest/reference/reference_lua/msgpack/ -]] - -local msgpack = require("msgpack") -local luzer = require("luzer") - -local function TestOneInput(buf) - local ok, res = pcall(msgpack.decode, buf) - if ok == true then - ok, res = pcall(msgpack.encode, res) - if ok == false and - string.find(res, "Too high nest level") then - return -1 - end - assert(ok == true) - assert(res ~= nil) - 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 - /dev/null blob + 30e6d1e1e38f59482865b7ea1467e6bdd435dea5 (mode 644) --- /dev/null +++ tests/tarantool_msgpack_decode.lua @@ -0,0 +1,46 @@ +--[[ +https://github.com/tarantool/tarantool/issues/5184 +https://github.com/tarantool/tarantool/issues/4724 +https://github.com/tarantool/tarantool/issues/3900 +https://github.com/tarantool/tarantool/issues/5014 "\xd4\x02\x00" +https://github.com/tarantool/tarantool/issues/5016 "\xd4\xfe\x00" +https://github.com/tarantool/tarantool/issues/5017 "\xd4\x0f\x00" +https://github.com/tarantool/tarantool/issues/206 + +https://www.tarantool.io/ru/doc/latest/reference/reference_lua/msgpack/ +]] + +local msgpack = require("msgpack") +local luzer = require("luzer") + +local function TestOneInput(buf) + local ok, res = pcall(msgpack.decode, buf) + if ok == true then + ok, res = pcall(msgpack.encode, res) + if ok == false and + string.find(res, "Too high nest level") then + return -1 + end + assert(ok == true) + assert(res ~= nil) + 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 - 6607948b321b205dceee34010b061cf6118f98c3 blob + 303e9867472042ffeb5d6f1cc8de5503a59841f3 --- tests/tarantool_net_box_call.lua +++ tests/tarantool_net_box_call.lua @@ -7,10 +7,11 @@ local net_box = require("net.box") local function TestOneInput(buf) os.execute("rm -f *.snap") + local socket_path = os.tmpname() box.cfg{ - listen = 3303, + listen = socket_path, } - local conn = net_box.connect("3303") + local conn = net_box.connect(socket_path) pcall(conn.call, conn, buf) end blob - ec43c7b32131199a5d2e8c2d51d00ede97fcf9f0 (mode 644) blob + /dev/null --- tests/tarantool_pickle.lua +++ /dev/null @@ -1,29 +0,0 @@ --- https://www.tarantool.io/en/doc/latest/reference/reference_lua/pickle/ - -local pickle = require("pickle") -local luzer = require("luzer") - -local function TestOneInput(buf) - local ok, unpacked = pcall(pickle.unpack, buf) - if ok == true then - local packed = pickle.pack(unpacked) - assert(#packed == #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 - /dev/null blob + ec43c7b32131199a5d2e8c2d51d00ede97fcf9f0 (mode 644) --- /dev/null +++ tests/tarantool_pickle_unpack.lua @@ -0,0 +1,29 @@ +-- https://www.tarantool.io/en/doc/latest/reference/reference_lua/pickle/ + +local pickle = require("pickle") +local luzer = require("luzer") + +local function TestOneInput(buf) + local ok, unpacked = pcall(pickle.unpack, buf) + if ok == true then + local packed = pickle.pack(unpacked) + assert(#packed == #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 - ed9f5684a3d8d01c3a1f569090c1a1dc761a7c22 (mode 644) blob + /dev/null --- tests/tarantool_uuid.lua +++ /dev/null @@ -1,31 +0,0 @@ --- https://www.tarantool.io/en/doc/latest/reference/reference_lua/uuid/ - -local uuid = require("uuid") -local luzer = require("luzer") - -local function TestOneInput(buf) - local ok, res = pcall(uuid.frombin, buf) - if ok == true then - assert(res ~= nil) - assert(uuid.is_uuid(res)) - assert(res:str()) - 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 - /dev/null blob + ed9f5684a3d8d01c3a1f569090c1a1dc761a7c22 (mode 644) --- /dev/null +++ tests/tarantool_uuid_frombin.lua @@ -0,0 +1,31 @@ +-- https://www.tarantool.io/en/doc/latest/reference/reference_lua/uuid/ + +local uuid = require("uuid") +local luzer = require("luzer") + +local function TestOneInput(buf) + local ok, res = pcall(uuid.frombin, buf) + if ok == true then + assert(res ~= nil) + assert(uuid.is_uuid(res)) + assert(res:str()) + 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 (mode 644) blob + /dev/null --- tests/tarantool_yaml.lua +++ /dev/null @@ -1,32 +0,0 @@ --- https://www.tarantool.io/en/doc/latest/reference/reference_lua/yaml/ --- https://github.com/tarantool/tarantool/issues/4773 \x36\x00\x80 - -local yaml = require("yaml") -local luzer = require("luzer") - -local function TestOneInput(buf) - local ok, res = pcall(yaml.decode, buf) - if ok == false then - return - end - 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) blob - /dev/null blob + 5bf72dd111f11ba94e9506d253ad2ff06ddff95a (mode 644) --- /dev/null +++ tests/tarantool_yaml_decode.lua @@ -0,0 +1,32 @@ +-- https://www.tarantool.io/en/doc/latest/reference/reference_lua/yaml/ +-- https://github.com/tarantool/tarantool/issues/4773 \x36\x00\x80 + +local yaml = require("yaml") +local luzer = require("luzer") + +local function TestOneInput(buf) + local ok, res = pcall(yaml.decode, buf) + if ok == false then + return + end + 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)