Skip to content

Commit

Permalink
tcp: add netsim test.
Browse files Browse the repository at this point in the history
This test simulates a network with a given latency and packet loss, and measures the
throughput between two virtual smoltcp instances.
  • Loading branch information
Dirbaio committed Dec 30, 2024
1 parent 7a248ae commit ab61335
Show file tree
Hide file tree
Showing 5 changed files with 404 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name: Test
jobs:
tests:
runs-on: ubuntu-22.04
needs: [check-msrv, test-msrv, test-stable, clippy]
needs: [check-msrv, test-msrv, test-stable, clippy, test-netsim]
steps:
- name: Done
run: exit 0
Expand Down Expand Up @@ -48,6 +48,14 @@ jobs:
- name: Run Tests nightly
run: ./ci.sh test nightly

test-netsim:
runs-on: ubuntu-22.04
continue-on-error: true
steps:
- uses: actions/checkout@v4
- name: Run network-simulation tests
run: ./ci.sh netsim

test-build-16bit:
runs-on: ubuntu-22.04
continue-on-error: true
Expand Down
8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ getopts = "0.2"
rand = "0.8"
url = "2.0"
rstest = "0.17"
insta = "1.41.1"
rand_chacha = "0.3.1"

[features]
std = ["managed/std", "alloc"]
Expand Down Expand Up @@ -109,6 +111,8 @@ default = [

"_proto-fragmentation" = []

"_netsim" = []

# BEGIN AUTOGENERATED CONFIG FEATURES
# Generated by gen_config.py. DO NOT EDIT.
iface-max-addr-count-1 = []
Expand Down Expand Up @@ -267,6 +271,10 @@ rpl-parents-buffer-count-32 = []

# END AUTOGENERATED CONFIG FEATURES

[[test]]
name = "netsim"
required-features = ["_netsim"]

[[example]]
name = "packet2pcap"
path = "utils/packet2pcap.rs"
Expand Down
8 changes: 8 additions & 0 deletions ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ test() {
fi
}

netsim() {
cargo test --release --features _netsim netsim
}

check() {
local version=$1
rustup toolchain install $version
Expand Down Expand Up @@ -138,3 +142,7 @@ fi
if [[ $1 == "coverage" || $1 == "all" ]]; then
coverage
fi

if [[ $1 == "netsim" || $1 == "all" ]]; then
netsim
fi
Loading

0 comments on commit ab61335

Please sign in to comment.