Skip to content

Commit 11d4052

Browse files
discover suites
1 parent 0dd2c23 commit 11d4052

2 files changed

Lines changed: 33 additions & 20 deletions

File tree

configuration/builders/definitions/foundry/foundry.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
# Plugins registered in https://github.com/vuvova/foundry (one top-level
33
# directory each). Selectable via foundry_force_scheduler's "plugin" param
44
# and passed straight to "cmake -P run.cmake <plugin>" in the child builders.
5+
# Note: the plugin's installed MTR "plugin/<name>/suite/" directory isn't
6+
# necessarily named the same (e.g. tidesql's CMake target is "tidesdb") --
7+
# RunPluginMTRSuite discovers that at runtime rather than assuming it matches.
58
plugins:
69
- disabled-functions
710
- levenshtein

configuration/steps/commands/foundry.py

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,26 @@ def as_cmd_arg(self) -> list[str]:
6262
class RunPluginMTRSuite(Command):
6363
# MARIADB_ADD_PLUGIN's INSTALL_MYSQL_TEST (cmake/plugin.cmake) always
6464
# installs a plugin's mysql-test/ contents -- suite/ included -- under
65-
# <mtr_base_dir>/plugin/<plugin>/, so the suite ends up at
66-
# plugin/<plugin>/suite/<name>, not plugin/<plugin>/<name>. mtr_cases.pm's
67-
# short-name lookup for `--suite=NAME` doesn't account for that extra
68-
# suite/ level, so we pass MTR the full relative path instead, which it
69-
# accepts directly. A plugin with no suite/ dir at all is skipped rather
70-
# than failing the build.
65+
# <mtr_base_dir>/plugin/<X>/, so the suite ends up at
66+
# plugin/<X>/suite/<name>, not plugin/<X>/<name>. <X> is the plugin's own
67+
# CMake project/target name, which isn't always the same as the Foundry
68+
# "plugin" property (e.g. tidesql's CMake target is actually "tidesdb"),
69+
# so rather than guess it, discover whatever actually landed under
70+
# plugin/*/suite/* -- exactly one plugin gets installed per build.
71+
# mtr_cases.pm's short-name lookup for `--suite=NAME` doesn't account for
72+
# the extra suite/ level either way, so we pass MTR the full relative
73+
# path instead, which it accepts directly. A plugin with no suite/ dir
74+
# at all is skipped rather than failing the build.
7175
def __init__(self, package_type: str, workdir: PurePath = PurePath(".")):
7276
self.package_type = package_type
7377
super().__init__(name="Run plugin MTR suite", workdir=workdir, user="root")
7478

7579
def as_cmd_arg(self) -> list[str]:
7680
# Ask the package manager where MariaDB-test/mariadb-test actually
77-
# put mysql-test-run.pl, rather than guessing a path -- it's moved
78-
# across MariaDB package versions/layouts before.
81+
# put mariadb-test-run.pl, rather than guessing a path -- it's moved
82+
# across MariaDB package versions/layouts before. Match the current
83+
# top-level script by name, and exclude lib/v1/ specifically -- it
84+
# bundles its own legacy-named mysql-test-run.pl that isn't it.
7985
if self.package_type == "RPM":
8086
list_files_cmd = "rpm -ql MariaDB-test"
8187
else:
@@ -87,27 +93,31 @@ def as_cmd_arg(self) -> list[str]:
8793
f"""
8894
set -euo pipefail
8995
90-
mtr_script=$({list_files_cmd} | grep -m1 '/mysql-test-run\\.pl$' || true)
96+
mtr_script=$({list_files_cmd} | grep -v '/lib/v1/' | grep -m1 '/mariadb-test-run\\.pl$' || true)
9197
if [ -z "$mtr_script" ]; then
92-
echo "Could not locate mysql-test-run.pl from the installed test package" >&2
98+
echo "Could not locate mariadb-test-run.pl from the installed test package" >&2
9399
exit 1
94100
fi
95101
mtr_base_dir=$(dirname "$mtr_script")
96102
97-
plugin_suite_dir="$mtr_base_dir/plugin/%(prop:plugin)s/suite"
98-
if [ ! -d "$plugin_suite_dir" ]; then
99-
echo "No MTR suite found for plugin %(prop:plugin)s -- skipping"
100-
exit 0
101-
fi
102-
103103
suites=""
104-
for d in "$plugin_suite_dir"/*/; do
105-
name=$(basename "$d")
106-
suites="$suites,plugin/%(prop:plugin)s/suite/$name"
104+
for suite_dir in "$mtr_base_dir"/plugin/*/suite; do
105+
[ -d "$suite_dir" ] || continue
106+
plugin_dir=$(basename "$(dirname "$suite_dir")")
107+
for d in "$suite_dir"/*/; do
108+
[ -d "$d" ] || continue
109+
name=$(basename "$d")
110+
suites="$suites,plugin/$plugin_dir/suite/$name"
111+
done
107112
done
108113
suites=$(echo "$suites" | sed 's/^,//')
109114
110-
cd "$mtr_base_dir" && perl mysql-test-run.pl --force --max-test-fail=20 --suite="$suites" --vardir=/home/buildbot
115+
if [ -z "$suites" ]; then
116+
echo "No MTR suite found for plugin %(prop:plugin)s -- skipping"
117+
exit 0
118+
fi
119+
120+
cd "$mtr_base_dir" && perl mariadb-test-run.pl --force --max-test-fail=20 --suite="$suites" --vardir=/home/buildbot
111121
"""
112122
),
113123
]

0 commit comments

Comments
 (0)