Simplify local testing inside Docker environment (#2777)

* Docs + changes to Dockerfile for running tests while avoiding rebuilding on every change.

* more notes

* lint

* typo
pull/2782/head
OBarronCS 9 months ago committed by GitHub
parent 740088071d
commit f5adb18814
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -63,6 +63,19 @@ To run these tests, run [`./tests.sh`](./tests.sh). You can filter the tests to
To invoke cross-architecture tests, use `./qemu-tests.sh`, and to run unit tests, use `./unit-tests.sh`
To run the tests in the same environment as the testing CI/CD, you can use the following Docker command.
```sh
# General test suite
docker compose run --rm --build ubuntu24.04-mount ./tests.sh
# Cross-architecture tests
docker compose run --rm --build ubuntu24.04-mount ./qemu-tests.sh
```
This comes in handy particularly for cross-architecture tests because the Docker environment has all the cross-compilers installed. The active `pwndbg` directory is mounted, preventing the need for a full rebuild whenever you update the codebase.
Remove the `-mount` if you want the tests to run from a clean slate (no files are mounted, meaning all binaries are recompiled each time).
## Writing Tests
Each test is a Python function that runs inside of an isolated GDB session.

@ -9,7 +9,7 @@
#
ARG image=mcr.microsoft.com/devcontainers/base:jammy
FROM $image
FROM $image AS base
WORKDIR /pwndbg
@ -45,6 +45,8 @@ RUN ./setup-dev.sh
# Cleanup dummy files
RUN rm README.md && rm -rf pwndbg
FROM base AS full
ADD . /pwndbg/
ARG LOW_PRIVILEGE_USER="vscode"

@ -1,4 +1,3 @@
version: "3.8"
services:
base: &base-spec
build: .
@ -28,6 +27,16 @@ services:
args:
image: ubuntu:24.04
ubuntu24.04-mount:
<<: *base-spec
build:
context: .
target: base
dockerfile: Dockerfile
args:
image: ubuntu:24.04
volumes:
- .:/pwndbg
debian12:
<<: *base-spec

Loading…
Cancel
Save