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
675 changes: 595 additions & 80 deletions .github/workflows/e2e-tests.yml

Large diffs are not rendered by default.

13 changes: 12 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,15 @@ target

# Test binaries
tests/e2e/test_*
tests/fixtures/cuda_test
tests/fixtures/test_*
tests/fixtures/cuda_test

# JS/TS stuff
node_modules/
package-lock.json

# TypeScript compiled output (for fixtures - dist is committed for test reliability)
# tests/fixtures/dist/ is intentionally committed

# Docker build artifacts
.docker/
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,13 @@ codelldb = "~/.local/share/debugger-cli/adapters/codelldb/adapter/codelldb"
| Adapter | Languages | Status |
|---------|-----------|--------|
| lldb-dap | C, C++, Rust, Swift | ✅ Full support |
| CodeLLDB | C, C++, Rust | ✅ Full support |
| debugpy | Python | ✅ Full support |
| Delve | Go | ✅ Full support |
| GDB | C, C++ | ✅ Full support (requires GDB 14.1+) |
| CUDA-GDB | CUDA, C, C++ | ✅ Full support (Linux only) |
| js-debug | JavaScript, TypeScript | ✅ Full support |
| CodeLLDB | C, C++, Rust | 🚧 Planned |
| cpptools | C, C++ | 🚧 Planned |
| js-debug | JavaScript, TypeScript | 🚧 Planned |

## Examples

Expand Down
80 changes: 80 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Docker Compose for local E2E testing
# Usage:
# docker compose build - Build all images
# docker compose up lldb - Run LLDB tests
# docker compose up delve - Run Delve tests
# docker compose up debugpy - Run debugpy tests
# docker compose up js-debug - Run js-debug tests
# docker compose up gdb - Run GDB tests
# docker compose up - Run all tests

services:
# Base image - not runnable directly
base:
build:
context: .
dockerfile: docker/base/Dockerfile
image: debugger-cli:base

# LLDB tests - C/C++/Rust
lldb:
build:
context: .
dockerfile: docker/lldb/Dockerfile
image: debugger-cli:lldb
depends_on:
- base
volumes:
- ./tests:/home/debugger/debugger-cli/tests:ro
- test-results:/home/debugger/results

# Delve tests - Go
delve:
build:
context: .
dockerfile: docker/delve/Dockerfile
image: debugger-cli:delve
depends_on:
- base
volumes:
- ./tests:/home/debugger/debugger-cli/tests:ro
- test-results:/home/debugger/results

# debugpy tests - Python
debugpy:
build:
context: .
dockerfile: docker/debugpy/Dockerfile
image: debugger-cli:debugpy
depends_on:
- base
volumes:
- ./tests:/home/debugger/debugger-cli/tests:ro
- test-results:/home/debugger/results

# js-debug tests - JavaScript/TypeScript
js-debug:
build:
context: .
dockerfile: docker/js-debug/Dockerfile
image: debugger-cli:js-debug
depends_on:
- base
volumes:
- ./tests:/home/debugger/debugger-cli/tests:ro
- test-results:/home/debugger/results

# GDB tests - C/C++ with GDB
gdb:
build:
context: .
dockerfile: docker/gdb/Dockerfile
image: debugger-cli:gdb
depends_on:
- base
volumes:
- ./tests:/home/debugger/debugger-cli/tests:ro
- test-results:/home/debugger/results

volumes:
test-results:
93 changes: 93 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Docker E2E Test Images

This directory contains Dockerfiles for running comprehensive end-to-end tests across all supported debug adapters.

## Images

| Image | Debug Adapter | Languages | Base |
|-------|--------------|-----------|------|
| `base` | - | Rust (build only) | rust:1.83-bookworm |
| `lldb` | lldb-dap | C, C++, Rust, Swift | base |
| `delve` | dlv | Go | base |
| `debugpy` | debugpy | Python | base |
| `js-debug` | vscode-js-debug | JavaScript, TypeScript | base |
| `gdb` | gdb (native DAP) or cdt-gdb-adapter | C, C++ | base |
| `cuda-gdb` | cuda-gdb | CUDA C/C++ | base (requires nvidia-docker) |

