Skip to content

Commit 622dfcd

Browse files
committed
Keep native platform in Interactive process tests
1 parent fa5b7fa commit 622dfcd

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

‎docs/r-interactive-live-testing.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,3 +165,5 @@ Local macOS validation passed 99 backend/runtime tests, 47 arf tests, 106 editor
165165
The repeatable `src/test/examples/runtime-lifecycle.cjs` fixture launched a session from the actual VS Code 1.110.0 extension host with no standalone Node on PATH, exited the full application, and verified that R remained reachable. VS Code 1.140.0 then reconnected to the same R PID and retained object, and launched a second session using its own extension-host executable. Both sessions survived application exit, and R did not inherit `ELECTRON_RUN_AS_NODE`.
166166

167167
This checks quit/reopen and switching editor versions on macOS. It does not exercise the editor's updater or establish that every OS/update mechanism preserves running agents. New launches resolve the current host each time; a removed runtime reports a reload/repair instruction, and reconnection to a live agent does not need to relaunch its executable. Linux supervisor coverage remains in CI; the local supervisor fixtures verify propagation of the Electron flag through both command forms.
168+
169+
The first CI run passed build, lint, Windows, and Linux (including real tmux persistence), but macOS exposed a test-only platform override. Simulating Linux by changing `process.platform` made bundled Node call a Linux-only crashdump binding on macOS. The process tests now retain the real platform and verify automatic detached supervision on each OS; Linux-only fallback notices are asserted only on Linux. Supervisor command tests also avoid changing Node's global platform. All 13 affected checks passed inside the actual macOS VS Code 1.140.0 runtime after this correction.

‎src/test/suite/interactiveRuntime.test.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,8 @@ ggplot(diamonds, aes(x = carat, y = price, color = cut)) +
784784
});
785785

786786
for (const supervision of ['detached', 'auto']) {
787-
test(`${supervision === 'auto' ? 'Linux auto without tmux' : 'Detached'} session leaves the editor process tree and retains objects after its termination`, async () => {
787+
const label = supervision === 'auto' ? `${process.platform === 'linux' ? 'Linux' : 'Desktop'} auto without tmux` : 'Detached';
788+
test(`${label} session leaves the editor process tree and retains objects after its termination`, async () => {
788789
const runtime = hostNodeRuntime();
789790
const node = runtime.executable;
790791
const rPath = resolveExecutable('R', root); assert.ok(rPath);
@@ -806,7 +807,6 @@ ggplot(diamonds, aes(x = carat, y = price, color = cut)) +
806807
provider: process.env.VSCR_TEST_PROVIDER === 'arf' ? 'arf' : 'r', arfPath,
807808
supervision, plotBackend: 'standard', historyLimit: 50, maxOutputBytes: 1048576, maxJournalBytes: 16777216 };
808809
const script = `const {launchAgent} = require(${JSON.stringify(require.resolve('../../interactive/launcher'))});
809-
${supervision === 'auto' ? 'Object.defineProperty(process, \'platform\', { value: \'linux\' });' : ''}
810810
process.env.VSCODE_INSPECTOR_OPTIONS = '{}';
811811
process.env.NODE_OPTIONS = '--require /missing/vscode-debug-bootloader.js';
812812
launchAgent(${JSON.stringify(config)}, ${JSON.stringify(agentBundle)})
@@ -829,7 +829,9 @@ ggplot(diamonds, aes(x = carat, y = price, color = cut)) +
829829
assert.strictEqual(value.supervision, 'detached');
830830
const saved = JSON.parse(fs.readFileSync(path.join(config.storage, 'config.json'), 'utf8')) as AgentConfig;
831831
assert.strictEqual(saved.supervision, 'detached');
832-
if (supervision === 'auto') { assert.match(fs.readFileSync(path.join(config.storage, 'agent.log'), 'utf8'), /tmux is unavailable/); }
832+
if (supervision === 'auto' && process.platform === 'linux') {
833+
assert.match(fs.readFileSync(path.join(config.storage, 'agent.log'), 'utf8'), /tmux is unavailable/);
834+
}
833835
const before = randomUUID();
834836
await independent.request('submit', { submission: { id: before, code: 'stopifnot(Sys.getenv("ELECTRON_RUN_AS_NODE") == ""); persisted <- 42' } });
835837
const complete = async (execution: string): Promise<void> => {

‎src/test/suite/interactiveSupervisor.test.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,8 @@ import { AgentConfig } from '../../interactive/protocol';
6464
const marker = path.join(root, 'unexpected-detached-launch');
6565
const node = executable('node', `#!/bin/sh\nif [ "$1" = "-p" ] && [ "$ELECTRON_RUN_AS_NODE" = 1 ]; then echo 24.0.0; else : > '${marker}'; exit 1; fi\n`);
6666
const environment = sinon.stub(process.env, 'PATH').value(root);
67-
const platform = sinon.stub(process, 'platform').value('linux');
6867
try {
69-
for (const supervision of ['auto', 'tmux', 'systemd']) {
68+
for (const supervision of [...(process.platform === 'linux' ? ['auto'] : []), 'tmux', 'systemd']) {
7069
const config = { id: supervision, generation: 'test', supervision, directory: root, storage: path.join(root, `session-${supervision}`) } as AgentConfig;
7170
await assert.rejects(launchAgent(config, 'unused-agent', { executable: node, electron: true }), /Could not start.*r\.interactive\.supervision.*test (tmux|systemd).*failure/s);
7271
// The tmux server/systemd manager can predate VS Code and does
@@ -76,6 +75,6 @@ import { AgentConfig } from '../../interactive/protocol';
7675
assert.ok(!fs.existsSync(marker));
7776
assert.ok(!fs.existsSync(path.join(config.storage, 'manifest.json')));
7877
}
79-
} finally { environment.restore(); platform.restore(); }
78+
} finally { environment.restore(); }
8079
});
8180
});

0 commit comments

Comments
 (0)