RIOT
RIOT copied to clipboard
native: add option to turn RIOT into a Linux CLI tool
Contribution description
To better integrate RIOT into some automated tests, it can be useful to run commands in a one-shot fashion. This allows to use RIOT shell commands like Linux applications and integrate them into other tooling so e.g. Linux servers that interact with RIOT can be tested using a fixed RIOT binary.
Testing procedure
First create a TAP bridge with an (optional) uplink:
sudo dist/tools/tapsetup/tapsetup -u enxf4a80d90ba50
We can ping a host from RIOT
bin/native/nanocoap_tool.elf tap0 ping riot-os.org
12 bytes from 2a01:4f9:1a:9508::1: icmp_seq=0 ttl=57 time=58.149 ms
12 bytes from 2a01:4f9:1a:9508::1: icmp_seq=1 ttl=57 time=58.647 ms
12 bytes from 2a01:4f9:1a:9508::1: icmp_seq=2 ttl=57 time=58.381 ms
--- riot-os.org PING statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 58.149/58.392/58.647 ms
We can also access CoAP servers
bin/native/nanocoap_tool.elf tap0 ncget coap://coap.me/
/test
/validate
/hello
/blåbærsyltetøy
/sink
/separate
/large
/secret
/broken
/weird33
/weird44
/weird55
/weird333
/weird3333
/weird33333
/123412341234123412341234
/location-query
/create1
/large-update
/large-create
/query
/seg1
/path
/location1
/multi-format
/3
/4
/5
Issues/PRs references
Murdock results
:x: FAILED
c0fd8edcfa8875a7a8bff58219e68765ce2254c1 examples/nanocoap_tool: add RIOT as a CLI tool
| Success | Failures | Total | Runtime |
|---|---|---|---|
| 9568 | 0 | 10145 | 10m:56s |
Artifacts
Cool idea! How about making it behave like busybox? ./ncget == ./nanocoap_tool.elf ncget?
I dislike that there is a new example that does not really have value as it - add the very least add a README! I am also surprised it is nanocoap specific? While coap is a good example use case, the example itself is more "riot as cli tool" and should be presented as such.
I agree that the example needs to be more fleshed out, this is a bit specific to the 'send arbitrary CoAP payloads as a RIOT node would' use case, but not sure what else I should include.
Is this ready for a review @benpicco ?
Sure!
A README for the example would be nice. It took me a while to wrap my head around the concept.
I added a readme and some wrapper scripts