Skip to content

Commit 9d0e6c5

Browse files
committed
Add netbench runner
1 parent 86af428 commit 9d0e6c5

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

benches/netbench/run.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/usr/bin/env bash
2+
3+
# Usage: run.sh TARGET BIN
4+
# Example: run.sh linux server-bw
5+
# run.sh hermit client-bw
6+
7+
set -o errexit
8+
9+
netbench_dir="${0%/*}"
10+
root_dir="$netbench_dir"/../..
11+
rusty_loader_dir="$root_dir"/loader
12+
13+
bin=$2
14+
args="--bytes 1048576 --rounds 1000"
15+
16+
hermit() {
17+
echo "Building rusty-loader"
18+
19+
make -C "$rusty_loader_dir" release=1
20+
21+
echo "Building $bin image"
22+
23+
cargo build --manifest-path "$netbench_dir"/Cargo.toml --bin $bin \
24+
--release
25+
26+
echo "Launching $bin image on QEMU"
27+
28+
qemu-system-x86_64 -cpu host \
29+
-enable-kvm -display none -smp 1 -m 1G -serial stdio \
30+
-kernel "$rusty_loader_dir"/target/x86_64-unknown-hermit-loader/release/rusty-loader \
31+
-initrd "$root_dir"/target/x86_64-unknown-hermit/release/$bin \
32+
-netdev tap,id=net0,ifname=tap10,script=no,downscript=no,vhost=on \
33+
-device virtio-net-pci,netdev=net0,disable-legacy=on \
34+
-append "-- --nonblocking 0 --address 10.0.5.1 $args"
35+
}
36+
37+
linux() {
38+
echo "Launching $bin on linux"
39+
40+
cargo run --manifest-path "$netbench_dir"/Cargo.toml --bin $bin \
41+
--release \
42+
--target x86_64-unknown-linux-gnu \
43+
-- \
44+
--nonblocking 0 --address 10.0.5.3 $args
45+
}
46+
47+
$1

0 commit comments

Comments
 (0)