## Usage

### Using Docker Compose

```bash
# Build all images
docker compose build

# Run specific adapter tests
docker compose up lldb
docker compose up delve
docker compose up debugpy
docker compose up js-debug
docker compose up gdb

# Run all tests
docker compose up
```

### Using the test script

```bash
# Run all tests
./scripts/run-e2e-tests.sh

# Run specific adapter tests
./scripts/run-e2e-tests.sh lldb
./scripts/run-e2e-tests.sh js-debug
```

### Building individual images

```bash
# Build base image first
docker build -t debugger-cli:base -f docker/base/Dockerfile .

# Build adapter-specific image
docker build -t debugger-cli:lldb -f docker/lldb/Dockerfile .

# Run tests
docker run --rm debugger-cli:lldb
```

## Test Coverage

Each image runs the following test types:

1. **Scenario tests** (`debugger test tests/scenarios/*.yml`)
- Hello world programs for each language
- Breakpoints, stepping, variable inspection
- Stack traces, expression evaluation

2. **Integration tests** (`cargo test --test integration`)
- Rust test framework tests
- More detailed feature coverage

## Adding New Adapters

1. Create a new Dockerfile in `docker/<adapter>/Dockerfile`
2. Base it on `ghcr.io/akiselev/debugger-cli:base`
3. Install the debug adapter and language toolchain
4. Add test scenarios in `tests/scenarios/`
5. Add to `docker-compose.yml`
6. Add to CI workflow in `.github/workflows/e2e-tests.yml`

## CUDA-GDB Notes

The CUDA-GDB image requires NVIDIA Container Runtime:

```bash
# Requires nvidia-docker2 installed
docker run --gpus all --rm debugger-cli:cuda-gdb
```

CUDA-GDB supports two modes automatically detected at setup:
- **Native DAP**: cuda-gdb with GDB 14.1+ and DAP Python bindings
- **cdt-gdb-adapter bridge**: Older cuda-gdb without native DAP
38 changes: 38 additions & 0 deletions docker/base/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Base image for debugger-cli e2e testing
# Contains Rust toolchain and common build dependencies

FROM rust:1.83-bookworm

# Prevent interactive prompts
ENV DEBIAN_FRONTEND=noninteractive

# Install common build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
cmake \
curl \
git \
ca-certificates \
pkg-config \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*

# Create non-root user for testing
RUN useradd -m -s /bin/bash debugger
WORKDIR /home/debugger/debugger-cli

# Pre-cache cargo registry
RUN mkdir -p /home/debugger/.cargo && \
chown -R debugger:debugger /home/debugger

# Copy project files
COPY --chown=debugger:debugger . .

# Build the debugger CLI
RUN cargo build --release && \
cp target/release/debugger /usr/local/bin/

# Switch to non-root user
USER debugger

ENTRYPOINT ["/bin/bash"]
28 changes: 28 additions & 0 deletions docker/debugpy/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Debugpy debug adapter for Python debugging
# Tests: debugpy adapter with Python scripts

FROM ghcr.io/akiselev/debugger-cli:base AS base

USER root

