feat: add native Windows hierarchy test harness

This commit is contained in:
2026-09-09 16:48:54 +00:00
parent 8985457d37
commit 409b64a2fb
30 changed files with 1033 additions and 44 deletions
+11
View File
@@ -49,6 +49,17 @@ func TestAnnotatedExamples_HP_CFG_01(t *testing.T) {
}
}
func TestClientDefaultsDecodeForWindowsWithoutNativeFilesystem(t *testing.T) {
t.Parallel()
client, err := DecodeClient([]byte("[client]\nstate_dir = \"C:\\\\ProgramData\\\\RVBox\\\\state\"\ndaemon_cwd = \"C:\\\\ProgramData\\\\RVBox\\\\work\"\n"), ClientOptions{Platform: PlatformWindows, CheckFilesystem: false})
if err != nil {
t.Fatalf("DecodeClient Windows defaults: %v", err)
}
if client.Shells.SH != "/bin/sh" || client.Shells.CMD == "" {
t.Fatalf("Windows defaults have unexpected shell paths: %+v", client.Shells)
}
}
func TestStrictTOMLRejections_HP_CFG_01(t *testing.T) {
t.Parallel()
+6 -2
View File
@@ -3,6 +3,7 @@ package config
import (
"fmt"
"os"
"path"
"path/filepath"
"runtime"
"strings"
@@ -21,10 +22,13 @@ func validateAbsolutePath(name, value string, platform Platform, allowEmpty bool
}
return cleanWindowsPath(value), nil
}
if !filepath.IsAbs(value) {
// Config parsing can validate an inactive Unix shell path while running on
// Windows. filepath follows the host OS, whereas the config field's stated
// platform is Unix, so use slash-path semantics here.
if !path.IsAbs(value) {
return "", fmt.Errorf("%s must be an absolute Unix path", name)
}
return filepath.Clean(value), nil
return path.Clean(value), nil
}
func isWindowsAbsolute(value string) bool {