-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 94a98c1
Showing
60 changed files
with
4,815 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 2 | ||
indent_style = space | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
version: 2 | ||
|
||
updates: | ||
- package-ecosystem: "cargo" | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
|
||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: CI | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
autobahn: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
override: true | ||
profile: minimal | ||
toolchain: nightly-2023-08-01 | ||
- uses: Swatinem/rust-cache@v2 | ||
|
||
- run: .scripts/autobahn.sh ci | ||
|
||
# fuzz: | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - uses: actions/checkout@v3 | ||
# - uses: actions-rs/toolchain@v1 | ||
# with: | ||
# override: true | ||
# profile: minimal | ||
# toolchain: nightly-2023-08-01 | ||
# - uses: actions-rs/[email protected] | ||
# with: | ||
# crate: cargo-fuzz | ||
# use-tool-cache: true | ||
# | ||
# - run: .scripts/fuzz.sh | ||
|
||
tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
components: clippy, rustfmt | ||
override: true | ||
profile: minimal | ||
toolchain: nightly-2023-08-01 | ||
- uses: Swatinem/rust-cache@v2 | ||
|
||
- run: .scripts/wtx.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.scripts/autobahn/reports | ||
.vscode | ||
**/*.rs.bk | ||
**/artifacts | ||
**/Cargo.lock | ||
**/corpus | ||
**/target | ||
**/target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
set -euxo pipefail | ||
|
||
ARG=${1:-""} | ||
if [ "$ARG" != "ci" ]; then | ||
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT | ||
fi; | ||
|
||
# fuzzingclient | ||
|
||
cargo build --example web_socket_server_echo_raw_tokio --features tokio,web-socket-handshake --release | ||
cargo run --example web_socket_server_echo_raw_tokio --features tokio,web-socket-handshake --release & cargo_pid=$! | ||
mkdir -p .scripts/autobahn/reports/fuzzingclient | ||
podman run \ | ||
-v .scripts/autobahn/fuzzingclient.json:/fuzzingclient.json:ro \ | ||
-v .scripts/autobahn:/autobahn \ | ||
--name fuzzingclient \ | ||
--net=host \ | ||
--rm \ | ||
docker.io/crossbario/autobahn-testsuite:0.8.2 wstest -m fuzzingclient -s fuzzingclient.json | ||
podman rm --force --ignore fuzzingclient | ||
kill -9 $cargo_pid | ||
|
||
if [ $(grep -ci "failed" .scripts/autobahn/reports/fuzzingclient/index.json) -gt 0 ] | ||
then | ||
exit 1 | ||
fi | ||
|
||
## fuzzingserver | ||
|
||
cargo build --example web_socket_client_autobahn_raw_tokio --features tokio,web-socket-handshake --release | ||
mkdir -p .scripts/autobahn/reports/fuzzingserver | ||
podman run \ | ||
-d \ | ||
-p 9080:9080 \ | ||
-v .scripts/autobahn/fuzzingserver.json:/fuzzingserver.json:ro \ | ||
-v .scripts/autobahn:/autobahn \ | ||
--name fuzzingserver \ | ||
--net=host \ | ||
docker.io/crossbario/autobahn-testsuite:0.8.2 wstest -m fuzzingserver -s fuzzingserver.json | ||
sleep 5 | ||
cargo run --example web_socket_client_autobahn_raw_tokio --features tokio,web-socket-handshake --release -- 127.0.0.1:9080 | ||
podman rm --force --ignore fuzzingserver | ||
|
||
if [ $(grep -ci "failed" .scripts/autobahn/reports/fuzzingserver/index.json) -gt 0 ] | ||
then | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"cases": ["1.*", "2.*", "3.*", "4.*", "5.*", "6.*", "7.*", "9.*", "10.*"], | ||
"exclude-agent-cases": {}, | ||
"exclude-cases": [], | ||
"outdir": "/autobahn/reports/fuzzingclient", | ||
"servers": [ | ||
{ | ||
"agent": "wtx", | ||
"url": "ws://127.0.0.1:8080" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"cases": ["1.*", "2.*", "3.*", "4.*", "5.*", "6.*", "7.*", "9.*", "10.*"], | ||
"exclude-agent-cases": {}, | ||
"exclude-cases": [], | ||
"outdir": "/autobahn/reports/fuzzingserver", | ||
"url": "ws://127.0.0.1:9080" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euxo pipefail | ||
|
||
export rt='cargo run --bin rust-tools -- --template you-rust' | ||
|
||
export CARGO_TARGET_DIR="$($rt target-dir)" | ||
export RUST_BACKTRACE=1 | ||
export RUSTFLAGS="$($rt rust-flags)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euxo pipefail | ||
|
||
cargo fuzz run --fuzz-dir wtx-fuzz unmask -- -runs=100000 | ||
cargo fuzz run --fuzz-dir wtx-fuzz parse-frame -- -runs=100000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euxo pipefail | ||
|
||
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT | ||
|
||
pushd /tmp | ||
git clone https://github.com/c410-f3r/fastwebsockets || true | ||
cd fastwebsockets | ||
git checkout -t origin/bench || true | ||
RUSTFLAGS='-C target-cpu=native' cargo build --example echo_server --features simd,upgrade --release | ||
RUSTFLAGS='-C target-cpu=native' cargo run --example echo_server --features simd,upgrade --release 127.0.0.1:8080 & | ||
|
||
cd /tmp | ||
git clone https://github.com/c410-f3r/websocket || true | ||
cd websocket/examples/echo | ||
git checkout -t origin/bench || true | ||
go run server.go 127.0.0.1:8081 & | ||
|
||
cd /tmp | ||
git clone https://github.com/c410-f3r/tokio-tungstenite || true | ||
cd tokio-tungstenite | ||
git checkout -t origin/bench || true | ||
RUSTFLAGS='-C target-cpu=native' cargo build --example echo-server --release | ||
RUSTFLAGS='-C target-cpu=native' cargo run --example echo-server --release 127.0.0.1:8082 & | ||
|
||
cd /tmp | ||
git clone --recursive https://github.com/c410-f3r/uWebSockets.git || true | ||
cd uWebSockets | ||
git checkout -t origin/bench || true | ||
if [ ! -e ./EchoServer ] | ||
then | ||
make examples | ||
fi | ||
./EchoServer 8083 & | ||
popd | ||
|
||
RUSTFLAGS='-C target-cpu=native' cargo build --example web_socket_server_echo_hyper --features simdutf8,web-socket-hyper --release | ||
RUSTFLAGS='-C target-cpu=native' cargo run --example web_socket_server_echo_hyper --features simdutf8,web-socket-hyper --release 127.0.0.1:8084 & | ||
|
||
RUSTFLAGS='-C target-cpu=native' cargo build --example web_socket_server_echo_raw_async_std --features async-std,simdutf8,web-socket-handshake --release | ||
RUSTFLAGS='-C target-cpu=native' cargo run --example web_socket_server_echo_raw_async_std --features async-std,simdutf8,web-socket-handshake --release 127.0.0.1:8085 & | ||
|
||
RUSTFLAGS='-C target-cpu=native' cargo build --example web_socket_server_echo_raw_glommio --features glommio,simdutf8,web-socket-handshake --release | ||
RUSTFLAGS='-C target-cpu=native' cargo run --example web_socket_server_echo_raw_glommio --features glommio,simdutf8,web-socket-handshake --release 127.0.0.1:8086 & | ||
|
||
RUSTFLAGS='-C target-cpu=native' cargo build --example web_socket_server_echo_raw_tokio --features simdutf8,tokio,web-socket-handshake --release | ||
RUSTFLAGS='-C target-cpu=native' cargo run --example web_socket_server_echo_raw_tokio --features simdutf8,tokio,web-socket-handshake --release 127.0.0.1:8087 & | ||
|
||
sleep 1 | ||
|
||
RUSTFLAGS='-C target-cpu=native' cargo run --bin wtx-bench --release -- \ | ||
http://127.0.0.1:8080/fastwebsockets \ | ||
http://127.0.0.1:8081/gorilla-websocket \ | ||
http://127.0.0.1:8082/tokio-tungstenite \ | ||
http://127.0.0.1:8083/uWebSockets \ | ||
http://127.0.0.1:8084/wtx-hyper \ | ||
http://127.0.0.1:8085/wtx-raw-async-std \ | ||
http://127.0.0.1:8086/wtx-raw-glommio \ | ||
http://127.0.0.1:8087/wtx-raw-tokio |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euxo pipefail | ||
|
||
cargo install rust-tools --git https://github.com/c410-f3r/regular-crates | ||
|
||
rt='rust-tools --template you-rust' | ||
|
||
CARGO_TARGET_DIR="$($rt target-dir)" | ||
RUST_BACKTRACE=1 | ||
RUSTFLAGS="$($rt rust-flags)" | ||
|
||
$rt rustfmt | ||
$rt clippy | ||
|
||
$rt test-generic wtx | ||
$rt test-with-features wtx async-std | ||
$rt test-with-features wtx async-trait | ||
$rt test-with-features wtx base64 | ||
$rt test-with-features wtx futures-lite | ||
$rt test-with-features wtx glommio | ||
$rt test-with-features wtx http | ||
$rt test-with-features wtx httparse | ||
$rt test-with-features wtx hyper | ||
$rt test-with-features wtx sha1 | ||
$rt test-with-features wtx simdutf8 | ||
$rt test-with-features wtx std | ||
$rt test-with-features wtx tokio | ||
$rt test-with-features wtx web-socket-handshake | ||
$rt test-with-features wtx web-socket-hyper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[profile.profiling] | ||
inherits = "release" | ||
debug = true | ||
|
||
[profile.release] | ||
codegen-units = 1 | ||
debug = false | ||
debug-assertions = false | ||
incremental = false | ||
lto = true | ||
opt-level = 3 | ||
overflow-checks = false | ||
panic = 'abort' | ||
rpath = false | ||
strip = "debuginfo" | ||
|
||
[workspace] | ||
members = ["wtx-bench", "wtx", "wtx-fuzz"] | ||
resolver = "2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[toolchain] | ||
channel = "nightly-2023-08-01" | ||
components = ["clippy", "rustfmt"] | ||
profile = "minimal" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[dependencies] | ||
hyper = { default-features = false, features = ["client", "http1", "server", "tcp"], version = "0.14" } | ||
plotters = { default-features = false, features = ["histogram", "svg_backend"], version = "0.3" } | ||
tokio = { default-features = false, features = ["macros", "rt-multi-thread"], version = "1.0" } | ||
wtx = { features = ["tokio", "web-socket-handshake"], path = "../wtx" } | ||
|
||
[package] | ||
description = "Benchmarks" | ||
edition = "2021" | ||
license = "Apache-2.0" | ||
name = "wtx-bench" | ||
publish = false | ||
version = "0.0.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Benchmarks | ||
|
||
Call the `wtx-bench` binary passing the URLs of all different available echo servers. | ||
|
||
``` | ||
cargo run --bin wtx-bench --release -- http://127.0.0.1:8080/some_server_name http://127.0.0.1:8081/another_server_name .. | ||
``` |
Oops, something went wrong.