Skip to content

Development

Ken Tobias edited this page Jun 21, 2026 · 15 revisions

Development

This page covers compiling, testing, and benchmarking the etr codebase.

Prerequisites

To compile and run all tests locally, you need:

  • The Rust toolchain (rustup.rs)
  • just (command runner)
  • tmux (required for local end-to-end tests)
  • OpenSSH client/server with passwordless login to localhost configured (required for E2E tests)

Building

# Debug build
cargo build

# Release build
cargo build --release

Running Tests

We maintain a comprehensive suite of static checks, unit tests, and automated end-to-end tests:

# Run formatting and clippy lints
just check

# Run unit and integration tests (78 tests)
just test

# Run local end-to-end session and reconnect tests (launches etr in tmux)
just e2e-local

# Run local end-to-end tests for -L port forwarding (TCP + UDP, IPv4 + IPv6, reconnect)
just e2e-forward-local

# Run local end-to-end tests for -R port forwarding (TCP + UDP, IPv4 + IPv6, reconnect)
just e2e-reverse-local

# Run local end-to-end test for --env variable forwarding
just e2e-env-local

# Regression test: concurrent UDP senders through -L (v0.4.9 per-sender routing)
just e2e-udp-concurrent

# Run throughput/memory stress tests
just stress-local

Installing Shell Completions

just install-completions generates and installs tab-completions for both etr and etrs into the correct XDG directories for all six supported shells:

just install-completions
Shell Installed path Auto-loaded?
bash $XDG_DATA_HOME/bash-completion/completions/ Yes (bash-completion ≥ 2.x)
zsh $XDG_DATA_HOME/zsh/site-functions/ Yes (in zsh's default $fpath)
fish $XDG_CONFIG_HOME/fish/completions/ Yes
elvish $XDG_CONFIG_HOME/elvish/lib/ Needs eval (slurp < …) in rc.elv
nushell $XDG_CONFIG_HOME/nushell/completions/ Needs source in config.nu
powershell $XDG_CONFIG_HOME/powershell/ Needs . … in $PROFILE

The recipe prints sourcing instructions at the end of the run for the shells that require them.

Running Benchmarks

We use criterion to benchmark core performance-sensitive areas of the codebase, including TLS certificate generation, connection handshakes, round-trip latency, and throughput.

# Run the benchmark suite
just bench

Clone this wiki locally