From 756fbb9a6bd422c6a806d38b966e38cbdc09969b Mon Sep 17 00:00:00 2001 From: "Aleksei (Faumaray) Selikhov" Date: Sun, 6 Dec 2026 04:32:16 +0300 Subject: [PATCH] ci(windows): put the stable junction under /tmp and make the supervisor test portable C:/vbs-ci could not be created on the runner (the junction silently failed and every job rebuilt), so the stable path now lives under the MSYS2 temp directory, which persists across the jobs of a run and is writable. A failed junction is reported instead of being ignored. The process-supervisor test now uses cmd.exe on Windows and skips the POSIX process-group cases (job objects own the descendants there). --- .gitea/scripts/windows-native.sh | 19 ++++++++++--------- tests/CoreEngineTests.cpp | 9 +++++++++ 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/.gitea/scripts/windows-native.sh b/.gitea/scripts/windows-native.sh index 65a54b9..69607c3 100644 --- a/.gitea/scripts/windows-native.sh +++ b/.gitea/scripts/windows-native.sh @@ -22,16 +22,17 @@ if command -v cygpath >/dev/null 2>&1; then # The runner gives every job a different workspace directory while build # artifacts embed absolute paths. Work through one stable junction per # run+variant so the build, test and package jobs share identical paths and - # artifacts can be reused instead of rebuilt. - stable_win="C:/vbs-ci/${GITHUB_RUN_ID:-local}/${variant}" + # artifacts can be reused instead of rebuilt. /tmp is the MSYS2 temp dir, + # which persists across the jobs of a run. + stable_win="$(cygpath -w "/tmp/vbs-ci/${GITHUB_RUN_ID:-local}/${variant}")" stable="$(cygpath -u "${stable_win}")" - if mkdir -p "$(dirname "${stable}")" 2>/dev/null; then - cmd //c "rmdir \"$(cygpath -w "${stable_win}")\"" >/dev/null 2>&1 || true - cmd //c "mklink /J \"$(cygpath -w "${stable_win}")\" \"$(cygpath -w "${workspace}")\"" \ - >/dev/null 2>&1 || true - if [ -d "${stable}" ]; then - workspace="${stable}" - fi + mkdir -p "$(dirname "${stable}")" + cmd //c "rmdir \"${stable_win}\"" >/dev/null 2>&1 || true + junction_output="$(cmd //c "mklink /J \"${stable_win}\" \"$(cygpath -w "${workspace}")\"" 2>&1 || true)" + if [ -d "${stable}" ]; then + workspace="${stable}" + else + echo "warning: cannot create the stable junction '${stable_win}': ${junction_output}" >&2 fi fi cd "${workspace}" diff --git a/tests/CoreEngineTests.cpp b/tests/CoreEngineTests.cpp index a4de526..ffb902a 100644 --- a/tests/CoreEngineTests.cpp +++ b/tests/CoreEngineTests.cpp @@ -81,8 +81,13 @@ VOID_TEST(CoreEngineTests, process_supervisor_exec_failure_and_early_leader_gran // 2. Program explicitly exiting 127 is NOT exec_failed. { Platform::ProcessRequest req; +#if defined(_WIN32) + req.executable = "cmd.exe"; + req.arguments = {"/c", "exit 127"}; +#else req.executable = "/bin/sh"; req.arguments = {"-c", "exit 127"}; +#endif auto res = Platform::run_supervised(req); Void::Testing::expect(res.has_value()); if (res) { @@ -92,8 +97,11 @@ VOID_TEST(CoreEngineTests, process_supervisor_exec_failure_and_early_leader_gran } } +#if !defined(_WIN32) // 3. Adversarial VL-001 test: leader spawns stubborn grandchild ignoring SIGTERM and exits // immediately; timeout escalates to SIGKILL and prevents grandchild from writing sentinel file. + // The POSIX process-group/signal semantics do not apply on Windows (job objects own the + // descendants instead). { Void::FileSystem::TempDir tmp{"vbs_proc_"}; const auto sentinel = tmp / "grandchild_escaped.txt"; @@ -136,6 +144,7 @@ VOID_TEST(CoreEngineTests, process_supervisor_exec_failure_and_early_leader_gran std::this_thread::sleep_for(std::chrono::milliseconds{300}); Void::Testing::expect(!std::filesystem::exists(sentinel)); } +#endif } VOID_TEST(CoreEngineTests, profile_inheritance_and_cycle_rejection) {