diff --git a/scripts/build_test.sh b/scripts/build_test.sh index 747cb8882449..cfff1a2fc9fd 100755 --- a/scripts/build_test.sh +++ b/scripts/build_test.sh @@ -9,12 +9,6 @@ source "$AVALANCHE_PATH"/scripts/constants.sh EXCLUDED_TARGETS="| grep -v /mocks | grep -v proto | grep -v tests/e2e | grep -v tests/upgrade" -GOOS=$(go env GOOS) -if [[ "$GOOS" == "windows" ]]; then - # tmpnet and antithesis tests (which depend on tmpnet) are not compatible with windows - EXCLUDED_TARGETS="${EXCLUDED_TARGETS} | grep -v tests/fixture | grep -v tests/antithesis" -fi - TEST_TARGETS="$(eval "go list ./... ${EXCLUDED_TARGETS}")" # shellcheck disable=SC2086 diff --git a/tests/fixture/tmpnet/detached_process_default.go b/tests/fixture/tmpnet/detached_process_default.go new file mode 100644 index 000000000000..0e4b20ddd8e3 --- /dev/null +++ b/tests/fixture/tmpnet/detached_process_default.go @@ -0,0 +1,17 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +//go:build linux || darwin + +package tmpnet + +import ( + "os/exec" + "syscall" +) + +func configureDetachedProcess(cmd *exec.Cmd) { + cmd.SysProcAttr = &syscall.SysProcAttr{ + Setsid: true, + } +} diff --git a/tests/fixture/tmpnet/detached_process_windows.go b/tests/fixture/tmpnet/detached_process_windows.go new file mode 100644 index 000000000000..bf7ff9a726b4 --- /dev/null +++ b/tests/fixture/tmpnet/detached_process_windows.go @@ -0,0 +1,12 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +//go:build windows + +package tmpnet + +import "os/exec" + +func configureDetachedProcess(*exec.Cmd) { + panic("tmpnet deployment to windows is not supported") +} diff --git a/tests/fixture/tmpnet/node_process.go b/tests/fixture/tmpnet/node_process.go index 4ce0997eb60f..f2a9c7ff628d 100644 --- a/tests/fixture/tmpnet/node_process.go +++ b/tests/fixture/tmpnet/node_process.go @@ -114,11 +114,8 @@ func (p *NodeProcess) Start(w io.Writer) error { // All arguments are provided in the flags file cmd := exec.Command(p.node.RuntimeConfig.AvalancheGoPath, "--config-file", p.node.getFlagsPath()) // #nosec G204 - // Ensure process is detached from the parent process so that an error in the parent will not affect the child - cmd.SysProcAttr = &syscall.SysProcAttr{ - Setsid: true, - } + configureDetachedProcess(cmd) if err := cmd.Start(); err != nil { return err