Skip to content

Commit aff2bce

Browse files
committed
tcp: add netsim test.
This test simulates a network with a given latency and packet loss, and measures the throughput between two virtual smoltcp instances.
1 parent 7a248ae commit aff2bce

File tree

5 files changed

+400
-3
lines changed

5 files changed

+400
-3
lines changed

.github/workflows/test.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name: Test
77
jobs:
88
tests:
99
runs-on: ubuntu-22.04
10-
needs: [check-msrv, test-msrv, test-stable, clippy]
10+
needs: [check-msrv, test-msrv, test-stable, clippy, test-netsim]
1111
steps:
1212
- name: Done
1313
run: exit 0
@@ -48,6 +48,14 @@ jobs:
4848
- name: Run Tests nightly
4949
run: ./ci.sh test nightly
5050

51+
test-netsim:
52+
runs-on: ubuntu-22.04
53+
continue-on-error: true
54+
steps:
55+
- uses: actions/checkout@v4
56+
- name: Run network-simulation tests
57+
run: ./ci.sh netsim
58+
5159
test-build-16bit:
5260
runs-on: ubuntu-22.04
5361
continue-on-error: true

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ getopts = "0.2"
3535
rand = "0.8"
3636
url = "2.0"
3737
rstest = "0.17"
38+
insta = "1.41.1"
39+
rand_chacha = "0.3.1"
3840

3941
[features]
4042
std = ["managed/std", "alloc"]

ci.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,20 @@ test() {
4949
rustup toolchain install $version
5050

5151
for features in ${FEATURES_TEST[@]}; do
52-
cargo +$version test --no-default-features --features "$features"
52+
cargo +$version test --no-default-features --features "$features" -- --skip netsim
5353
done
5454

5555
if [[ $version == "nightly" ]]; then
5656
for features in ${FEATURES_TEST_NIGHTLY[@]}; do
57-
cargo +$version test --no-default-features --features "$features"
57+
cargo +$version test --no-default-features --features "$features" -- --skip netsim
5858
done
5959
fi
6060
}
6161

62+
netsim() {
63+
cargo test --release netsim
64+
}
65+
6266
check() {
6367
local version=$1
6468
rustup toolchain install $version
@@ -138,3 +142,7 @@ fi
138142
if [[ $1 == "coverage" || $1 == "all" ]]; then
139143
coverage
140144
fi
145+
146+
if [[ $1 == "netsim" || $1 == "all" ]]; then
147+
netsim
148+
fi

0 commit comments

Comments
 (0)