Files
tailscale/kernel/linux/scripts/subnetbench.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

35 lines
1.4 KiB
Bash
Executable File

#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
#
# subnetbench.sh runs tailscale.com's TestLeanSubnetRouter (a subnet router
# with many clients and flows; see tstest/tswgbench/subnet_test.go) on the
# EC2 instances from ec2.sh, once for each router CPU count given, and
# prints the medians. Logs go to $TSWG_SUBNET_LOGS (default /tmp/subnetbench).
#
# Environment (see subnet_test.go for more):
# TSWG_LEAN_SUBNET router data planes (default plain,tswg,wggo,kernelwg)
# TSWG_COMPARE_RUNS runs of each (default 3)
# TAILSCALE_DIR the tailscale.com checkout (default: the one this is in)
#
# usage: subnetbench.sh [ROUTER_CPUS...] (default: all of the router's CPUs)
set -eu
top=$(cd "$(dirname "$0")/.." && pwd)
ts=${TAILSCALE_DIR:-$top/../..}
logs=${TSWG_SUBNET_LOGS:-/tmp/subnetbench}
mkdir -p "$logs"
export TSWG_LEAN=1 TSWG_DIR="$top"
export TSWG_REMOTE="${TSWG_REMOTE:-$HOME/.cache/tslinux/ec2/hosts.json}"
export TSWG_LEAN_SUBNET="${TSWG_LEAN_SUBNET:-plain,tswg,wggo,kernelwg}"
export TSWG_COMPARE_RUNS="${TSWG_COMPARE_RUNS:-3}"
cd "$ts"
[ $# -gt 0 ] || set -- 0
for cpus in "$@"; do
echo "== router CPUs: $cpus (0 is all)" >&2
TSWG_SUBNET_ROUTER_CPUS=$cpus go test -count=1 ./tstest/tswgbench/ \
-run 'TestLeanSubnetRouter$' -v -timeout=60m > "$logs/cpus$cpus.log" 2>&1 || true
grep -E -e '--- FAIL|router .* CPUs|median|kernel reported' "$logs/cpus$cpus.log" |
sed 's/^ *[a-z_]*_test.go:[0-9]*: //'
done