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
15 changes: 14 additions & 1 deletion tests/e2e/comprehensive-mcp-tools.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
PYTHON_SCRIPT, JS_SCRIPT, RUST_SCRIPT, GO_SCRIPT, DOTNET_SCRIPT, JAVA_SCRIPT, JAVA_CLASS_DIR, RUBY_SCRIPT, CPP_SCRIPT,
PYTHON_BP_LINE, JS_BP_LINE, RUST_BP_LINE, GO_BP_LINE, DOTNET_BP_LINE, JAVA_BP_LINE, RUBY_BP_LINE, CPP_BP_LINE,
hasRust, hasGo, hasRuby, hasDotnet, hasJava, hasCpp,
ensureGoBuild, ensureDotnetBuild, ensureJavaBuild, ensureCppBuild
ensureRustBuild, ensureGoBuild, ensureDotnetBuild, ensureJavaBuild, ensureCppBuild
} from './language-matrix-utils.js';

/* ---------- result tracking ---------- */
Expand Down Expand Up @@ -116,6 +116,19 @@ describe(`Comprehensive MCP Debugger Test — ${ALL_TOOLS.length} Tools × ${LAN
console.log('[Setup] MCP client connected to server');

// Pre-compile languages that need it
const rustLang = LANGUAGES.find(l => l.language === 'rust');
if (rustLang?.available) {
try {
const rustBinary = await ensureRustBuild();
rustLang.launchScript = rustBinary;
console.log(`[Setup] Rust binary compiled: ${rustBinary}`);
} catch (err) {
console.log(`[Setup] Rust build failed: ${err}`);
rustLang.available = false;
rustLang.skipReason = 'Rust build failed';
}
}

const goLang = LANGUAGES.find(l => l.language === 'go');
if (goLang?.available) {
try {
Expand Down
19 changes: 18 additions & 1 deletion tests/e2e/language-matrix-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { fileURLToPath } from 'url';
import { execFileSync, execSync } from 'child_process';
import { prepareJavaExample } from './java-example-utils.js';
import { prepareCppExample, hasCppToolchain } from './cpp-example-utils.js';
import { prepareRustExample } from './rust-example-utils.js';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
Expand Down Expand Up @@ -109,6 +110,10 @@ export function ensureCppBuild(): string {
return prepareCppExample('hello_world').binaryPath;
}

export async function ensureRustBuild(): Promise<string> {
return (await prepareRustExample('hello_world')).binaryPath;
}

/* ---------- language matrix ---------- */

export interface MatrixLangDef {
Expand Down Expand Up @@ -150,7 +155,19 @@ export function createLanguageMatrix(): MatrixLangDef[] {
* Run the per-language build steps (go binary, dotnet dll, java classes),
* updating launchScript/availability in place. Call from a suite's beforeAll.
*/
export function prepareLanguageMatrix(languages: MatrixLangDef[], log: (msg: string) => void = console.log): void {
export async function prepareLanguageMatrix(languages: MatrixLangDef[], log: (msg: string) => void = console.log): Promise<void> {
const rustLang = languages.find(l => l.language === 'rust');
if (rustLang?.available) {
try {
rustLang.launchScript = await ensureRustBuild();
log(`[Setup] Rust binary compiled: ${rustLang.launchScript}`);
} catch (err) {
log(`[Setup] Rust build failed: ${err}`);
rustLang.available = false;
rustLang.skipReason = 'Rust build failed';
}
}

const goLang = languages.find(l => l.language === 'go');
if (goLang?.available) {
try {
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/mcp-server-breakpoint-management.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('Breakpoint management e2e (list/remove/clear)', () => {
{ capabilities: {} },
);
await mcpClient.connect(transport);
prepareLanguageMatrix(LANGUAGES);
await prepareLanguageMatrix(LANGUAGES);
}, 120_000);

afterAll(async () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/mcp-server-logpoints.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe('Logpoints e2e (set_breakpoint logMessage)', () => {
{ capabilities: {} },
);
await mcpClient.connect(transport);
prepareLanguageMatrix(LANGUAGES);
await prepareLanguageMatrix(LANGUAGES);
}, 120_000);

afterAll(async () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/mcp-server-smoke-restart.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('restart_debugging e2e', () => {
{ capabilities: {} },
);
await mcpClient.connect(transport);
prepareLanguageMatrix(LANGUAGES);
await prepareLanguageMatrix(LANGUAGES);
}, 120_000);

afterAll(async () => {
Expand Down
7 changes: 6 additions & 1 deletion tests/e2e/mcp-server-smoke-ruby-attach.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,12 @@ describe('MCP Server Ruby Attach-Mode Smoke Test @requires-ruby', () => {
});
const attachResponse = parseSdkToolResult(attachResult);
expect(attachResponse.success).toBe(true);
expect(attachResponse.state).toBe('paused');
expect(['paused', 'running']).toContain(attachResponse.state);
if (attachResponse.state === 'running') {
expect(attachResponse.pending).toBe(true);
const initialStack = await waitForPausedState(mcpClient!, sessionId);
expect(initialStack).not.toBeNull();
}

// 3. Breakpoint inside the loop, then release the load suspension
const bpResult = await callToolSafely(mcpClient!, 'set_breakpoint', {
Expand Down
13 changes: 10 additions & 3 deletions tests/e2e/mcp-server-smoke-rust.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@ describe('MCP Server Rust Debugging Smoke Test', () => {
args: [distEntry, '--log-level', 'info'],
env: {
...process.env,
NODE_ENV: 'test'
NODE_ENV: 'test',
// The examples are compiled with stable-gnu on Windows. Point
// CodeLLDB at the matching Rust formatter scripts as well; using the
// host's default MSVC scripts against a GNU stdlib can hang a
// variables request inside lldb_providers.py.
...(process.platform === 'win32'
? { RUSTUP_TOOLCHAIN: 'stable-x86_64-pc-windows-gnu' }
: {})
}
});

Expand Down Expand Up @@ -206,7 +213,7 @@ describe('MCP Server Rust Debugging Smoke Test', () => {
expect(helloEntry!.category).toBe('stdout');
expect(outputEntries.some(e => e.output.includes('Sum of 5 and 10 is: 15'))).toBe(true);
},
60000
120000
);

it(
Expand Down Expand Up @@ -335,7 +342,7 @@ describe('MCP Server Rust Debugging Smoke Test', () => {
);
expect(finalContinue.success).toBe(true);
},
60000
120000
);

// Shared driver for the continue-to-completion tests below: sets one
Expand Down
Loading