27 lines
701 B
Go
27 lines
701 B
Go
//go:build windows
|
|
|
|
package compose
|
|
|
|
import (
|
|
"golang.org/x/sys/windows"
|
|
"os/exec"
|
|
"testing"
|
|
)
|
|
|
|
func TestOwnedProcessUsesCreationTimeJobAttribute(t *testing.T) {
|
|
if procThreadAttributeJobList == 0 {
|
|
t.Fatal("owned Windows process must carry a creation-time job-list attribute")
|
|
}
|
|
cmd := exec.Command("cmd.exe")
|
|
configureOwnedProcess(cmd)
|
|
if cmd.SysProcAttr != nil && cmd.SysProcAttr.CreationFlags&windows.CREATE_SUSPENDED != 0 {
|
|
t.Fatal("owned Windows process must not rely on a post-start assignment race")
|
|
}
|
|
}
|
|
|
|
func TestOwnedJobPolicyKillsDescendantsOnClose(t *testing.T) {
|
|
if windows.JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE == 0 {
|
|
t.Fatal("owned job must use kill-on-close policy")
|
|
}
|
|
}
|