---
title: "Network tests"
canonical_url: https://developer.repebble.com/pebbleos/docs/development/tests/network/
last_updated: 2026-12-05
sdk_version: 4.44
---
# Network tests

Source: https://developer.repebble.com/pebbleos/docs/development/tests/network/

The network tests run the TCP/IP stack as a native build on a Linux TAP interface and check it against the host’s own stack and tools: `ping`, a router advertisement daemon, and hand-made packets sent with [Scapy](https://scapy.net). They live in `tests/net/`, written in Python with [pytest](https://docs.pytest.org).

## Running them

The tests need Linux and the right to create network interfaces, so they run in a container with a network of its own, which leaves the host’s alone. On Linux or macOS, with Docker:

```
tests/net/run.sh
```

The script builds the container’s image, then builds `tests/net/app` for `native` with the address and undefined behaviour sanitizers, and runs pytest; arguments go to pytest, such as `-k slaac` or `-x`. The build is kept in a Docker volume between runs.

## How they work

Each test creates the `tap0` interface, with `192.0.2.1/24` on the host side, and starts the stack on it with the `-e` option of the native build (see [Native simulator](https://developer.repebble.com/pebbleos/docs/development/emulation/native_simulator.md)). The test application takes `192.0.2.2/24` and prints its IPv6 addresses whenever they change, which the tests wait on. The stack’s MAC address is derived from the interface name.

Tests that watch the traffic sniff the interface with Scapy, and those that need a router run `radvd` on it, advertising `2001:db8:1::/64`.

## Fuzzing

`tests/fuzz/net` runs the receive path of the stack under [libFuzzer](https://llvm.org/docs/LibFuzzer.html), with the address and undefined behaviour sanitizers, in the same container:

```
tests/fuzz/net/run.sh 600
```

The first argument is how long to fuzz, in seconds, 60 by default; the others go to libFuzzer. The harness feeds the stack frames and the passing of time, with a deterministic clock and random numbers, on an interface configured as the tests’ with a link-local address either checked or still being checked, and with checksum offload or without. Frames may have their IP length and checksums made right first, so that mutations reach past them.

Each input fails on a sanitizer error or a failed assertion in the stack, on a frame the stack sends that is malformed or whose checksums are wrong, or on a packet buffer not given back once the stack’s state is reset. `tests/fuzz/net/seeds.py` writes the seeds, a frame or two of each protocol the stack takes. The corpus grows in `build/fuzz-net/corpus`, and failing inputs land in `build/fuzz-net/artifacts`. Given files, the script replays them instead:

```
tests/fuzz/net/run.sh build/fuzz-net/artifacts/crash-…
```

CI fuzzes for five minutes on every change to the stack.

Generated from PebbleOS [7416f78a1](https://github.com/coredevices/pebbleos/commit/7416f78a1dc6d00d91f42a28c68918ae92bcfbbc). This page is maintained in the pebbleos repository: [docs/development/tests/network.md](https://github.com/coredevices/pebbleos/blob/7416f78a1dc6d00d91f42a28c68918ae92bcfbbc/docs/development/tests/network.md).
