Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ ENV PATH=${SDKMAN_DIR}/candidates/gradle/current/bin:${PATH}
RUN \
java --version \
&& gradle --version \
&& pip3 install tox sphinx tox-run-command \
&& pip3 install tox sphinx tox-run-command construct pytest \
&& curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable --profile minimal --no-modify-path \
&& rustup component add rustfmt

Expand Down
41 changes: 35 additions & 6 deletions HOWTO.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,26 +63,55 @@ process. This is likely to change in the future.
client. We haven't quite decided on the details of this process.

## Generating missing tests

Using `generator/missing.py` and `generator/json2test.py`, the yaml files
for test cases can be generated using either `missing.py` to listen via socket
or using `json2test.py` to translate json input files into yaml directly
There are some tools that can assist with generating YAML based tests, like the
ones already defined in the [`test`](spec/tests/yaml/swiftnav/sbp) directory.
These YAML files are used to generate tests in the various languages that libsbp
supports, to ensure that serializing and deserializing messages works as
intended

### Existing Messages
For messages that are already being sent (eg: by Starling, or by a Piksi), the
`generator/missing.py` script can be used to connect to a socket and
automatically generate tests for any received messages that do not already have
tests.

Usage for `missing`:

```shell
python missing.py --host [HOST] --port [PORT]
```

* `missing.py` checks whether the message contains a test before writing one
### New Messages
The `json2test` script can be used to automatically generate tests for newly
defined messages.

To use `json2test` a JSON file should be hand written with example contents of a
message. For example, to generate tests for the `MSG_HEARTBEAT` message (which
contains a single field named `flags`), you would generate a JSON file of the
form:

```json
{
"msg_type": 65535,
"flags": 12345,
"sender": 9876
}
```

And then generate a test for using `json2test` with:

```shell
PYTHONPATH="python/" python generator/json2test.py --input heartbeat.json --output spec/tests/yaml/swiftnav/sbp/system/test_MsgHeartbeat.yaml
```

Usage for `json2test`

```shell
python json2test --input [PATH_TO_JSON_IN] --output [PATH_TO_YAML_OUT]
```

* can also provide message id with parameter `--msg-id [MESSAGE_ID]`
* The `msg_type` can also be provided through a CLI parameter, with `--msg-id
[MESSAGE_ID]`

# Message Guidelines

Expand Down