commit 886065ca5e2da9d4daac54161930e699e5499455 from: Sergey Bronnikov via: Sergey Bronnikov date: Wed Jul 19 14:11:32 2023 UTC tests: add stdio test commit - 08ccfc53722463c40595b8e11f566431e84a7921 commit + 886065ca5e2da9d4daac54161930e699e5499455 blob - /dev/null blob + f6e55cf26c42f99497b49487e91ae02e575e60b6 (mode 644) --- /dev/null +++ tests/tarantool_stdio.lua @@ -0,0 +1,45 @@ +-- "Three bytes of death" +-- https://github.com/tarantool/tarantool/issues/4773 + +local luzer = require("luzer") +local popen = require("popen") + +local TARANTOOL_PATH = arg[-1] + +local function TestOneInput(buf) + local ph = popen.new({ TARANTOOL_PATH }, { + shell = true, + setsid = true, + stdout = popen.opts.INHERIT, + stderr = popen.opts.INHERIT, + stdin = popen.opts.PIPE, + }) + if not ph then + return + end + assert(ph) + ph:write(buf .. "\n") + ph:shutdown({ stdin = true }) + ph:wait() + ph:close() +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, + print_pcs = 1, + detect_leaks = 1, + corpus = script_path .. "tarantool-corpus/stdio", + artifact_prefix = "stdio_", + max_total_time = 60, + print_final_stats = 1, +} +luzer.Fuzz(TestOneInput, nil, args)