From 5e2cfda339c84710f86bf900c057b43a48a468be Mon Sep 17 00:00:00 2001 From: Qiheng He Date: Fri, 9 Oct 2026 23:46:57 +0800 Subject: [PATCH] test(e2e): run vfox main against a Windows home containing a space vfox main carries the fix for Windows homes containing a space (version-fox/vfox#712), so its combos now point VFOX_HOME at C:\Users\John Doe\.vfox, the layout from version-fox/vfox-flutter#33. Released builds still fail on such paths, so they keep the unspaced slot home. The plugin only double-quotes Windows paths when they contain whitespace: vfox main passes the command line to cmd.exe verbatim, so the quotes survive, while released builds still re-quote the line and mangle embedded double quotes. Also check the license headers of YAML, TOML, Dockerfiles and ignore files: SkyWalking Eyes already knows their comment style, so they no longer need to be excluded from paths-ignore. go.mod and .gitattributes get hand-written headers because the fixer knows no comment style for them, as does Dockerfile-runner (the fixer only matches the exact name `Dockerfile`). The two Windows Dockerfiles keep `# escape=` on line 1, so their headers sit right below it. go.sum stays ignored: the go tool parses every non-empty line as a hash record. --- .dockerignore | 14 +++++++++++++ .gitattributes | 14 +++++++++++++ .github/workflows/e2e.yml | 14 +++++++++++++ .github/workflows/license.yml | 14 +++++++++++++ .github/workflows/lint.yml | 14 +++++++++++++ .github/workflows/publish.yaml | 14 +++++++++++++ .github/workflows/test.yml | 14 +++++++++++++ .gitignore | 14 +++++++++++++ .licenserc.yaml | 19 ++++++++--------- docs/e2e.md | 7 +++++++ lib/git.lua | 9 ++++++++ lib/manifest.lua | 15 ++++++++------ stylua.toml | 14 +++++++++++++ tests/e2e/go.mod | 14 +++++++++++++ tests/e2e/linux/Dockerfile | 14 +++++++++++++ tests/e2e/linux/compose.yaml | 14 +++++++++++++ tests/e2e/windows/Dockerfile | 13 ++++++++++++ tests/e2e/windows/Dockerfile-runner | 14 +++++++++++++ tests/e2e/windows/compose.amd64.yaml | 14 +++++++++++++ tests/e2e/windows/compose.arm64.yaml | 14 +++++++++++++ tests/e2e/windows/e2e_test.go | 5 +++-- tests/e2e/windows/matrix_test.go | 16 ++++++++++++++ tests/e2e/windows/setup.go | 31 ++++++++++++++++++++++------ 23 files changed, 301 insertions(+), 24 deletions(-) diff --git a/.dockerignore b/.dockerignore index 22f56fa..2edef54 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,17 @@ +# Copyright 2026 Han Li and contributors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + .git .gitignore .idea diff --git a/.gitattributes b/.gitattributes index 6313b56..a873350 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,15 @@ +# Copyright 2026 Han Li and contributors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + * text=auto eol=lf diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index d03365c..e5c1b5c 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -1,3 +1,17 @@ +# Copyright 2026 Han Li and contributors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + name: E2E on: diff --git a/.github/workflows/license.yml b/.github/workflows/license.yml index 4f7b994..7051bdd 100644 --- a/.github/workflows/license.yml +++ b/.github/workflows/license.yml @@ -1,3 +1,17 @@ +# Copyright 2026 Han Li and contributors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + name: License on: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 53832dc..2362cf8 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,3 +1,17 @@ +# Copyright 2026 Han Li and contributors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + name: Lint on: diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index eaf361d..697fbac 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -1,3 +1,17 @@ +# Copyright 2026 Han Li and contributors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + name: Plugin on: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c07c460..665973d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,3 +1,17 @@ +# Copyright 2026 Han Li and contributors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + name: Test Plugin on: diff --git a/.gitignore b/.gitignore index 723ef36..c10ec14 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,15 @@ +# Copyright 2026 Han Li and contributors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + .idea \ No newline at end of file diff --git a/.licenserc.yaml b/.licenserc.yaml index 65178ae..3b47088 100644 --- a/.licenserc.yaml +++ b/.licenserc.yaml @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. # -# License header check (Apache SkyWalking Eyes): Go and Lua are both covered. +# License header check (Apache SkyWalking Eyes): Go, Lua, YAML, TOML, +# Dockerfiles, ignore files and similar text formats are covered. +# Some headers stay hand-written because `header fix` cannot place them: +# go.mod and .gitattributes have no comment style upstream, the Windows +# Dockerfiles must keep `# escape=` on line 1 (their headers sit right +# below it), and the fixer only recognises the exact name `Dockerfile`, +# not Dockerfile-runner. The checker still verifies them all. # PowerShell is check-only here (no `<# ... #>` fix support upstream): # tests/e2e/windows/*.ps1 is fixed and checked with addlicense instead (see # the addlicense step in .github/workflows/license.yml and docs/e2e.md). @@ -38,18 +44,11 @@ header: limitations under the License. paths-ignore: - # Documentation and data files carry no license header. + # Files without the header by design; go.sum cannot take one at all (the + # go tool parses every non-empty line as a hash record). - '**/*.md' - - '**/*.yaml' - - '**/*.yml' - '**/*.json' - - '**/*.toml' - - '**/go.mod' - '**/go.sum' - - '**/Dockerfile*' - - '.gitignore' - - '.gitattributes' - - '.dockerignore' - '.tool-versions' - 'LICENSE' # Plain-text template for addlicense (no comment markers in it; keep its diff --git a/docs/e2e.md b/docs/e2e.md index 695428c..13dff84 100644 --- a/docs/e2e.md +++ b/docs/e2e.md @@ -42,6 +42,13 @@ needs an ARM64 host (a Copilot+ PC or the `windows-11-arm` CI runner). The `windows-11-arm` runner has no Windows Hypervisor Platform feature, so Hyper-V isolation is unavailable; process isolation needs only the Containers feature. +The `main` combos run with `VFOX_HOME` pointing inside a path containing a +space (`C:\Users\John Doe\.vfox`), mirroring +[issue #33](https://github.com/version-fox/vfox-flutter/issues/33). Only vfox +`main` carries the fix for such paths +([vfox#712](https://github.com/version-fox/vfox/pull/712)), so `latest` +combinations still run with an unspaced home. + ### x64 1. Execute in Windows PowerShell 5.1, diff --git a/lib/git.lua b/lib/git.lua index 7a6b9f8..b461537 100644 --- a/lib/git.lua +++ b/lib/git.lua @@ -23,8 +23,17 @@ local GH_BASE = "https://github.com/" local M = {} +-- Quote a path for the platform shell. On Windows the shell is cmd.exe: +-- vfox main passes the command line through verbatim (the fix for +-- version-fox/vfox#712), so a path containing spaces (C:\Users\John +-- Doe\.vfox) is safe in double quotes. Paths that need no quoting stay +-- bare: released vfox builds re-quote the command line themselves and +-- mangle embedded double quotes, and they never supported spaces anyway. local function quote(value) if RUNTIME.osType == "windows" then + if value:find("%s") then + return '"' .. value .. '"' + end return value end return "'" .. value:gsub("'", "'\\''") .. "'" diff --git a/lib/manifest.lua b/lib/manifest.lua index fa50a15..31bee1c 100644 --- a/lib/manifest.lua +++ b/lib/manifest.lua @@ -27,14 +27,17 @@ local function joinPath(a, b) return a .. sep() .. b end --- vfox feeds command strings to cmd.exe /c on Windows. Go has to re-quote the --- whole command line, which turns a double quote into \" so cmd.exe reads a --- quoted path back as the volume-relative path \path\ and rejects it with --- "The filename, directory name, or volume label syntax is incorrect." Match --- lib/git.lua and pass paths unquoted there; a path with a space then simply --- skips the drift check instead of breaking vfox use. +-- Quote a path for the platform shell. On Windows the shell is cmd.exe: +-- vfox main passes the command line through verbatim (the fix for +-- version-fox/vfox#712), so a path containing spaces (C:\Users\John +-- Doe\.vfox) is safe in double quotes. Paths that need no quoting stay +-- bare: released vfox builds re-quote the command line themselves and +-- mangle embedded double quotes, and they never supported spaces anyway. local function quote(value) if RUNTIME.osType == "windows" then + if value:find("%s") then + return '"' .. value .. '"' + end return value end return "'" .. value:gsub("'", "'\\''") .. "'" diff --git a/stylua.toml b/stylua.toml index c537618..254403c 100644 --- a/stylua.toml +++ b/stylua.toml @@ -1,3 +1,17 @@ +# Copyright 2026 Han Li and contributors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + column_width = 120 line_endings = "Unix" indent_type = "Spaces" diff --git a/tests/e2e/go.mod b/tests/e2e/go.mod index d0a0af5..2c9de9b 100644 --- a/tests/e2e/go.mod +++ b/tests/e2e/go.mod @@ -1,3 +1,17 @@ +// Copyright 2026 Han Li and contributors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + module github.com/version-fox/vfox-flutter/tests/e2e go 1.25.0 diff --git a/tests/e2e/linux/Dockerfile b/tests/e2e/linux/Dockerfile index ac6e013..f9b8e15 100644 --- a/tests/e2e/linux/Dockerfile +++ b/tests/e2e/linux/Dockerfile @@ -1,3 +1,17 @@ +# Copyright 2026 Han Li and contributors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + FROM ubuntu:26.04 ENV DEBIAN_FRONTEND=noninteractive diff --git a/tests/e2e/linux/compose.yaml b/tests/e2e/linux/compose.yaml index 40f12ab..93819f0 100644 --- a/tests/e2e/linux/compose.yaml +++ b/tests/e2e/linux/compose.yaml @@ -1,3 +1,17 @@ +# Copyright 2026 Han Li and contributors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # Host-side runner for the Linux container E2E suite (see docs/e2e.md). # # docker compose -f tests/e2e/linux/compose.yaml run --rm e2e diff --git a/tests/e2e/windows/Dockerfile b/tests/e2e/windows/Dockerfile index 7168d49..1452dc3 100644 --- a/tests/e2e/windows/Dockerfile +++ b/tests/e2e/windows/Dockerfile @@ -1,4 +1,17 @@ # escape=` +# Copyright 2026 Han Li and contributors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. ARG BASE_IMAGE=mcr.microsoft.com/windows/servercore:ltsc2025-KB5122871-amd64 FROM ${BASE_IMAGE} diff --git a/tests/e2e/windows/Dockerfile-runner b/tests/e2e/windows/Dockerfile-runner index 9c8e63d..743cd6e 100644 --- a/tests/e2e/windows/Dockerfile-runner +++ b/tests/e2e/windows/Dockerfile-runner @@ -1,4 +1,18 @@ # escape=` +# Copyright 2026 Han Li and contributors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # Runner image for the Windows container E2E suite: stock servercore plus the # pinned Go toolchain, so no host Go is needed on any arch. (There is no # stock golang Windows image for arm64, hence this file instead of pinning diff --git a/tests/e2e/windows/compose.amd64.yaml b/tests/e2e/windows/compose.amd64.yaml index b77e47f..d1136aa 100644 --- a/tests/e2e/windows/compose.amd64.yaml +++ b/tests/e2e/windows/compose.amd64.yaml @@ -1,3 +1,17 @@ +# Copyright 2026 Han Li and contributors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # Host-side runner for the Windows container E2E suite on amd64 hosts # (see docs/e2e.md). # diff --git a/tests/e2e/windows/compose.arm64.yaml b/tests/e2e/windows/compose.arm64.yaml index d79c5b0..400451c 100644 --- a/tests/e2e/windows/compose.arm64.yaml +++ b/tests/e2e/windows/compose.arm64.yaml @@ -1,3 +1,17 @@ +# Copyright 2026 Han Li and contributors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # Host-side runner for the Windows container E2E suite on arm64 hosts # (see docs/e2e.md). # diff --git a/tests/e2e/windows/e2e_test.go b/tests/e2e/windows/e2e_test.go index a4e3f0a..9f1429e 100644 --- a/tests/e2e/windows/e2e_test.go +++ b/tests/e2e/windows/e2e_test.go @@ -132,7 +132,8 @@ func buildImage(t *testing.T, ctx context.Context, repoRoot, image, platform, ba // runOne starts one long-lived container per combo and drives the whole // E2E flow (setup -> preflight -> install -> verify) through pwsh exec // calls, asserting in Go. A combo passes when every phase exits 0 and the -// outputs carry the expected markers. +// outputs carry the expected markers. vfox main combos run against a +// VFOX_HOME containing a space (see vfoxHome). func runOne(t *testing.T, ctx context.Context, image, platform string, c common.Combo) { t.Helper() prefix := c.Prefix(platform) @@ -185,7 +186,7 @@ func runOne(t *testing.T, ctx context.Context, image, platform string, c common. procArch := procArchOfContainer(ctx, t, ctr) t.Logf("=== vfox %s, flutter %s, %s, mirror %s, %s ===", c.Vfox, version, flavor, mirror, procArch) - box := setupSlotEnv(ctx, t, ctr, c.Slug()) + box := setupSlotEnv(ctx, t, ctr, c.Slug(), c.Vfox) checkMirrorReachable(ctx, t, ctr, flavor, mirror) setupVfox(ctx, t, ctr, box, c.Vfox) checkBogusMirrorRejected(ctx, t, ctr, box, flavor, version) diff --git a/tests/e2e/windows/matrix_test.go b/tests/e2e/windows/matrix_test.go index 857c144..5a40cf2 100644 --- a/tests/e2e/windows/matrix_test.go +++ b/tests/e2e/windows/matrix_test.go @@ -15,6 +15,7 @@ package windows import ( + "strings" "testing" ) @@ -38,6 +39,21 @@ func TestReleasesIndex(t *testing.T) { } } +func TestVfoxHome(t *testing.T) { + profile := `C:\Users\ContainerAdministrator` + if got, want := vfoxHome(profile, "latest-official-default", "latest"), + `C:\Users\ContainerAdministrator\vfox-e2e-runs\latest-official-default\.vfox`; got != want { + t.Errorf("vfoxHome(latest) = %q, want %q", got, want) + } + got := vfoxHome(profile, "main-official-default", "main") + if got != spacedVfoxHome { + t.Errorf("vfoxHome(main) = %q, want %q", got, spacedVfoxHome) + } + if !strings.Contains(got, " ") { + t.Errorf("vfoxHome(main) = %q, want a path containing a space", got) + } +} + func TestPwshQuote(t *testing.T) { if got := pwshQuote(`C:\a\b`); got != `'C:\a\b'` { t.Errorf("pwshQuote = %q", got) diff --git a/tests/e2e/windows/setup.go b/tests/e2e/windows/setup.go index bfe62d9..e5ff48f 100644 --- a/tests/e2e/windows/setup.go +++ b/tests/e2e/windows/setup.go @@ -32,8 +32,24 @@ const ( // goWindowsVersion pins the Go toolchain MSI used to build vfox@main // inside the container (was setup.ps1). goWindowsVersion = "1.27.1" + + // spacedVfoxHome is the default vfox home of a Windows account whose + // name contains a space, the layout reported in + // https://github.com/version-fox/vfox-flutter/issues/33 . + spacedVfoxHome = `C:\Users\John Doe\.vfox` ) +// vfoxHome returns the $VFOX_HOME for a combo. The fix for Windows homes +// containing a space (https://github.com/version-fox/vfox/pull/712) is on +// vfox main only: released builds still fail on such paths, so only main +// runs against spacedVfoxHome while the others keep an unspaced slot home. +func vfoxHome(userProfile, slot, vfoxVersion string) string { + if vfoxVersion == "main" { + return spacedVfoxHome + } + return userProfile + `\vfox-e2e-runs\` + slot + `\.vfox` +} + // pwshQuote renders a single-quoted PowerShell string literal. func pwshQuote(s string) string { return "'" + strings.ReplaceAll(s, "'", "''") + "'" @@ -79,14 +95,16 @@ type slotBox struct { } // setupSlotEnv replicates the slot isolation header of setup.ps1: -// USERPROFILE/VFOX_HOME/TEMP/TMP point under vfox-e2e-runs\ so -// parallel combos on one daemon never share vfox state. -func setupSlotEnv(ctx context.Context, t *testing.T, ctr tc.Container, slot string) slotBox { +// USERPROFILE/TEMP/TMP point under vfox-e2e-runs\, while VFOX_HOME is +// a sibling .vfox (spacedVfoxHome for main), so parallel combos on one +// daemon never share vfox state. +func setupSlotEnv(ctx context.Context, t *testing.T, ctr tc.Container, slot, vfoxVersion string) slotBox { t.Helper() userProfile := strings.TrimSpace(execOK(ctx, t, ctr, "$env:USERPROFILE")) containerPath := strings.TrimSpace(execOK(ctx, t, ctr, "$env:PATH")) procArch := strings.TrimSpace(execOK(ctx, t, ctr, "$env:PROCESSOR_ARCHITECTURE")) + home := vfoxHome(userProfile, slot, vfoxVersion) box := slotBox{slot: slot} box.slotRoot = userProfile + `\vfox-e2e-runs\` + slot box.tmp = box.slotRoot + `\tmp` @@ -95,7 +113,7 @@ func setupSlotEnv(ctx context.Context, t *testing.T, ctr tc.Container, slot stri box.pluginZw = box.workDir + `\flutter.zip` box.vars = []string{ "USERPROFILE=" + box.slotRoot, - "VFOX_HOME=" + box.slotRoot + `\.vfox`, + "VFOX_HOME=" + home, "TEMP=" + box.tmp, "TMP=" + box.tmp, "PATH=" + box.workDir + ";" + containerPath, @@ -103,9 +121,10 @@ func setupSlotEnv(ctx context.Context, t *testing.T, ctr tc.Container, slot stri execOK(ctx, t, ctr, fmt.Sprintf( "New-Item -ItemType Directory -Force -Path %s | Out-Null; "+ + "New-Item -ItemType Directory -Force -Path %s | Out-Null; "+ "New-Item -ItemType Directory -Force -Path %s | Out-Null", - pwshQuote(box.tmp), pwshQuote(box.workDir))) - t.Logf("PASS slot %s isolated at %s (arch %s)", slot, box.slotRoot, procArch) + pwshQuote(box.tmp), pwshQuote(box.workDir), pwshQuote(home))) + t.Logf("PASS slot %s isolated at %s (vfox home %s, arch %s)", slot, box.slotRoot, home, procArch) return box }