Skip to content

Commit

Permalink
test: fix reading STDIN command on openSUSE
Browse files Browse the repository at this point in the history
Inspired by tarantoolgh-5064, that breaks the previous version of the test on
openSUSE. When using `io.popen:write()` on tarantool with `-i` flag, it
failed to run the command on openSUSE. This happened because before
tarantoolgh-5064 patch it used to employ `luaL_loadfile()` that interprets EOF
as the end of the command, while when it is loaded as a string openSUSE
expects it to end with '\n'.

Needed for tarantool#5064
NO_DOC=test fix
NO_TEST=test fix
NO_CHANGELOG=test fix
  • Loading branch information
Lord-KA committed Aug 1, 2022
1 parent 5557c47 commit 73af5aa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test/box/gh-4703-on_shutdown-bug.result
Expand Up @@ -22,7 +22,7 @@ test_run:cmd("setopt delimiter ';'");
| ...
on_shutdown_cmd = "box.ctl.on_shutdown(function() local fio = require('fio') "..
"fio.open('"..file_name.."', "..
"{'O_CREAT', 'O_TRUNC', 'O_WRONLY'}, 777):close() end)";
"{'O_CREAT', 'O_TRUNC', 'O_WRONLY'}, 777):close() end)\n";
| ---
| ...
test_run:cmd("setopt delimiter ''");
Expand Down
3 changes: 2 additions & 1 deletion test/box/gh-4703-on_shutdown-bug.test.lua
Expand Up @@ -8,9 +8,10 @@ test_run = env.new()
--
file_name = "on_shutdown_triggered.txt"
test_run:cmd("setopt delimiter ';'");
-- Extra \n is required on openSUSE.
on_shutdown_cmd = "box.ctl.on_shutdown(function() local fio = require('fio') "..
"fio.open('"..file_name.."', "..
"{'O_CREAT', 'O_TRUNC', 'O_WRONLY'}, 777):close() end)";
"{'O_CREAT', 'O_TRUNC', 'O_WRONLY'}, 777):close() end)\n";
test_run:cmd("setopt delimiter ''");
server = io.popen('tarantool -i', 'w')
server:write(on_shutdown_cmd)
Expand Down

0 comments on commit 73af5aa

Please sign in to comment.