Files
tailscale/kernel/linux/scripts/leanbench.sh
T
Brad Fitzpatrick 80c71a6b06 kernel/linux, tstest: find the tswg module in this repo
Now that the tswg kernel module is under kernel/linux, the tests and
scripts that build it default to that tree rather than a separate
~/src/tslinux checkout, and the scripts find the tailscale.com
checkout they're in. TSWG_DIR and TAILSCALE_DIR still override them.

Also rename the module's COPYING to LICENSE, give the ML-KEM test the
repo's license header (and skip it without a C compiler, now that it
runs with the rest of the module's tests), and update DESIGN.md for
the new layout, which no longer has a pristine upstream/ copy.

Updates #426

Signed-off-by: Brad Fitzpatrick <[email protected]>
Change-Id: Ifcd99dd6d2197550d9c4abd13d4d4d80ed26dc60
2026-11-09 15:47:37 +00:00

37 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
#
# leanbench.sh runs tailscale.com's lean data plane benchmark
# (tstest/tswgbench's TestLeanBenchmark): wireguard-go, tswg, the kernel's
# WireGuard and no tunnel, between two QEMU VMs on a host bridge with
# vhost-net, over IPv4 and IPv6. It writes the results as JSON to
# out/leanbench-<time>.json (or $TSWG_BENCH_OUT). It needs passwordless
# sudo (for the bridge and taps), /dev/kvm and /dev/vhost-net.
#
# Environment:
# TSWG_BENCH_CPUS virtual CPUs (and NIC queues) per VM (default 4)
# TSWG_BENCH_DUR length of each throughput run (default 10s)
# TSWG_BENCH_OUT where to write the JSON results
# TAILSCALE_DIR the tailscale.com checkout (default: the one this is in)
#
# With -smoke, it runs the quick correctness test (TestLeanSmoke) instead.
#
# usage: leanbench.sh [-smoke] [go test flags...]
set -eu
top=$(cd "$(dirname "$0")/.." && pwd)
ts=${TAILSCALE_DIR:-$top/../..}
run='TestLeanBenchmark$'
if [ "${1:-}" = "-smoke" ]; then
run='TestLeanSmoke$'
shift
else
mkdir -p "$top/out"
export TSWG_LEAN_BENCH=1 TSWG_BENCH_V6=1
export TSWG_BENCH_OUT="${TSWG_BENCH_OUT:-$top/out/leanbench-$(date -u +%Y%m%dT%H%M%SZ).json}"
echo "writing results to $TSWG_BENCH_OUT" >&2
fi
cd "$ts"
TSWG_LEAN=1 TSWG_DIR=$top exec go test ./tstest/tswgbench/ -run "$run" -v -timeout=60m "$@"