Skip to content

Commit f547d88

Browse files
thymikeeclaude
andcommitted
test(host): give the provider scenario host the process's Swift cache directory
The daemon's host snapshots the environment when it starts, so a scenario that isolates the Swift cache or its PATH sets them before the harness is created. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
1 parent f653971 commit f547d88

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

‎test/integration/provider-scenarios/harness.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ export async function createProviderScenarioHarness(
109109
PATH: process.env.PATH,
110110
HOME: process.env.HOME,
111111
TMPDIR: process.env.TMPDIR,
112+
// A scenario that isolates the Swift helper cache names it through the process.
113+
AGENT_DEVICE_SWIFT_CACHE_DIR: process.env.AGENT_DEVICE_SWIFT_CACHE_DIR,
112114
AGENT_DEVICE_STATE_DIR: stateDir,
113115
// A scenario that seeds claims for its daemon names the directory through the process.
114116
AGENT_DEVICE_CLAIMS_DIR: process.env.AGENT_DEVICE_CLAIMS_DIR ?? path.join(testRoot, 'claims'),

‎test/integration/provider-scenarios/ios-record-trace.test.ts‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,18 @@ test('iOS simulator recording reports host contention and recovers through the f
104104
});
105105
},
106106
};
107+
// The daemon's host snapshots the process environment when it starts, so the scenario's
108+
// PATH without Xcode tools and its private Swift cache are set first.
109+
const previousPath = process.env.PATH;
110+
const previousSwiftCacheDir = process.env.AGENT_DEVICE_SWIFT_CACHE_DIR;
111+
process.env.PATH = tmpDir;
112+
process.env.AGENT_DEVICE_SWIFT_CACHE_DIR = path.join(tmpDir, 'swift-cache');
107113
const daemon = await createProviderScenarioHarness({
108114
appleRunnerProvider: () => appleRunnerProvider,
109115
appleToolProvider: () => appleTool.provider,
110116
appleSimulatorScreenRecordingTransport: () => recordingTransport,
111117
deviceInventoryProvider: async () => [PROVIDER_SCENARIO_IOS_SIMULATOR],
112118
});
113-
const previousPath = process.env.PATH;
114-
const previousSwiftCacheDir = process.env.AGENT_DEVICE_SWIFT_CACHE_DIR;
115-
process.env.PATH = tmpDir;
116-
process.env.AGENT_DEVICE_SWIFT_CACHE_DIR = path.join(tmpDir, 'swift-cache');
117-
118119
try {
119120
const open = await daemon.callCommand('open', ['com.apple.Preferences'], {
120121
platform: 'ios',

0 commit comments

Comments
 (0)