build: tests refuse to run beside a build

--check now passes when the caller is inside the lock (make test/cdtest ->
tools/test.sh) and still refuses when another build holds it.  test.sh,
mediacheck.sh, install-simple.sh and install-cgd.sh call it before they
touch the media or start a VM; a direct test beside a build stops with the
holder's pid.
This commit is contained in:
lotherk committed 2026-11-16 12:15:43 +00:00
1 parent 88a184a79a
commit fd4c57b9c3
5 files changed
+17 -1

No files matched your search

+5 -1
View File
@@ -47,7 +47,11 @@ pid_start()
case ${1:-} in
--check)
# Read only: is another build running?
# Read only: is another build running? A process inside the lock (make
# test -> tools/test.sh) is not "another build".
if [ -n "${BUILD_LOCK_HELD:-}" ] && [ -d "$BUILD_LOCK_HELD" ]; then
exit 0
fi
[ -d "$LOCK" ] || exit 0
pid=$(cat "$LOCK/pid" 2>/dev/null || true)
if [ -n "$pid" ] && kill -0 "$pid" 2>/dev/null; then
+3
View File
@@ -17,6 +17,9 @@
set -u
TOP=${TOP:-$(cd "$(dirname "$0")/.." && pwd)}
# Tests do not run beside a build (make test/cdtest hold the lock).
"$TOP/tools/build-lock.sh" --check || exit 1
# the version of the release, as newvers.sh reads it
VER=$(cat "$TOP/src/sys/conf/makronix-release")
V=$TOP/tools/vmsh.sh
+3
View File
@@ -21,6 +21,9 @@
set -u
TOP=${TOP:-$(cd "$(dirname "$0")/.." && pwd)}
# Tests do not run beside a build (make test/cdtest hold the lock).
"$TOP/tools/build-lock.sh" --check || exit 1
# the version of the release, as newvers.sh reads it
VER=$(cat "$TOP/src/sys/conf/makronix-release")
V=$TOP/tools/vmsh.sh
+3
View File
@@ -23,6 +23,9 @@
set -u
TOP=${TOP:-$(cd "$(dirname "$0")/.." && pwd)}
# Tests do not run beside a build (make test/cdtest hold the lock).
"$TOP/tools/build-lock.sh" --check || exit 1
IMG=$TOP/build/obj/releasedir/images
VER=$(cat "$TOP/src/sys/conf/makronix-release")
T=$TOP/build/mediacheck
+3
View File
@@ -26,6 +26,9 @@
set -u
TOP=${TOP:-$(cd "$(dirname "$0")/.." && pwd)}
# Tests do not run beside a build (make test/cdtest hold the lock).
"$TOP/tools/build-lock.sh" --check || exit 1
# the version of the release, as newvers.sh reads it
VER=$(cat "$TOP/src/sys/conf/makronix-release")
DAY=$(date +%Y-%m-%d)