Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions docs/e2e.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,11 @@ host, so it cannot conflict with a vfox-managed toolchain.
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
Every combination runs 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.
[vfox#723](https://github.com/version-fox/vfox/issues/723). vfox handles such
paths since 1.0.13 ([vfox#712](https://github.com/version-fox/vfox/pull/712)),
so both `latest` and `main` carry the fix.

### x64

Expand Down
2 changes: 0 additions & 2 deletions docs/ohos.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ vfox search flutter
- **`linux-arm64` and `windows-arm64`.** Upstream publishes only x64 Dart SDKs, so the first
`flutter` run fails there (`It appears that the downloaded file is corrupt`).
The ARM64 e2e runs the official flavor only.
- **A Windows home containing a space** (`C:\Users\John Doe\.vfox`) is not supported;
point vfox at a path without spaces with `$env:VFOX_HOME = 'D:\vfox'`.
- **The first `flutter` command is slow.** It builds the tool and downloads the Dart SDK
from Huawei's OBS, so it needs a network connection.
- **No checksum is verified.** Git history is the integrity check, and this is a
Expand Down
6 changes: 3 additions & 3 deletions lib/git.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ 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
-- vfox 1.0.13 and newer pass 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
-- bare: vfox 1.0.12 and older 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
Expand Down
6 changes: 3 additions & 3 deletions lib/manifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ local function joinPath(a, b)
end

-- 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
-- vfox 1.0.13 and newer pass 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
-- bare: vfox 1.0.12 and older 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
Expand Down
6 changes: 3 additions & 3 deletions tests/e2e/windows/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +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. vfox main combos run against a
// VFOX_HOME containing a space (see vfoxHome).
// outputs carry the expected markers. Every combo runs against a VFOX_HOME
// containing a space (see spacedVfoxHome).
func runOne(t *testing.T, ctx context.Context, image, platform string, c common.Combo) {
t.Helper()
prefix := c.Prefix(platform)
Expand Down Expand Up @@ -186,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(), c.Vfox)
box := setupSlotEnv(ctx, t, ctr, c.Slug())
checkMirrorReachable(ctx, t, ctr, flavor, mirror)
setupVfox(ctx, t, ctr, box, c.Vfox)
checkBogusMirrorRejected(ctx, t, ctr, box, flavor, version)
Expand Down
18 changes: 6 additions & 12 deletions tests/e2e/windows/matrix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,12 @@ 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)
// The plugin double-quotes Windows paths only when they contain whitespace
// (lib/git.lua, lib/manifest.lua), so the e2e home must keep its space for
// every combo to exercise that branch.
func TestSpacedVfoxHome(t *testing.T) {
if !strings.Contains(spacedVfoxHome, " ") {
t.Errorf("spacedVfoxHome = %q, want a path containing a space", spacedVfoxHome)
}
}

Expand Down
24 changes: 8 additions & 16 deletions tests/e2e/windows/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,13 @@ const (

// 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 .
// https://github.com/version-fox/vfox/issues/723 . Every combo runs
// against it: vfox handles such paths since 1.0.13
// (https://github.com/version-fox/vfox/pull/712), so both latest and
// main carry the fix.
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, "'", "''") + "'"
Expand Down Expand Up @@ -96,15 +88,15 @@ type slotBox struct {

// setupSlotEnv replicates the slot isolation header of setup.ps1:
// USERPROFILE/TEMP/TMP point under vfox-e2e-runs\<slot>, 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 {
// spacedVfoxHome. Each combo runs in its own container, so combos sharing
// that path never share vfox state.
func setupSlotEnv(ctx context.Context, t *testing.T, ctr tc.Container, slot 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)
home := spacedVfoxHome
box := slotBox{slot: slot}
box.slotRoot = userProfile + `\vfox-e2e-runs\` + slot
box.tmp = box.slotRoot + `\tmp`
Expand Down
Loading