[COMMIT scylladb master] Merge '[test.py] add --extra-scylla-cmdline-options argument for test.py' from Artsiom Mishuta

0 views
Skip to first unread message

Commit Bot

<bot@cloudius-systems.com>
unread,
Jun 28, 2024, 10:08:46 AMJun 28
to scylladb-dev@googlegroups.com, Piotr Dulikowski
From: Piotr Dulikowski <pio...@scylladb.com>
Committer: Piotr Dulikowski <pio...@scylladb.com>
Branch: master

Merge '[test.py] add --extra-scylla-cmdline-options argument for test.py' from Artsiom Mishuta

this PR has 2 commits
- [test: pass Scylla extra CMD args from test.py args](https://github.com/scylladb/scylladb/commit/6b367a04b5c7a6afcba284b65cc40cffda33a790)
- [test: adjust scylla_cluster.merge_cmdline_options behavior](https://github.com/scylladb/scylladb/commit/c60b36090a9400e011e951587000bd49448d2db8)

the main goal is to solve [test.py: provide an easy-to-remember, univeral way to run scylla with trace level logging](https://github.com/scylladb/scylladb/issues/14960) issue

but also can be used to easily apply additional arguments for all UnitTests and PythonTests on the fly from the test.py CMD

Closes scylladb/scylladb#19509

* github.com:scylladb/scylladb:
test: adjust scylla_cluster.merge_cmdline_options behavior
test: pass scylla extra CMD args from test.py args

---
diff --git a/test.py b/test.py
--- a/test.py
+++ b/test.py
@@ -340,6 +340,7 @@ async def add_test(self, shortname, casename) -> None:
# Default seastar arguments, if not provided in custom test options,
# are two cores and 2G of RAM
args = self.custom_args.get(shortname, ["-c2 -m2G"])
+ args = merge_cmdline_options(args, self.options.extra_scylla_cmdline_options)
for a in args:
await self.create_test(shortname, casename, self, a)

@@ -437,7 +438,7 @@ def create_server(create_cfg: ScyllaCluster.CreateServerParams):
if type(cmdline_options) == str:
cmdline_options = [cmdline_options]
cmdline_options = merge_cmdline_options(cmdline_options, create_cfg.cmdline_from_test)
-
+ cmdline_options = merge_cmdline_options(cmdline_options, options.extra_scylla_cmdline_options)
# There are multiple sources of config options, with increasing priority
# (if two sources provide the same config option, the higher priority one wins):
# 1. the defaults
@@ -1351,6 +1352,9 @@ def parse_cmd_line() -> argparse.Namespace:
scylla_additional_options = parser.add_argument_group('Additional options for Scylla tests')
scylla_additional_options.add_argument('--x-log2-compaction-groups', action="store", default="0", type=int,
help="Controls number of compaction groups to be used by Scylla tests. Value of 3 implies 8 groups.")
+ scylla_additional_options.add_argument('--extra-scylla-cmdline-options', action="store", default=[], type=str,
+ help="Passing extra scylla cmdline options for all tests. Options should be space separated:"
+ "'--logger-log-level raft=trace --default-log-level error'")

boost_group = parser.add_argument_group('boost suite options')
boost_group.add_argument('--random-seed', action="store",
@@ -1425,6 +1429,9 @@ def prepare_dir(dirname, pattern):
print(palette.fail("Failed to read output of `ninja unit_test_list`: please run ./configure.py first"))
raise

+ if args.extra_scylla_cmdline_options:
+ args.extra_scylla_cmdline_options = args.extra_scylla_cmdline_options.split()
+
return args


diff --git a/test/pylib/scylla_cluster.py b/test/pylib/scylla_cluster.py
--- a/test/pylib/scylla_cluster.py
+++ b/test/pylib/scylla_cluster.py
@@ -160,7 +160,8 @@ def make_scylla_conf(mode: str, workdir: pathlib.Path, host_addr: str, seed_addr
# [--overprovisioned, --smp=1, --abort-on-ebadf], [--smp=2] -> [--overprovisioned, --smp=2, --abort-on-ebadf]
# [], [--experimental-features, raft, --experimental-features, broadcast-tables] ->
# [--experimental-features, raft, --experimental-features, broadcast-tables]
-def merge_cmdline_options(base: List[str], override: List[str]) -> List[str]:
+def merge_cmdline_options(
+ base: List[str], override: List[str], appending_options: List[str] = ["--logger-log-level"]) -> List[str]:
if len(override) == 0:
return base

@@ -191,7 +192,8 @@ def run() -> List[str]:
if v != '__remove__':
if merged_values is None:
merged_values = merged.setdefault(name, [])
- merged_values.clear()
+ if name not in appending_options:
+ merged_values.clear()
merged_values.append(v if v != '__missing__' else None)
elif name in merged:
del merged[name]
Reply all
Reply to author
Forward
0 new messages