mirror of
https://gitea.com/gitea/runner.git
synced 2026-11-04 06:25:32 +00:00
Adds a weekly and on-demand workflow that runs the cross-compiled tests on Windows Server 2025 Core in a [dockur/windows](https://github.com/dockur/windows) QEMU VM, and fixes the Windows bugs it found in host and UNC paths, env handling, shell quoting, post-task scripts, health checks, checkout, action symlinks, step summaries, Git client certificates and docker mode from a Windows host. Host-mode steps now emit UTF-8, `bash` falls back to Git's bash instead of the WSL launcher, the runner can run as a native Windows service, steps can keep background helpers with `RUNNER_TRACKING_ID`, and Windows arm64 binaries are released. Fixes: https://gitea.com/gitea/runner/issues/1339 Fixes: https://gitea.com/gitea/runner/issues/637 Fixes: https://gitea.com/gitea/runner/issues/1172 Fixes: https://gitea.com/gitea/runner/issues/347 Reviewed-on: https://gitea.com/gitea/runner/pulls/1348 Reviewed-by: bircni <[email protected]>
48 lines
1.1 KiB
Go
48 lines
1.1 KiB
Go
// Copyright 2026 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package process
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
"golang.org/x/sys/windows"
|
|
)
|
|
|
|
func processAlive(pid int) bool {
|
|
h, err := windows.OpenProcess(windows.PROCESS_QUERY_LIMITED_INFORMATION, false, uint32(pid))
|
|
if err != nil {
|
|
return false
|
|
}
|
|
defer func() { _ = windows.CloseHandle(h) }()
|
|
var code uint32
|
|
if err := windows.GetExitCodeProcess(h, &code); err != nil {
|
|
return false
|
|
}
|
|
const stillActive = 259
|
|
return code == stillActive
|
|
}
|
|
|
|
func TestKillerKillsTree(t *testing.T) {
|
|
cmd, ready := newTestProcess(t, "parent", false)
|
|
require.NoError(t, cmd.Start())
|
|
|
|
killer, err := NewKiller(cmd.Process)
|
|
require.NoError(t, err)
|
|
t.Cleanup(func() {
|
|
_ = killer.Kill()
|
|
_ = killer.Close()
|
|
})
|
|
|
|
childPID := ready()
|
|
require.True(t, processAlive(childPID), "child process should start")
|
|
|
|
require.NoError(t, killer.Kill())
|
|
|
|
require.Eventually(t, func() bool {
|
|
return !processAlive(cmd.Process.Pid) && !processAlive(childPID)
|
|
}, 20*time.Second, 200*time.Millisecond, "parent and child should both be terminated")
|
|
}
|