From 73af5aaab8358ff104efd6543e9dc7b14783731d Mon Sep 17 00:00:00 2001 From: Gleb Kashkin Date: Thu, 7 Jul 2022 13:47:58 +0000 Subject: [PATCH] test: fix reading STDIN command on openSUSE Inspired by gh-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 gh-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 #5064 NO_DOC=test fix NO_TEST=test fix NO_CHANGELOG=test fix --- test/box/gh-4703-on_shutdown-bug.result | 2 +- test/box/gh-4703-on_shutdown-bug.test.lua | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/test/box/gh-4703-on_shutdown-bug.result b/test/box/gh-4703-on_shutdown-bug.result index 7c1aae2ba537..ac4fbbda3272 100644 --- a/test/box/gh-4703-on_shutdown-bug.result +++ b/test/box/gh-4703-on_shutdown-bug.result @@ -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 ''"); diff --git a/test/box/gh-4703-on_shutdown-bug.test.lua b/test/box/gh-4703-on_shutdown-bug.test.lua index 2b15277dbf41..e06ef7a5eb8d 100755 --- a/test/box/gh-4703-on_shutdown-bug.test.lua +++ b/test/box/gh-4703-on_shutdown-bug.test.lua @@ -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)