From cfec8bdd611a5054c195f0fb5664fb7544849647 Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Mon, 12 Sep 2022 13:31:06 -0700 Subject: [PATCH] Use tls plugin for old binaries < 5.2.0 This fixes restart tests from old binaries < 5.2.0, which previously were immediately crashing in a TLS codepath. This behavior was not originally ported from the old test harness to the new test harness. --- contrib/TestHarness2/test_harness/config.py | 2 ++ contrib/TestHarness2/test_harness/run.py | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/contrib/TestHarness2/test_harness/config.py b/contrib/TestHarness2/test_harness/config.py index b814d5429d..25e8553782 100644 --- a/contrib/TestHarness2/test_harness/config.py +++ b/contrib/TestHarness2/test_harness/config.py @@ -139,6 +139,8 @@ class Config: self.max_errors_args = {'short_name': 'E'} self.old_binaries_path: Path = Path('/app/deploy/global_data/oldBinaries/') self.old_binaries_path_args = {'help': 'Path to the directory containing the old fdb binaries'} + self.tls_plugin_path: Path = Path('/app/deploy/runtime/.tls_5_1/FDBLibTLS.so') + self.tls_plugin_path_args = {'help': 'Path to the tls plugin used for binaries < 5.2.0'} self.use_valgrind: bool = False self.use_valgrind_args = {'action': 'store_true'} self.buggify = BuggifyOption('random') diff --git a/contrib/TestHarness2/test_harness/run.py b/contrib/TestHarness2/test_harness/run.py index c5e948eb6d..d4beaeea8e 100644 --- a/contrib/TestHarness2/test_harness/run.py +++ b/contrib/TestHarness2/test_harness/run.py @@ -18,7 +18,7 @@ from functools import total_ordering from pathlib import Path from test_harness.version import Version from test_harness.config import config -from typing import List, Pattern, OrderedDict +from typing import Dict, List, Pattern, OrderedDict from test_harness.summarize import Summary, SummaryTree @@ -309,6 +309,7 @@ class TestRun: self.trace_format: str | None = config.trace_format if Version.of_binary(self.binary) < "6.1.0": self.trace_format = None + self.use_tls_plugin = Version.of_binary(self.binary) < "5.2.0" self.temp_path = config.run_dir / str(self.uid) # state for the run self.retryable_error: bool = False @@ -332,6 +333,7 @@ class TestRun: def run(self): command: List[str] = [] + env: Dict[str, str] = os.environ.copy() valgrind_file: Path | None = None if self.use_valgrind: command.append('valgrind') @@ -346,6 +348,9 @@ class TestRun: '-s', str(self.random_seed)] if self.trace_format is not None: command += ['--trace_format', self.trace_format] + if self.use_tls_plugin: + command += ['--tls_plugin', str(config.tls_plugin_path)] + env["FDB_TLS_PLUGIN"] = str(config.tls_plugin_path) if Version.of_binary(self.binary) >= '7.1.0': command += ['-fi', 'on' if self.fault_injection_enabled else 'off'] if self.restarting: @@ -361,7 +366,7 @@ class TestRun: resources = ResourceMonitor() resources.start() process = subprocess.Popen(command, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE, cwd=self.temp_path, - text=True) + text=True, env=env) did_kill = False timeout = 20 * config.kill_seconds if self.use_valgrind else config.kill_seconds err_out: str