@@ -43,25 +43,42 @@ class RunPluginMTRSuite(Command):
4343 # the plugin's fetched source (<plugin>.build/) that has a suite.opt --
4444 # copies them into the installed suite tree, and runs them. A plugin
4545 # with no MTR suite is skipped rather than failing the build.
46- def __init__ (self , mtr_base_dir : str , workdir : PurePath = PurePath ("." )):
47- self .mtr_base_dir = mtr_base_dir
46+ def __init__ (self , candidate_mtr_dirs : list [str ], workdir : PurePath = PurePath ("." )):
47+ # candidate_mtr_dirs: possible install locations for
48+ # mysql-test-run.pl, since the exact path varies across MariaDB
49+ # package versions/layouts -- the first one that actually exists
50+ # (post MariaDB-test/mariadb-test install) is used.
51+ self .candidate_mtr_dirs = candidate_mtr_dirs
4852 super ().__init__ (name = "Run plugin MTR suite" , workdir = workdir , user = "root" )
4953
5054 def as_cmd_arg (self ) -> list [str ]:
55+ candidates = " " .join (self .candidate_mtr_dirs )
5156 return [
5257 "bash" ,
5358 "-exc" ,
5459 util .Interpolate (
5560 f"""
5661set -euo pipefail
5762
63+ mtr_base_dir=""
64+ for candidate in { candidates } ; do
65+ if [ -f "$candidate/mysql-test-run.pl" ]; then
66+ mtr_base_dir="$candidate"
67+ break
68+ fi
69+ done
70+ if [ -z "$mtr_base_dir" ]; then
71+ echo "Could not find mysql-test-run.pl in any of: { candidates } " >&2
72+ exit 1
73+ fi
74+
5875plugin_build="%(prop:plugin)s.build"
5976suites=""
6077for mt in $(find "$plugin_build" -type d -name mysql-test 2>/dev/null); do
6178 for d in "$mt"/*/ "$mt"/suite/*/; do
6279 [ -f "${{d}}suite.opt" ] || continue
6380 name=$(basename "$d")
64- cp -r "$d" "{ self . mtr_base_dir } /suite/$name"
81+ cp -r "$d" "$ mtr_base_dir/suite/$name"
6582 suites="$suites,$name"
6683 done
6784done
@@ -72,7 +89,7 @@ def as_cmd_arg(self) -> list[str]:
7289 exit 0
7390fi
7491
75- perl { self . mtr_base_dir } /mysql-test-run.pl --suite="$suites" --user=root
92+ perl "$ mtr_base_dir/mysql-test-run.pl" --suite="$suites" --user=root
7693"""
7794 ),
7895 ]
0 commit comments