[PATCH v1 0/3] net: can: j1939: Add KUnit test infrastructure

Oleksij Rempel posted 3 patches 1 month, 3 weeks ago
net/can/j1939/Kconfig                |  12 +
net/can/j1939/Makefile               |   2 +
net/can/j1939/j1939-priv.h           |  94 +++++
net/can/j1939/j1939-test.h           |  69 ++++
net/can/j1939/socket.c               |  43 ++-
net/can/j1939/tests/.kunitconfig     |   5 +
net/can/j1939/tests/Makefile         |   4 +
net/can/j1939/tests/socket_test.c    | 301 +++++++++++++++
net/can/j1939/tests/transport_test.c | 533 +++++++++++++++++++++++++++
net/can/j1939/transport.c            | 142 +++----
10 files changed, 1102 insertions(+), 103 deletions(-)
create mode 100644 net/can/j1939/j1939-test.h
create mode 100644 net/can/j1939/tests/.kunitconfig
create mode 100644 net/can/j1939/tests/Makefile
create mode 100644 net/can/j1939/tests/socket_test.c
create mode 100644 net/can/j1939/tests/transport_test.c
[PATCH v1 0/3] net: can: j1939: Add KUnit test infrastructure
Posted by Oleksij Rempel 1 month, 3 weeks ago
Hi all,

After getting one more fix for this stack, I decided to bootstrap a
KUnit test playground to allow anyone to extend it with minimal effort.

Currently it has minimal coverage and scratches on some of helper
functions. Better test coverage would be more intrusive - maybe I'll do
it in a different maintenance window.

The first two patches move some definitions to headers to make them
accessible for tests. The third patch adds the test infrastructure and
initial tests.

What's covered so far:
- Priority conversion between J1939 and sk_priority domains
- PGN validation and PDU format classification
- Socket address sanity checking
- Abort code to errno mapping
- Control message parsing for TP/ETP protocols
- Broadcast detection
- Session matching logic

Run with:
  ./tools/testing/kunit/kunit.py run --kunitconfig=net/can/j1939/tests

Oleksij Rempel (3):
  net: can: j1939: move j1939_xtp_abort enum to header
  net: can: j1939: move J1939_MIN_NAMELEN to shared header
  net: can: j1939: Add initial KUnit tests for socket and transport
    layers

 net/can/j1939/Kconfig                |  12 +
 net/can/j1939/Makefile               |   2 +
 net/can/j1939/j1939-priv.h           |  94 +++++
 net/can/j1939/j1939-test.h           |  69 ++++
 net/can/j1939/socket.c               |  43 ++-
 net/can/j1939/tests/.kunitconfig     |   5 +
 net/can/j1939/tests/Makefile         |   4 +
 net/can/j1939/tests/socket_test.c    | 301 +++++++++++++++
 net/can/j1939/tests/transport_test.c | 533 +++++++++++++++++++++++++++
 net/can/j1939/transport.c            | 142 +++----
 10 files changed, 1102 insertions(+), 103 deletions(-)
 create mode 100644 net/can/j1939/j1939-test.h
 create mode 100644 net/can/j1939/tests/.kunitconfig
 create mode 100644 net/can/j1939/tests/Makefile
 create mode 100644 net/can/j1939/tests/socket_test.c
 create mode 100644 net/can/j1939/tests/transport_test.c

--
2.47.3