Skip to content

Commit

Permalink
Fix issue with server start when luatest installed as rock
Browse files Browse the repository at this point in the history
When luatest is installed as a rock, the internal server_instance.lua
script won't have execution permissions even though it has them in the
source tree, and won't be able to be run while a server start.

Let's start a server process as

    /abs/path/to/tarantool /abs/path/to/luatest/server_instance.lua

instead of just

    /abs/path/to/luatest/server_instance.lua

to bypass the problem.

Also, the shebang string and x-bit are removed from server_instance.lua.

Part of #269
  • Loading branch information
ylobankov committed Dec 8, 2022
1 parent cb28d93 commit e75b6f4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 9 additions & 1 deletion luatest/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,21 @@ function Server:start(opts)
table.insert(log_cmd, string.format('%s=%q', k, v))
env[k] = v
end
table.insert(log_cmd, arg[-1])
table.insert(log_cmd, self.command)
for _, v in ipairs(self.args) do
table.insert(log_cmd, string.format('%q', v))
end
log.debug(table.concat(log_cmd, ' '))

self.process = Process:start(self.command, self.args, env, {
-- When luatest is installed as a rock, server_instance.lua script won't
-- have execution permissions even though it has them in the source tree,
-- and won't be able to be run while a server start.
-- To bypass this issue, we start a server process as `tarantool <script>`
-- instead of just `<script>`.
local args = table.copy(self.args)
table.insert(args, 1, self.command)
self.process = Process:start(arg[-1], args, env, {
chdir = self.chdir,
output_prefix = self.alias,
})
Expand Down
2 changes: 0 additions & 2 deletions luatest/server_instance.lua
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env tarantool

local fio = require('fio')
local fun = require('fun')
local json = require('json')
Expand Down

0 comments on commit e75b6f4

Please sign in to comment.