summaryrefslogtreecommitdiff
path: root/dev-db/mysql
diff options
context:
space:
mode:
authorAlfred Wingate <parona@protonmail.com>2025-03-09 11:19:33 +0200
committerSam James <sam@gentoo.org>2025-03-10 00:19:13 +0000
commit301cd23e23a7bc7961bbba29733bb488f914c30b (patch)
treece404cb6fdce6e52e0444e0cd5e79035a6719d63 /dev-db/mysql
parent7f41d97b384acdf5bad71feb2ba0dc8e14350b93 (diff)
downloadgentoo-301cd23e23a7bc7961bbba29733bb488f914c30b.tar.gz
gentoo-301cd23e23a7bc7961bbba29733bb488f914c30b.tar.bz2
gentoo-301cd23e23a7bc7961bbba29733bb488f914c30b.zip
dev-db/mysql: use tmpfs for test databases opportunistically
Use max parallelisation if possible otherwise use one job to avoid failures from high I/O contention. Signed-off-by: Alfred Wingate <parona@protonmail.com> Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-db/mysql')
-rw-r--r--dev-db/mysql/mysql-8.0.40.ebuild21
1 files changed, 19 insertions, 2 deletions
diff --git a/dev-db/mysql/mysql-8.0.40.ebuild b/dev-db/mysql/mysql-8.0.40.ebuild
index 6a97a5f62cc4..7138143ad509 100644
--- a/dev-db/mysql/mysql-8.0.40.ebuild
+++ b/dev-db/mysql/mysql-8.0.40.ebuild
@@ -399,7 +399,17 @@ src_test() {
# Ensure that parallel runs don't die
local -x MTR_BUILD_THREAD="$((${RANDOM} % 100))"
- local -x MTR_PARALLEL=${MTR_PARALLEL:-$(makeopts_jobs)}
+ # Use a tmpfs opportunistically, otherwise set MTR_PARALLEL to 1.
+ # MySQL tests are I/O heavy. They benefit greatly from a tmpfs, parallel tests without a tmpfs are flaky due to timeouts.
+ if mountpoint -q /dev/shm ; then
+ local VARDIR="/dev/shm/mysql-var-${MTR_BUILD_THREAD}"
+ local -x MTR_PARALLEL=${MTR_PARALLEL:-$(makeopts_jobs)}
+ else
+ ewarn "/dev/shm not mounted, setting default MTR_PARALLEL to 1. Tests will take a long time"
+ local VARDIR="${T}/vardir"
+ # Set it to one while allowing users to override it.
+ local -x MTR_PARALLEL=${MTR_PARALLEL:-1}
+ fi
einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'"
# Disable unit tests, run them separately with eclass defaults
@@ -576,11 +586,18 @@ src_test() {
# Anything touching gtid_executed is negatively affected if you have unlucky ordering
nonfatal edo perl mysql-test-run.pl \
--force --force-restart \
- --vardir="${T}/var-tests" --tmpdir="${T}/tmp-tests" \
+ --vardir="${VARDIR}" --tmpdir="${T}/tmp-tests" \
--skip-test=tokudb --skip-test-list="${T}/disabled.def" \
--retry-failure=2 --max-test-fail=0
retstatus_tests=$?
+ if [[ "${VARDIR}" != "${T}/var-tests" ]]; then
+ # Move vardir to tempdir.
+ mv "${VARDIR}" "${T}/var-tests"
+ # Clean up mysql temporary directory
+ rm -rf "${VARDIR}" 2>/dev/null
+ fi
+
popd &>/dev/null || die
# Cleanup is important for these testcases.