Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

test: make windows suite portable

Luigi Agosti1dc95967fb02
diff --git a/cmd/pinchtab/cmd_daemon_test.go b/cmd/pinchtab/cmd_daemon_test.go
index 43a91641..86a94580 100644
--- a/cmd/pinchtab/cmd_daemon_test.go
+++ b/cmd/pinchtab/cmd_daemon_test.go
@@ -4,6 +4,7 @@ import (
"encoding/json"
"errors"
"os"
+ "runtime"
"strings"
"testing"
@@ -232,6 +233,14 @@ func TestPrintDaemonOverviewIncludesStatusAndHints(t *testing.T) {
output := captureStdout(t, func() {
printDaemonOverview()
})
+ if runtime.GOOS == "windows" {
+ for _, needle := range []string{"Daemon", "supported on macOS and Linux", "current OS is windows"} {
+ if !strings.Contains(output, needle) {
+ t.Fatalf("expected output to contain %q\n%s", needle, output)
+ }
+ }
+ return
+ }
for _, needle := range []string{
"Daemon",
diff --git a/internal/bridge/action_resolve_modal_test.go b/internal/bridge/action_resolve_modal_test.go
index 3789179a..021a4e40 100644
--- a/internal/bridge/action_resolve_modal_test.go
+++ b/internal/bridge/action_resolve_modal_test.go
@@ -5,6 +5,7 @@ import (
"encoding/base64"
"errors"
"os"
+ "runtime"
"strings"
"testing"
"time"
@@ -203,6 +204,9 @@ func TestTopmostModalUsesBrowserPaintOrderAndRejectsFalseOwners(t *testing.T) {
}
t.Run("native top layer follows showModal order", func(t *testing.T) {
+ if runtime.GOOS == "windows" {
+ t.Skip("Windows Chrome does not expose a stable backend node for the native top layer")
+ }
navigate(`<style>dialog { width:300px; height:180px; padding:0 }</style>
<dialog id="first">first</dialog><dialog id="second">second</dialog>
<script>second.showModal(); first.showModal();</script>`)
diff --git a/internal/bridge/profile_lock_test.go b/internal/bridge/profile_lock_test.go
index 7b3dd793..3cc2faa2 100644
--- a/internal/bridge/profile_lock_test.go
+++ b/internal/bridge/profile_lock_test.go
@@ -4,6 +4,7 @@ import (
"os"
"path/filepath"
"reflect"
+ "runtime"
"strings"
"testing"
"time"
@@ -359,7 +360,7 @@ func TestQuarantineCorruptedProfile_WaitsForBrowserExit(t *testing.T) {
if err != nil {
t.Fatalf("recreated profile dir missing: %v", err)
}
- if perm := info.Mode().Perm(); perm != 0o700 {
+ if perm := info.Mode().Perm(); runtime.GOOS != "windows" && perm != 0o700 {
t.Fatalf("recreated profile dir perms = %o, want 0700", perm)
}
}
diff --git a/internal/bridgeregistry/registry_test.go b/internal/bridgeregistry/registry_test.go
index e52d5ec3..ed61f9d2 100644
--- a/internal/bridgeregistry/registry_test.go
+++ b/internal/bridgeregistry/registry_test.go
@@ -5,6 +5,7 @@ import (
"net"
"os"
"path/filepath"
+ "runtime"
"strconv"
"strings"
"testing"
@@ -52,7 +53,7 @@ func TestRegisterListAndClose(t *testing.T) {
if err != nil {
t.Fatal(err)
}
- if got := dirInfo.Mode().Perm(); got != 0o700 {
+ if got := dirInfo.Mode().Perm(); runtime.GOOS != "windows" && got != 0o700 {
t.Fatalf("registry mode = %o, want 700", got)
}
entries, err := os.ReadDir(filepath.Join(stateDir, registryDir))
@@ -66,7 +67,7 @@ func TestRegisterListAndClose(t *testing.T) {
if err != nil {
t.Fatal(err)
}
- if got := fileInfo.Mode().Perm(); got != 0o600 {
+ if got := fileInfo.Mode().Perm(); runtime.GOOS != "windows" && got != 0o600 {
t.Fatalf("record mode = %o, want 600", got)
}
diff --git a/internal/daemon/launchd_test.go b/internal/daemon/launchd_test.go
index 884575b6..8261f0b2 100644
--- a/internal/daemon/launchd_test.go
+++ b/internal/daemon/launchd_test.go
@@ -4,6 +4,7 @@ import (
"errors"
"os"
"path/filepath"
+ "runtime"
"strings"
"testing"
)
@@ -94,6 +95,9 @@ func TestLaunchdManagerPreflightRequiresGUIDomain(t *testing.T) {
}
func TestLaunchdManagerLogsFallsBackToLegacyPath(t *testing.T) {
+ if runtime.GOOS == "windows" {
+ t.Skip("launchd legacy log paths are Unix-only")
+ }
root := t.TempDir()
legacyLogPath := "/tmp/pinchtab.err.log"
legacyContent, legacyErr := os.ReadFile(legacyLogPath)
diff --git a/internal/mcp/handlers_record_test.go b/internal/mcp/handlers_record_test.go
index 11c8512f..71d43eb5 100644
--- a/internal/mcp/handlers_record_test.go
+++ b/internal/mcp/handlers_record_test.go
@@ -23,7 +23,7 @@ func TestSafeRecordPath_RejectsRelativePath(t *testing.T) {
}
func TestSafeRecordPath_RejectsBadExtension(t *testing.T) {
- _, err := safeRecordPath("/tmp/output.txt")
+ _, err := safeRecordPath(filepath.Join(t.TempDir(), "output.txt"))
if err == nil || !strings.Contains(err.Error(), "unsupported extension") {
t.Fatalf("expected extension error, got %v", err)
}
diff --git a/internal/profiles/profiles_test.go b/internal/profiles/profiles_test.go
index 0243f644..45eb8efc 100644
--- a/internal/profiles/profiles_test.go
+++ b/internal/profiles/profiles_test.go
@@ -91,16 +91,19 @@ func TestProfileManagerImportNormalizesSourcePath(t *testing.T) {
dir := t.TempDir()
pm := NewProfileManager(dir)
- srcRoot := t.TempDir()
+ srcRoot, err := filepath.EvalSymlinks(t.TempDir())
+ if err != nil {
+ t.Fatal(err)
+ }
+ t.Setenv("HOME", srcRoot)
+ t.Setenv("USERPROFILE", srcRoot)
src := filepath.Join(srcRoot, "chrome-src")
_ = os.MkdirAll(filepath.Join(src, "Default"), 0755)
_ = os.WriteFile(filepath.Join(src, "Default", "Preferences"), []byte(`{}`), 0644)
- cwd, err := os.Getwd()
- if err != nil {
- t.Fatal(err)
- }
- relSource, err := filepath.Rel(cwd, src)
+ t.Chdir(srcRoot)
+ relSource := "chrome-src"
+ normalizedSource, err := filepath.Abs(relSource)
if err != nil {
t.Fatal(err)
}
@@ -113,7 +116,7 @@ func TestProfileManagerImportNormalizesSourcePath(t *testing.T) {
if err != nil {
t.Fatal(err)
}
- if got, want := string(importMarker), filepath.Clean(src); got != want {
+ if got, want := string(importMarker), filepath.Clean(normalizedSource); got != want {
t.Fatalf("expected normalized source %q, got %q", want, got)
}
}
@@ -1241,6 +1244,9 @@ func TestResolutionByNameAndIDIgnoresADirectoryClaimingAnotherProfile(t *testing
// the rename fails it must put the old name back, or the directory is left
// claiming a profile it is not — which is the state this fix stops trusting.
func TestProfileRenameRollsBackMetadataWhenTheDirectoryRenameFails(t *testing.T) {
+ if runtime.GOOS == "windows" {
+ t.Skip("Windows chmod does not make a directory rename fail")
+ }
base := t.TempDir()
pm := NewProfileManager(base)
if err := pm.Create("old-name"); err != nil {
diff --git a/tests/tools/runner/internal/bench/loop_test.go b/tests/tools/runner/internal/bench/loop_test.go
index 09372fa2..f8cb0936 100644
--- a/tests/tools/runner/internal/bench/loop_test.go
+++ b/tests/tools/runner/internal/bench/loop_test.go
@@ -10,6 +10,7 @@ import (
)
func TestLoopWithFakeRunner(t *testing.T) {
+ requireUnixShell(t)
dir := t.TempDir()
reportFile := filepath.Join(dir, "report.json")
commandLog := filepath.Join(dir, "commands.ndjson")
@@ -82,6 +83,7 @@ func TestLoopWithFakeRunner(t *testing.T) {
}
func TestLoopIdleTurnLimit(t *testing.T) {
+ requireUnixShell(t)
dir := t.TempDir()
reportFile := filepath.Join(dir, "report.json")
commandLog := filepath.Join(dir, "commands.ndjson")
@@ -131,6 +133,7 @@ func TestLoopIdleTurnLimit(t *testing.T) {
}
func TestLoopMaxTurns(t *testing.T) {
+ requireUnixShell(t)
dir := t.TempDir()
reportFile := filepath.Join(dir, "report.json")
@@ -202,6 +205,7 @@ func TestAppendCommandLog(t *testing.T) {
}
func TestLoopBudgetLimit(t *testing.T) {
+ requireUnixShell(t)
dir := t.TempDir()
reportFile := filepath.Join(dir, "report.json")
diff --git a/tests/tools/runner/internal/bench/prompt_test.go b/tests/tools/runner/internal/bench/prompt_test.go
index 6e3123bc..0eb1cc09 100644
--- a/tests/tools/runner/internal/bench/prompt_test.go
+++ b/tests/tools/runner/internal/bench/prompt_test.go
@@ -98,7 +98,7 @@ func TestLaneUserPromptStructure(t *testing.T) {
func TestBenchmarkRunGroupFile(t *testing.T) {
got := BenchmarkRunGroupFile("/dir", 5)
- want := "/dir/group-05.md"
+ want := filepath.Join("/dir", "group-05.md")
if got != want {
t.Errorf("got %q; want %q", got, want)
}
diff --git a/tests/tools/runner/internal/bench/shell_test.go b/tests/tools/runner/internal/bench/shell_test.go
index 5fd81265..1d3f3a29 100644
--- a/tests/tools/runner/internal/bench/shell_test.go
+++ b/tests/tools/runner/internal/bench/shell_test.go
@@ -1,12 +1,21 @@
package bench
import (
+ "runtime"
"strings"
"testing"
"time"
)
+func requireUnixShell(t *testing.T) {
+ t.Helper()
+ if runtime.GOOS == "windows" {
+ t.Skip("persistent shell benchmark tests require /bin/bash")
+ }
+}
+
func TestShellEcho(t *testing.T) {
+ requireUnixShell(t)
ps, err := NewPersistentShell(t.TempDir())
if err != nil {
t.Fatal(err)
@@ -26,6 +35,7 @@ func TestShellEcho(t *testing.T) {
}
func TestShellNonZeroExit(t *testing.T) {
+ requireUnixShell(t)
ps, err := NewPersistentShell(t.TempDir())
if err != nil {
t.Fatal(err)
@@ -45,6 +55,7 @@ func TestShellNonZeroExit(t *testing.T) {
}
func TestShellTimeout(t *testing.T) {
+ requireUnixShell(t)
ps, err := NewPersistentShell(t.TempDir())
if err != nil {
t.Fatal(err)
@@ -61,6 +72,7 @@ func TestShellTimeout(t *testing.T) {
}
func TestShellEnvPersistence(t *testing.T) {
+ requireUnixShell(t)
ps, err := NewPersistentShell(t.TempDir())
if err != nil {
t.Fatal(err)
@@ -88,6 +100,7 @@ func TestShellEnvPersistence(t *testing.T) {
}
func TestShellLargeOutput(t *testing.T) {
+ requireUnixShell(t)
ps, err := NewPersistentShell(t.TempDir())
if err != nil {
t.Fatal(err)
@@ -137,6 +150,7 @@ func TestFormatToolResult(t *testing.T) {
}
func TestShellAutoReset(t *testing.T) {
+ requireUnixShell(t)
ps, err := NewPersistentShell(t.TempDir())
if err != nil {
t.Fatal(err)
diff --git a/tests/tools/runner/internal/e2e/dockerimage_test.go b/tests/tools/runner/internal/e2e/dockerimage_test.go
index cbb9244b..09d65e61 100644
--- a/tests/tools/runner/internal/e2e/dockerimage_test.go
+++ b/tests/tools/runner/internal/e2e/dockerimage_test.go
@@ -287,6 +287,9 @@ func TestDockerSmokeRunNamesEachImageAndWhy(t *testing.T) {
// the image changes, the tag does not, and a stale one is reused.
func TestBuildInputDigestCoversModeAndSymlinkTargets(t *testing.T) {
t.Run("chmod +x on a context file changes the digest", func(t *testing.T) {
+ if runtime.GOOS == "windows" {
+ t.Skip("Windows does not expose Unix executable mode bits")
+ }
root := writeProbeContext(t)
before := digestOf(t, root, probeSpec)
diff --git a/tests/tools/runner/internal/e2e/e2e_test.go b/tests/tools/runner/internal/e2e/e2e_test.go
index 47016d35..94d86763 100644
--- a/tests/tools/runner/internal/e2e/e2e_test.go
+++ b/tests/tools/runner/internal/e2e/e2e_test.go
@@ -9,6 +9,7 @@ import (
"net/http/httptest"
"os"
"path/filepath"
+ "runtime"
"strings"
"testing"
"time"
@@ -501,6 +502,9 @@ func TestWriteGitHubActionsMetadataAddsRunnerFailureWithoutSuiteResults(t *testi
}
func TestBuildSharedStackRetriesNoCacheOnBuildKitSnapshotFailure(t *testing.T) {
+ if runtime.GOOS == "windows" {
+ t.Skip("compose retry test uses a POSIX shell script stub")
+ }
tmp := t.TempDir()
callsPath := filepath.Join(tmp, "calls.txt")
scriptPath := filepath.Join(tmp, "compose.sh")
@@ -553,6 +557,9 @@ exit 0
}
func TestBuildSharedStackDoesNotRetryNonCacheFailure(t *testing.T) {
+ if runtime.GOOS == "windows" {
+ t.Skip("compose retry test uses a POSIX shell script stub")
+ }
tmp := t.TempDir()
callsPath := filepath.Join(tmp, "calls.txt")
scriptPath := filepath.Join(tmp, "compose.sh")
@@ -1258,6 +1265,9 @@ exit 0
}
func TestLaneFailsOnSuiteRegisteredOnlyInDefs(t *testing.T) {
+ if runtime.GOOS == "windows" {
+ t.Skip("synthetic lane runner uses POSIX shell stubs")
+ }
cases := []struct {
lane lane
extended bool
@@ -1297,6 +1307,9 @@ func TestLaneFailsOnSuiteRegisteredOnlyInDefs(t *testing.T) {
}
func TestLanePassesWhenEverySuiteSucceeds(t *testing.T) {
+ if runtime.GOOS == "windows" {
+ t.Skip("synthetic lane runner uses POSIX shell stubs")
+ }
var stdout, stderr bytes.Buffer
r := newSyntheticLaneRunner(t, newSyntheticLaneRepo(t), 0, &stdout, &stderr)
diff --git a/tests/tools/runner/internal/e2e/provider_test.go b/tests/tools/runner/internal/e2e/provider_test.go
index eb1b2597..01c52e15 100644
--- a/tests/tools/runner/internal/e2e/provider_test.go
+++ b/tests/tools/runner/internal/e2e/provider_test.go
@@ -4,6 +4,7 @@ import (
"bytes"
"os"
"path/filepath"
+ "runtime"
"strings"
"testing"
)
@@ -124,6 +125,9 @@ func TestWriteProviderComposeOverrideFailsOnMissingConfig(t *testing.T) {
}
func TestEnsureCloakImageBuildsByDefault(t *testing.T) {
+ if runtime.GOOS == "windows" {
+ t.Skip("fake Docker executable is a POSIX shell script")
+ }
tmp := t.TempDir()
logPath := filepath.Join(tmp, "docker.log")
fakeDocker := filepath.Join(tmp, "docker")