From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp39.i.mail.ru (smtp39.i.mail.ru [94.100.177.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id ED3E245C316 for ; Mon, 23 Mar 2020 11:45:27 +0300 (MSK) Date: Mon, 23 Mar 2020 11:45:13 +0300 From: Sergey Bronnikov Message-ID: <20200323084513.GA64110@pony.bronevichok.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Subject: [Tarantool-patches] [PATCH] Add option to specify snapshot version List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tarantool-patches@dev.tarantool.org Cc: Oleg Piskunov GitHub branch: https://github.com/tarantool/test-run/tree/ligurio/gh-4801-add-snapshot-option Ticket: #4801 --- lib/options.py | 7 +++++++ lib/tarantool_server.py | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/lib/options.py b/lib/options.py index 8bacb4a..cce3835 100644 --- a/lib/options.py +++ b/lib/options.py @@ -201,6 +201,13 @@ class Options: help="""Run the server under 'luacov'. Default: false.""") + parser.add_argument( + "--snapshot-version", + dest='snapshot_version', + default=None, + help="""Version of Tarantool snapshot loaded before + testing.""") + # XXX: We can use parser.parse_intermixed_args() on # Python 3.7 to understand commands like # ./test-run.py foo --exclude bar baz diff --git a/lib/tarantool_server.py b/lib/tarantool_server.py index fd102b9..09aee9c 100644 --- a/lib/tarantool_server.py +++ b/lib/tarantool_server.py @@ -32,6 +32,7 @@ from lib.utils import format_process from lib.utils import signame from lib.utils import warn_unix_socket from lib.utils import prefix_each_line +from lib.options import Options from test import TestRunGreenlet, TestExecutionError @@ -767,6 +768,14 @@ class TarantoolServer(Server): if (e.errno == errno.ENOENT): continue raise + + snapshot_basename = Options().args.snapshot_version + if snapshot_basename: + snapshot_name = '{}.snap'.format(snapshot_basename) + snapshot_path = os.path.join(self.testdir, 'static/snapshots', snapshot_name) + color_log("Copy snapshot: {}".format(snapshot_name)) + os.mkdir(os.path.join(self.vardir, 'box')) + shutil.copy(snapshot_path, os.path.join(self.vardir, 'box/00000000000000000001.snap')) shutil.copy('.tarantoolctl', self.vardir) shutil.copy(os.path.join(self.TEST_RUN_DIR, 'test_run.lua'), self.vardir) -- 2.23.0 -- sergeyb@