Skip to content

Commit 0a70001

Browse files
Oleg Chaplashkinylobankov
authored andcommitted
Add ability to set path to executable file
Now test-run can run tests against Tarantool binary that can be located anywhere. Add an additional argument `--executable` [string] for test-run. This parameter sets a fixed path to the executable file. Warning: test library binaries are required to run tests anyway. Example usage: $ ./test-run.py --executable /foo/bar/tarantool In scope of tarantool#400
1 parent 704420e commit 0a70001

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

lib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def module_init():
8383

8484
prepend_path(os.path.join(os.environ['TEST_RUN_DIR'], 'lib/luatest/bin'))
8585

86-
TarantoolServer.find_exe(args.builddir)
86+
TarantoolServer.find_exe(args.builddir, executable=args.executable)
8787
UnittestServer.find_exe(args.builddir)
8888
AppServer.find_exe(args.builddir)
8989
LuatestServer.find_exe(args.builddir)

lib/options.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,17 @@ def __init__(self):
493493
$ . <(./test/test-run.py --env)
494494
"""))
495495

496+
parser.add_argument(
497+
'--executable',
498+
dest='executable',
499+
default=None,
500+
help=format_help(
501+
"""
502+
Set a custom path to the Tarantool executable.
503+
504+
Useful when Tarantool binary is not in $BUILDDIR and $PATH.
505+
"""))
506+
496507
# XXX: We can use parser.parse_intermixed_args() on
497508
# Python 3.7 to understand commands like
498509
# ./test-run.py foo --exclude bar baz

lib/tarantool_server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -694,14 +694,14 @@ def __init__(self, _ini=None, test_suite=None):
694694
self.current_test = caller_globals['test_run_current_test']
695695

696696
@classmethod
697-
def find_exe(cls, builddir, silent=True):
697+
def find_exe(cls, builddir, silent=True, executable=None):
698698
cls.builddir = os.path.abspath(builddir)
699699
builddir = os.path.join(builddir, "src")
700700
path = builddir + os.pathsep + os.environ["PATH"]
701701
color_log("Looking for server binary in ", schema='serv_text')
702702
color_log(path + ' ...\n', schema='path')
703703
for _dir in path.split(os.pathsep):
704-
exe = os.path.join(_dir, cls.default_tarantool["bin"])
704+
exe = executable or os.path.join(_dir, cls.default_tarantool["bin"])
705705
ctl_dir = _dir
706706
# check local tarantoolctl source
707707
if _dir == builddir:

0 commit comments

Comments
 (0)