Skip to content

Commit 4037da4

Browse files
authored
Created docker images for using antithesis on sim-cli (#554)
* Created docker images for using antithesis on sim-cli * Updated logbook
1 parent 4fb8dff commit 4037da4

File tree

8 files changed

+121
-0
lines changed

8 files changed

+121
-0
lines changed

Logbook.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Leios logbook
22

3+
## 2025-09-19
4+
5+
### Antithesis configuration for Rust simulator
6+
7+
The folder [antithesis/](antithesis/) contains scripts for building docker images for testing the threading behavior of the Rust simulation under the [Antithesis](https://antithesis.com/) test framework.
8+
39
## 2025-09-16
410

511
### Updated DeltaQSD notebook

antithesis/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
sim-rs/
2+
config.yaml
3+
network.yaml
4+
libvoidstar.so

antithesis/Dockerfile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Build with a pinned version of "rust:latest"
2+
FROM 764b84273d2b AS builder
3+
4+
WORKDIR /usr/src/app
5+
6+
COPY sim-rs/ .
7+
COPY libvoidstar.so /usr/lib/
8+
9+
RUN LD_LIBRARY_PATH=/usr/lib RUSTFLAGS=" -Ccodegen-units=1 -Cpasses=sancov-module -Cllvm-args=-sanitizer-coverage-level=3 -Cllvm-args=-sanitizer-coverage-trace-pc-guard -Clink-args=-Wl,--build-id -L/usr/lib -lvoidstar" cargo build --release
10+
11+
RUN LD_LIBRARY_PATH=/usr/lib RUSTFLAGS=" -Ccodegen-units=1 -Cpasses=sancov-module -Cllvm-args=-sanitizer-coverage-level=3 -Cllvm-args=-sanitizer-coverage-trace-pc-guard -Clink-args=-Wl,--build-id -L/usr/lib -lvoidstar" cargo build
12+
13+
FROM debian:bookworm-slim
14+
15+
WORKDIR /root
16+
17+
COPY --from=builder /usr/src/app/target/debug/sim-cli /usr/local/bin/sim-cli-debug
18+
COPY --from=builder /usr/src/app/target/release/sim-cli /usr/local/bin/sim-cli-release
19+
COPY --from=builder /usr/lib/libvoidstar.so /usr/lib/libvoidstar.so
20+
21+
COPY network.yaml .
22+
COPY config.yaml .
23+
COPY singleton_release.sh /opt/antithesis/test/v1/simple_release/singleton_driver_simulate.sh
24+
COPY singleton_debug.sh /opt/antithesis/test/v1/simple_debug/singleton_driver_simulate.sh
25+
26+
RUN apt-get update
27+
RUN apt-get install -y python3 pip
28+
29+
RUN pip install antithesis cffi --break-system-packages
30+
31+
COPY entrypoint.py /entrypoint.py
32+
33+
CMD ["/entrypoint.py"]

antithesis/Makefile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
play:
3+
podman play kube --replace=true compose.yaml
4+
5+
run-release:
6+
podman exec sim-rs-app /opt/antithesis/test/v1/simple_release/singleton_driver_simulate.sh
7+
8+
run-debug:
9+
podman exec sim-rs-app /opt/antithesis/test/v1/simple_release/singleton_driver_simulate.sh
10+
11+
push:
12+
podman push docker.io/bwbush/sim-rs-antithesis:latest
13+
14+
docker: Dockerfile sim-rs entrypoint.py libvoidstar.so config.yaml network.yaml singleton_release.sh singleton_debug.sh
15+
podman build -f $< -t docker.io/bwbush/sim-rs-antithesis
16+
17+
clean:
18+
rm -r sim-rs config.yaml network.yaml
19+
20+
sim-rs: ../sim-rs
21+
cp -Lr $< .
22+
23+
libvoidstar.so:
24+
wget https://antithesis.com/assets/instrumentation/libvoidstar.so
25+
26+
config.yaml: ../analysis/sims/cip/experiments/config.yaml
27+
cp $< $@
28+
29+
network.yaml: ../data/simulation/pseudo-mainnet/topology-v2.yaml
30+
cp $< $@
31+
32+
.phony: docker push play run-release run-debug clean

antithesis/compose.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: sim-rs
5+
spec:
6+
containers:
7+
- name: app
8+
image: docker.io/bwbush/sim-rs-antithesis:latest
9+

antithesis/entrypoint.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env -S python3 -u
2+
3+
# This file serves as the client's entrypoint. It:
4+
# 1. Confirms that all nodes in the cluster are available
5+
# 2. Signals "setupComplete" using the Antithesis SDK
6+
7+
import time
8+
9+
from antithesis.lifecycle import (
10+
setup_complete,
11+
)
12+
13+
SLEEP = 10
14+
15+
print("Client [entrypoint]: running...")
16+
17+
# Here is the python format for setup_complete. At this point, our system is fully initialized and ready to test.
18+
setup_complete({"Message":"sim-rs cluster is healthy"})
19+
20+
# sleep infinity
21+
time.sleep(31536000)

antithesis/singleton_debug.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
3+
/usr/local/bin/sim-cli-debug \
4+
--slots 120 \
5+
--conformance-events \
6+
--parameters config.yaml \
7+
network.yaml \
8+
/dev/null

antithesis/singleton_release.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
3+
/usr/local/bin/sim-cli-release \
4+
--slots 120 \
5+
--conformance-events \
6+
--parameters config.yaml \
7+
network.yaml \
8+
/dev/null

0 commit comments

Comments
 (0)