commit 343103f27f4b93edad554204e0ac8a765f6da0cd from: Sergey Bronnikov via: Sergey Bronnikov date: Wed Apr 05 06:50:38 2023 UTC tests: add pickle test commit - 9f8b768880cb65aa824851ae15a3f8e2ee4c76ca commit + 343103f27f4b93edad554204e0ac8a765f6da0cd blob - /dev/null blob + ec43c7b32131199a5d2e8c2d51d00ede97fcf9f0 (mode 644) --- /dev/null +++ tests/tarantool_pickle.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)