# Install Python and pip
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 \
python3-pip \
python3-venv \
&& rm -rf /var/lib/apt/lists/*

# Install debugpy globally
RUN pip3 install --break-system-packages debugpy

# Verify debugpy is available
RUN python3 -c "import debugpy; print(f'debugpy {debugpy.__version__}')"

USER debugger

# Set environment for tests
ENV DEBUGGER_ADAPTER=debugpy
ENV TEST_LANGUAGES="python"

# Default command runs tests
CMD ["bash", "-c", "debugger test tests/scenarios/hello_world_python.yml --verbose"]
31 changes: 31 additions & 0 deletions docker/delve/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Delve debug adapter for Go debugging
# Tests: dlv DAP adapter with TCP transport

FROM ghcr.io/akiselev/debugger-cli:base AS base

USER root

# Install Go
ENV GOLANG_VERSION=1.22.0
RUN curl -LO https://go.dev/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz && \
tar -C /usr/local -xzf go${GOLANG_VERSION}.linux-amd64.tar.gz && \
rm go${GOLANG_VERSION}.linux-amd64.tar.gz

ENV PATH="/usr/local/go/bin:/home/debugger/go/bin:${PATH}"
ENV GOPATH="/home/debugger/go"

# Switch to debugger user for go install
USER debugger

# Install Delve
RUN go install github.com/go-delve/delve/cmd/dlv@latest

# Verify Delve is available
RUN dlv version

# Set environment for tests
ENV DEBUGGER_ADAPTER=go
ENV TEST_LANGUAGES="go"

# Default command runs tests
CMD ["bash", "-c", "go build -gcflags='all=-N -l' -o tests/e2e/test_go tests/e2e/hello_world.go && debugger test tests/scenarios/hello_world_go.yml --verbose"]
33 changes: 33 additions & 0 deletions docker/gdb/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# GDB debug adapter for C/C++ debugging
# Tests: GDB with native DAP support (GDB >= 14.1)

FROM ghcr.io/akiselev/debugger-cli:base AS base

USER root

# Install GDB with DAP support
# Note: Debian bookworm has GDB 13.x, we need 14.1+ for native DAP
# For older GDB, cdt-gdb-adapter bridge is used
RUN apt-get update && apt-get install -y --no-install-recommends \
gdb \
gcc \
g++ \
&& rm -rf /var/lib/apt/lists/*

# Check GDB version
RUN gdb --version | head -1

# Install cdt-gdb-adapter as fallback for older GDB
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \
apt-get install -y nodejs && \
npm install -g cdt-gdb-adapter && \
rm -rf /var/lib/apt/lists/*

USER debugger

# Set environment for tests
ENV DEBUGGER_ADAPTER=gdb
ENV TEST_LANGUAGES="c,cpp"

# Default command compiles and runs tests
CMD ["bash", "-c", "gcc -g tests/fixtures/simple.c -o tests/fixtures/test_simple_c && debugger test tests/scenarios/hello_world_c.yml --verbose"]
40 changes: 40 additions & 0 deletions docker/js-debug/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# js-debug adapter for JavaScript/TypeScript debugging
# Tests: vscode-js-debug adapter with Node.js runtime

FROM ghcr.io/akiselev/debugger-cli:base AS base

USER root

# Install Node.js (LTS)
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \
apt-get install -y nodejs && \
rm -rf /var/lib/apt/lists/*

# Verify Node.js
RUN node --version && npm --version

# Install js-debug globally (the VS Code JavaScript Debugger)
RUN npm install -g @anthropic-ai/vscode-js-debug 2>/dev/null || \
npm install -g @anthropic-ai/js-debug 2>/dev/null || \
echo "Will install js-debug via debugger setup"

# Install TypeScript for test fixtures
RUN npm install -g typescript

USER debugger

# Ensure npm global bin is in PATH
ENV PATH="/home/debugger/.npm-global/bin:${PATH}"
ENV NPM_CONFIG_PREFIX="/home/debugger/.npm-global"

# Set environment for tests
ENV DEBUGGER_ADAPTER=js-debug
ENV TEST_LANGUAGES="javascript,typescript"

# Build TypeScript fixtures if needed
RUN cd /home/debugger/debugger-cli/tests/fixtures && \
npm install 2>/dev/null || true && \
npx tsc 2>/dev/null || true

# Default command runs tests
CMD ["bash", "-c", "debugger setup js-debug && debugger test tests/scenarios/hello_world_js.yml --verbose && debugger test tests/scenarios/hello_world_ts.yml --verbose"]
Loading
Loading