Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:zap: Parallelize mobile release packaging and reduce Linux compression

Daniel788567d7940a
diff --git a/docs/RELEASE-VERIFICATION.zh-CN.md b/docs/RELEASE-VERIFICATION.zh-CN.md
index ba310a9014..68d62bc0a4 100644
--- a/docs/RELEASE-VERIFICATION.zh-CN.md
+++ b/docs/RELEASE-VERIFICATION.zh-CN.md
@@ -130,9 +130,13 @@ python -X utf8 scripts/build-release.py --appx
python -X utf8 scripts/build-release.py --appx --execute
```
-各平台安装包按 Windows、Linux、Android、鸿蒙的顺序构建。选择 Windows 时,先准备 Windows 资源,再同时编译 AMD64、ARM64 和同时选中的 Android 内核,默认最多三个任务并行。AMD64 内核完成并验证后立即开始打包,无需等待 Android;ARM64 内核就绪且 AMD64 打包完成后,再打包 ARM64。Windows 安装包及签名始终串行,Android 编译可在其间继续运行,Android 阶段复用本次已编译的 AAR。可传入 `--kernel-jobs 2` 限制为两个任务,或用 `--kernel-jobs 1` 恢复这部分串行编译。
+首先构建 Windows 安装包;Windows 完成后,同时选择的 Linux 与 Android 应用打包并行执行。选择 Windows 时,先准备 Windows 资源,再同时编译 AMD64、ARM64 和同时选中的 Android 内核,默认最多三个任务并行。AMD64 内核完成并验证后立即开始打包,无需等待 Android;ARM64 内核就绪且 AMD64 打包完成后,再打包 ARM64。Windows 安装包及签名始终串行,Android 编译可在其间继续运行,Android 阶段复用本次已编译的 AAR。可传入 `--kernel-jobs 2` 限制为两个任务,或用 `--kernel-jobs 1` 恢复这部分内核串行编译。
-Linux 在首次调用 Go 前配置下载镜像,并在前端构建前检查所需工具链;工具链下载仍保留校验,网络或校验失败时提前退出。Linux 前端仅构建一次,AMD64、ARM64 内核并行编译,各自使用独立输出目录;Electron 安装包仍串行生成。同时选择 Linux 和鸿蒙时,Linux 安装包生成期间并行编译鸿蒙 ARM64 内核,Linux 阶段等待该编译完成,鸿蒙阶段验证并复用本次内核和头文件后打包。仅选择鸿蒙时仍在鸿蒙阶段编译内核。编译失败会阻止后续阶段;中断时回收后台编译进程。
+Linux 在首次调用 Go 前配置下载镜像,并在前端构建前检查所需工具链;工具链下载仍保留校验,网络或校验失败时提前退出。Linux 前端仅构建一次,AMD64、ARM64 内核并行编译,各自使用独立输出目录;Electron 安装包仍串行生成。同时选择 Linux 和鸿蒙时,Linux 安装包生成期间并行编译鸿蒙 ARM64 内核;内核成功后发送本次构建的就绪标记,鸿蒙阶段立即验证版本、架构和头文件并开始应用打包,无需等待 Linux 安装包或 Android 完成。仅选择鸿蒙时仍在鸿蒙阶段编译内核。任一并行任务失败时取消其余任务,中断时回收 Windows 子进程树及 WSL 构建进程组。
+
+并行阶段分别记录状态和产物,`progress.json` 的 `current_stages` 列出所有运行阶段,`current_stage` 为逗号分隔的兼容摘要。记录写入加锁并原子更新;各平台产物仍须通过原有的新鲜度、版本和复制摘要检查。
+
+Linux 双架构打包命令固定设置 `ELECTRON_BUILDER_COMPRESSION_LEVEL=5`,降低 `tar.gz` 的压缩耗时;该变量仅作用于 Linux Electron Builder 子进程。归档仍使用原有格式,产物仍须完成最终安装包校验。
并行编译日志分别保存在本次临时构建目录的 `kernel-logs/` 中,主日志记录任务启动、结束和失败。编译、打包失败或按 Ctrl+C 时,停止队列并回收仍在运行的编译进程;未开始的任务不再执行。Windows 资源准备阶段仅记录资源生成,各架构安装包阶段可与剩余内核编译重叠。
diff --git a/scripts/build-release.py b/scripts/build-release.py
index 100713b399..7a28e35213 100644
--- a/scripts/build-release.py
+++ b/scripts/build-release.py
@@ -19,6 +19,8 @@ import tempfile
import time
import warnings
import zipfile
+import threading
+from concurrent.futures import ThreadPoolExecutor, wait, FIRST_EXCEPTION
ROOT = Path(__file__).resolve().parents[1]
@@ -29,6 +31,19 @@ PLATFORMS = ("windows", "linux", "android", "harmony")
GOVERSIONINFO_MODULE = "github.com/josephspurrier/goversioninfo"
GOVERSIONINFO_VERSION = "v1.7.0"
ACTIVE_RECORD = None
+BUILD_CANCEL = None
+BUILD_PROCESSES = set()
+BUILD_PROCESS_LOCK = threading.Lock()
+
+
+def stop_build_process(process):
+ if process.poll() is None:
+ if os.name == "nt":
+ subprocess.run(["taskkill", "/PID", str(process.pid), "/T", "/F"],
+ stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=False)
+ else:
+ process.terminate()
+
def compile_kernels(commands, directory, jobs=2, on_complete=None):
@@ -111,6 +126,8 @@ class LoggedStream:
class BuildRecord:
def __init__(self, directory, args, version):
self.directory = Path(directory)
+ self.lock = threading.RLock()
+ self.local = threading.local()
self.log = None
self.line_start = True
self.active_stage = None
@@ -129,7 +146,21 @@ class BuildRecord:
"current_stage": None, "stages": [dict(id=key, name=name, status="pending", artifacts=[])
for key, name in stages]}
+ @property
+ def active_stage(self):
+ return getattr(self.local, "stage", None)
+
+ @active_stage.setter
+ def active_stage(self, value):
+ self.local.stage = value
+
def save(self):
+ with self.lock:
+ self._save()
+
+ def _save(self):
+ self.data["current_stages"] = [s["id"] for s in self.data["stages"] if s["status"] == "running"]
+ self.data["current_stage"] = ",".join(self.data["current_stages"]) or None
self.data["updated_at"] = timestamp()
# 同目录原子替换,查看进度时不会读到写入一半的 JSON。
path = self.directory / "progress.json.tmp"
@@ -144,6 +175,10 @@ class BuildRecord:
path.unlink(missing_ok=True)
def write(self, text):
+ with self.lock:
+ self._write(text)
+
+ def _write(self, text):
for part in text.splitlines(keepends=True):
if self.line_start:
self.log.write(f"[{timestamp()}] ")
@@ -226,6 +261,8 @@ def create_record(args, version):
def run(command, cwd, env=None, capture=False, interactive=False):
+ if BUILD_CANCEL is not None and BUILD_CANCEL.is_set():
+ raise BuildError("并行构建已取消")
command = [str(value) for value in command]
executable = shutil.which(command[0]) or command[0]
command[0] = executable
@@ -243,8 +280,9 @@ def run(command, cwd, env=None, capture=False, interactive=False):
if not capture:
print(f"[{cwd}] {subprocess.list2cmdline(command)}", flush=True)
if ACTIVE_RECORD is not None:
- ACTIVE_RECORD.data["last_command"] = {"arguments": command, "directory": str(cwd),
+ command_record = {"arguments": command, "directory": str(cwd),
"started_at": timestamp(), "interactive": interactive}
+ ACTIVE_RECORD.data["last_command"] = command_record
ACTIVE_RECORD.save()
if capture:
ACTIVE_RECORD.write(f"[{cwd}] {subprocess.list2cmdline(command)}\n")
@@ -252,6 +290,10 @@ def run(command, cwd, env=None, capture=False, interactive=False):
# 只采集输出,标准输入仍连接终端;SSH 认证单独保留完整终端交互。
with subprocess.Popen(invocation, cwd=cwd, env=env, shell=shell,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT) as process:
+ with BUILD_PROCESS_LOCK:
+ BUILD_PROCESSES.add(process)
+ if BUILD_CANCEL is not None and BUILD_CANCEL.is_set():
+ stop_build_process(process)
decoder = codecs.getincrementaldecoder("utf-8")(errors="replace")
try:
while chunk := process.stdout.read1(65536):
@@ -261,10 +303,12 @@ def run(command, cwd, env=None, capture=False, interactive=False):
sys.stdout.flush()
returncode = process.wait()
except BaseException:
- if process.poll() is None:
- process.terminate()
+ stop_build_process(process)
process.wait()
raise
+ finally:
+ with BUILD_PROCESS_LOCK:
+ BUILD_PROCESSES.discard(process)
output, detail = "", "请查看上方输出或 build.log"
else:
result = subprocess.run(invocation, cwd=cwd, env=env, shell=shell, check=False,
@@ -275,7 +319,7 @@ def run(command, cwd, env=None, capture=False, interactive=False):
output = (result.stdout or "").strip() if capture else ""
detail = (result.stderr or "").strip() if capture else "请查看上方终端输出"
if ACTIVE_RECORD is not None:
- ACTIVE_RECORD.data["last_command"].update(returncode=returncode, finished_at=timestamp())
+ command_record.update(returncode=returncode, finished_at=timestamp())
ACTIVE_RECORD.save()
if returncode:
raise BuildError(f"命令失败({returncode}):{command[0]};{detail}")
@@ -653,6 +697,10 @@ class Builder:
def linux(self):
started = time.time()
command = ["bash", "scripts/linux-build.sh", "--target=all"]
+ if hasattr(self, "parallel_marker"):
+ command = ["setsid"] + command
+ command.extend(("--process-id-file=" + self.parallel_remote + ".pid",
+ "--harmony-ready-file=" + self.parallel_remote + ".ready"))
if "harmony" in self.args.platforms:
command.append("--with-harmony-kernel")
self.wsl(command)
@@ -663,6 +711,67 @@ class Builder:
for arch in ("", "-arm64") for extension in ("tar.gz", "AppImage", "deb", "rpm")]
self.collect(expected, "Linux", started)
+ def parallel_platforms(self, assets):
+ """Linux owns its kernel workers; mobile packaging waits only for its own inputs."""
+ global BUILD_CANCEL
+ BUILD_CANCEL = threading.Event()
+ marker = self.wsl_root / ".cache" / self.work.name
+ marker.parent.mkdir(parents=True, exist_ok=True)
+ self.parallel_marker = marker
+ self.parallel_remote = self.args.wsl_repo.rstrip("/") + "/.cache/" + marker.name
+ self.harmony_prebuilt_started = time.time()
+ linux_done = threading.Event()
+ def task(platform):
+ if platform == "harmony":
+ while not Path(str(marker) + ".ready").exists():
+ if Path(str(marker) + ".ready.failed").exists():
+ raise BuildError("鸿蒙内核编译失败")
+ if BUILD_CANCEL.wait(0.2):
+ raise BuildError("鸿蒙打包已取消")
+ if linux_done.is_set() and not Path(str(marker) + ".ready").exists():
+ raise BuildError("Linux 未提供本次鸿蒙内核就绪标记")
+ try:
+ with self.stage(platform):
+ method = getattr(self, platform)
+ method() if platform == "linux" else method(assets)
+ finally:
+ if platform == "linux":
+ linux_done.set()
+ def cancel():
+ BUILD_CANCEL.set()
+ # Kill the WSL session as well as Windows child trees. Killing wsl.exe alone
+ # does not reliably terminate its Linux descendants.
+ pid_file = Path(str(marker) + ".pid")
+ deadline = time.monotonic() + 2
+ while not pid_file.exists() and not linux_done.is_set() and time.monotonic() < deadline:
+ time.sleep(0.05)
+ if pid_file.exists():
+ pid = pid_file.read_text().strip()
+ if pid.isdigit():
+ prefix = ["wsl.exe"]
+ if self.args.wsl_distro:
+ prefix += ["--distribution", self.args.wsl_distro]
+ subprocess.run(prefix + ["--user", self.args.wsl_user, "--exec", "kill", "-TERM", "--", "-" + pid],
+ stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=False)
+ with BUILD_PROCESS_LOCK:
+ for process in list(BUILD_PROCESSES):
+ stop_build_process(process)
+ try:
+ with ThreadPoolExecutor(max_workers=3) as pool:
+ futures = [pool.submit(task, platform) for platform in PLATFORMS[1:] if platform in self.args.platforms]
+ try:
+ done, _ = wait(futures, return_when=FIRST_EXCEPTION)
+ error = next((future.exception() for future in done if future.exception() is not None), None)
+ if error is not None:
+ raise error
+ except BaseException:
+ cancel()
+ raise
+ finally:
+ BUILD_CANCEL = None
+ for suffix in (".pid", ".ready", ".ready.failed"):
+ Path(str(marker) + suffix).unlink(missing_ok=True)
+
def check_kernel(self, path, architecture):
info = VERIFY.kernel_info(path)
if info["version"] != self.version or info["architecture"] != architecture:
@@ -863,6 +972,9 @@ def execute_build(args, version, record, signing_pin=None):
create_mobile_assets(assets, version)
for platform in PLATFORMS:
if platform in args.platforms:
+ if platform == "linux" and set(args.platforms) & {"android", "harmony"}:
+ builder.parallel_platforms(assets)
+ break
method = getattr(builder, platform)
with record.stage(platform) if platform != "windows" else nullcontext():
method(assets) if platform in {"android", "harmony"} else method()
diff --git a/scripts/linux-build.sh b/scripts/linux-build.sh
index 0889dde04b..2f02ddbd5d 100755
--- a/scripts/linux-build.sh
+++ b/scripts/linux-build.sh
@@ -15,6 +15,8 @@ PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
TARGET='all'
HARMONY_KERNEL=false
+HARMONY_READY_FILE=''
+PROCESS_ID_FILE=''
validate_target() {
if [[ -z "$1" ]]; then
echo 'Error: --target option requires a value'
@@ -30,6 +32,14 @@ validate_target() {
while [[ $# -gt 0 ]]; do
case $1 in
+ --harmony-ready-file=*)
+ HARMONY_READY_FILE="${1#*=}"
+ shift
+ ;;
+ --process-id-file=*)
+ PROCESS_ID_FILE="${1#*=}"
+ shift
+ ;;
--with-harmony-kernel)
HARMONY_KERNEL=true
shift
@@ -51,6 +61,10 @@ while [[ $# -gt 0 ]]; do
esac
done
+if [[ -n "$PROCESS_ID_FILE" ]]; then
+ printf '%s\n' "$$" > "$PROCESS_ID_FILE"
+fi
+
export GO111MODULE=on
export GOPROXY=https://mirrors.aliyun.com/goproxy/,https://goproxy.cn,direct
# Toolchain selection can download and authenticate a toolchain even for
@@ -67,6 +81,7 @@ cleanup_kernels() {
local pid
for pid in "${KERNEL_PIDS[@]}"; do
kill -TERM -- "-$pid" 2>/dev/null || true
+ kill -TERM "$pid" 2>/dev/null || true
done
for pid in "${KERNEL_PIDS[@]}"; do
wait "$pid" 2>/dev/null || true
@@ -169,7 +184,20 @@ if $HARMONY_KERNEL; then
trap 'cleanup_kernels' EXIT
trap 'exit 130' INT
trap 'exit 143' TERM
- (cd "$PROJECT_ROOT/kernel/harmony"; exec setsid bash -e "$PROJECT_ROOT/scripts/harmony-kernel-build.sh") &
+ (cd "$PROJECT_ROOT/kernel/harmony"
+ setsid bash -e "$PROJECT_ROOT/scripts/harmony-kernel-build.sh" &
+ child=$!
+ trap 'kill -TERM -- "-$child" 2>/dev/null || true; wait "$child" 2>/dev/null || true' EXIT
+ if ! wait "$child"; then
+ if [[ -n "$HARMONY_READY_FILE" ]]; then
+ touch "${HARMONY_READY_FILE}.failed"
+ fi
+ exit 1
+ fi
+ trap - EXIT
+ if [[ -n "$HARMONY_READY_FILE" ]]; then
+ touch "$HARMONY_READY_FILE"
+ fi) &
KERNEL_PIDS=("$!")
fi
@@ -179,12 +207,14 @@ cd "$PROJECT_ROOT/app"
if [[ "$TARGET" == 'amd64' || "$TARGET" == 'all' ]]; then
echo
echo 'Building Electron App amd64'
- pnpm run dist-linux
+ # Electron Builder otherwise defaults gzip archives to level 9 even when
+ # compression is "normal". Keep this override local to Linux packaging.
+ ELECTRON_BUILDER_COMPRESSION_LEVEL=5 pnpm run dist-linux
fi
if [[ "$TARGET" == 'arm64' || "$TARGET" == 'all' ]]; then
echo
echo 'Building Electron App arm64'
- pnpm run dist-linux-arm64
+ ELECTRON_BUILDER_COMPRESSION_LEVEL=5 pnpm run dist-linux-arm64
fi
if $HARMONY_KERNEL; then
diff --git a/scripts/test_build_release.py b/scripts/test_build_release.py
index d3e2e47d56..7986bdc305 100644
--- a/scripts/test_build_release.py
+++ b/scripts/test_build_release.py
@@ -509,6 +509,95 @@ class BuildTests(unittest.TestCase):
self.builder.linux()
self.assertEqual("--with-harmony-kernel" in wsl.call_args.args[0], selected)
+ def test_mobile_packaging_overlaps_linux_and_harmony_waits_for_ready(self):
+ import threading
+ self.builder.wsl_root = self.root / "wsl"
+ self.args.platforms = ["linux", "android", "harmony"]
+ android_started, harmony_started = threading.Event(), threading.Event()
+ def linux():
+ self.assertTrue(android_started.wait(3))
+ self.assertFalse(harmony_started.is_set())
+ Path(str(self.builder.parallel_marker) + ".ready").touch()
+ self.assertTrue(harmony_started.wait(3))
+ def android(assets):
+ android_started.set()
+ self.assertTrue(harmony_started.wait(3))
+ with patch.object(self.builder, "linux", side_effect=linux), \
+ patch.object(self.builder, "android", side_effect=android), \
+ patch.object(self.builder, "harmony", side_effect=lambda assets: harmony_started.set()):
+ self.builder.parallel_platforms(self.root / "assets.zip")
+ self.assertIsNone(build.BUILD_CANCEL)
+ self.assertFalse(Path(str(self.builder.parallel_marker) + ".ready").exists())
+
+ def test_parallel_failure_cancels_running_process_and_waiting_harmony(self):
+ import threading
+ self.builder.wsl_root = self.root / "wsl"
+ self.args.platforms = ["linux", "android", "harmony"]
+ started = threading.Event()
+ def linux():
+ started.set()
+ self.assertTrue(build.BUILD_CANCEL.wait(3))
+ def android(assets):
+ self.assertTrue(started.wait(3))
+ raise build.BuildError("android failed")
+ process = unittest.mock.Mock()
+ with patch.object(self.builder, "linux", side_effect=linux), \
+ patch.object(self.builder, "android", side_effect=android), \
+ patch.object(self.builder, "harmony") as harmony, \
+ patch.object(build, "stop_build_process") as stop:
+ build.BUILD_PROCESSES.add(process)
+ try:
+ with self.assertRaisesRegex(build.BuildError, "android failed"):
+ self.builder.parallel_platforms(self.root / "assets.zip")
+ finally:
+ build.BUILD_PROCESSES.discard(process)
+ stop.assert_called_once_with(process)
+ harmony.assert_not_called()
+ self.assertIsNone(build.BUILD_CANCEL)
+
+ def test_parallel_harmony_rejects_missing_readiness_marker(self):
+ self.builder.wsl_root = self.root / "wsl"
+ self.args.platforms = ["linux", "harmony"]
+ with patch.object(self.builder, "linux"), patch.object(self.builder, "harmony") as harmony:
+ with self.assertRaisesRegex(build.BuildError, "就绪标记"):
+ self.builder.parallel_platforms(self.root / "assets.zip")
+ harmony.assert_not_called()
+
+ def test_parallel_harmony_reports_kernel_failure_before_linux_finishes(self):
+ self.builder.wsl_root = self.root / "wsl"
+ self.args.platforms = ["linux", "harmony"]
+ def linux():
+ Path(str(self.builder.parallel_marker) + ".ready.failed").touch()
+ self.assertTrue(build.BUILD_CANCEL.wait(3))
+ with patch.object(self.builder, "linux", side_effect=linux), patch.object(self.builder, "harmony") as harmony:
+ with self.assertRaisesRegex(build.BuildError, "内核编译失败"):
+ self.builder.parallel_platforms(self.root / "assets.zip")
+ harmony.assert_not_called()
+
+ def test_parallel_progress_keeps_artifacts_in_their_own_stages(self):
+ import threading
+ self.builder.wsl_root = self.root / "wsl"
+ self.args.platforms = ["linux", "android"]
+ directory = self.root / "records"
+ directory.mkdir()
+ record = build.BuildRecord(directory, self.args, "3.8.4")
+ self.builder.record = record
+ barrier = threading.Barrier(2)
+ def package(name):
+ barrier.wait(timeout=3)
+ path = self.write(self.builder.work / (name + ".pkg"))
+ self.builder.collect([path], name, time.time())
+ with patch.object(self.builder, "linux", side_effect=lambda: package("linux")), \
+ patch.object(self.builder, "android", side_effect=lambda assets: package("android")), \
+ contextlib.redirect_stdout(io.StringIO()), record.session():
+ self.builder.parallel_platforms(self.root / "assets.zip")
+ progress = json.loads((directory / "progress.json").read_text())
+ for name in self.args.platforms:
+ stage = next(s for s in progress["stages"] if s["id"] == name)
+ self.assertEqual(stage["status"], "succeeded")
+ self.assertEqual(stage["artifacts"], [str(self.args.output / (name + ".pkg"))])
+ self.assertEqual(progress["current_stages"], [])
+
def test_harmony_rejects_unsigned_only_output(self):
self.builder.wsl_root = self.root / "wsl"
assets = self.write(self.root / "app.zip")
diff --git a/scripts/test_linux_release.py b/scripts/test_linux_release.py
index ea717fe720..cbdbe962c5 100644
--- a/scripts/test_linux_release.py
+++ b/scripts/test_linux_release.py
@@ -9,7 +9,7 @@ import unittest
@unittest.skipUnless(os.name == 'posix' and shutil.which('setsid'), 'Linux process groups required')
class LinuxReleaseTests(unittest.TestCase):
- def run_build(self, fail=False):
+ def run_build(self, fail=False, fail_harmony=False):
temporary = tempfile.TemporaryDirectory()
self.addCleanup(temporary.cleanup)
root = Path(temporary.name)
@@ -37,6 +37,7 @@ echo "$GOARCH-end" >> "$EVENTS"
''')
executable(root / 'bin/pnpm', '''
if [[ "$2" == dist-linux* ]]; then
+ [[ "$ELECTRON_BUILDER_COMPRESSION_LEVEL" == 5 ]] || exit 11
echo "package-start" >> "$EVENTS"
sleep 0.2
echo "package-end" >> "$EVENTS"
@@ -47,12 +48,19 @@ fi
executable(root / 'scripts/harmony-kernel-build.sh', '''
echo harmony-start >> "$EVENTS"
sleep 0.3
+if [[ "$FAIL_HARMONY" == 1 ]]; then exit 9; fi
echo harmony-end >> "$EVENTS"
''')
env = dict(os.environ, PATH=str(root / 'bin') + ':' + os.environ['PATH'], HOME=str(root),
- EVENTS=str(root / 'events'), FAIL_ARCH='arm64' if fail else '')
- result = subprocess.run(['bash', str(root / 'scripts/linux-build.sh'), '--with-harmony-kernel'],
+ EVENTS=str(root / 'events'), FAIL_ARCH='arm64' if fail else '',
+ FAIL_HARMONY='1' if fail_harmony else '', ELECTRON_BUILDER_COMPRESSION_LEVEL='9')
+ result = subprocess.run(['bash', str(root / 'scripts/linux-build.sh'), '--with-harmony-kernel',
+ '--harmony-ready-file=' + str(root / 'ready'),
+ '--process-id-file=' + str(root / 'pid')],
cwd=root, env=env, capture_output=True, text=True, timeout=10)
+ self.assertTrue((root / 'pid').read_text().strip().isdigit())
+ self.assertEqual((root / 'ready').exists(), not fail and not fail_harmony)
+ self.assertEqual((root / 'ready.failed').exists(), fail_harmony)
return result, (root / 'events').read_text().splitlines()
def test_kernels_overlap_and_harmony_overlaps_packaging(self):
@@ -69,3 +77,9 @@ echo harmony-end >> "$EVENTS"
self.assertNotEqual(result.returncode, 0)
self.assertNotIn('package-start', events)
self.assertNotIn('harmony-start', events)
+
+ def test_failed_harmony_kernel_emits_failure_instead_of_ready(self):
+ result, events = self.run_build(fail_harmony=True)
+ self.assertNotEqual(result.returncode, 0)
+ self.assertIn('harmony-start', events)
+ self.assertNotIn('harmony-end', events)