Skip to content
Merged
11 changes: 11 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,17 @@ and ``make test-all`` regenerates them before running the whole suite:
The same fixtures back the demonstration scripts in
``examples/legacy_smoke/``, which read them as ``../captures/…``.

One of the generators works differently from the rest and is worth knowing about.
``examples/generators/options.py`` does not describe packets it wants; it asks the
library which option, chunk, parameter, message, frame and block codes it
registers, and then constructs one of each through the public construction API,
parses it back, and constructs it again from what was parsed. The
``options-*.pcap`` captures are the cases that survive that round trip, so they
record what this version of ``pcapkit`` builds rather than what a third-party
tool builds. ``tests/protocols/test_option_roundtrip_unit.py`` runs the same
cases without needing a fixture at all, and carries a table of the ones that do
not yet close the cycle, each named against the defect that stops it.

Continuous integration runs the ``make test`` selection, since the fixtures are
not in the repository. ``tshark`` is only required to exercise the PyShark
engine, and is not needed by the test suite.
Expand Down
9 changes: 7 additions & 2 deletions examples/generators/make_samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
:file:`pcap.py` the ``.pcap`` captures the unit and runtime tests read
:file:`pcapng.py` the ``.pcapng`` captures the regression tests read
:file:`legacy.py` the extra captures ``examples/legacy_smoke/`` reads
:file:`options.py` the ``options-*.pcap`` option-coverage captures
=================== ==========================================================

They are loaded by path rather than imported by name, since this directory is
Expand All @@ -44,8 +45,12 @@
HERE = pathlib.Path(__file__).resolve().parent
#: Destination directory for every generated capture.
DEST = ROOT / 'examples' / 'captures'
#: Generator modules, in the order they are run.
GENERATORS = ('pcap', 'pcapng', 'legacy')
#: Generator modules, in the order they are run. :file:`options.py` runs last
#: because it is the only one that builds its captures out of :mod:`pcapkit`'s
#: own construction output, so a failure in it is a statement about the library
#: rather than about the fixture -- and reading it after the others have already
#: printed keeps that distinction visible in the log.
GENERATORS = ('pcap', 'pcapng', 'legacy', 'options')


def load(name: 'str') -> 'ModuleType':
Expand Down
Loading
Loading