Testing: config.c has only 33% coverage — protocol serialization untested #133

Closed
opened 2026-07-21 16:26:50 +02:00 by TapTap · 0 comments
Owner

src/shared/config.c has only 33% coverage (66/197 lines). The two most critical functions — config_send() and config_receive() — have zero hits. These functions serialize/deserialize the configuration over the wire, so bugs here cause protocol desync or silent data corruption.

Also uncovered:

  • Config validation logic
  • Error handling paths (version mismatch, malformed config)
  • Edge cases around string fields (empty strings, long paths, null pointers)
  • Transfer of boolean/int fields over wire

Suggested tests

  1. config_send() + config_receive() round-trip — create Config, serialize to buffer, deserialize, verify all fields match
  2. Round-trip with all field combinations (compression on/off, multithreading, metadata, TLS, etc.)
  3. Round-trip with edge-case strings (empty, very long, unicode, null characters)
  4. Version mismatch handling
  5. Partial/corrupted data recovery
  6. Test that TLS cert/key paths are NOT sent over wire (security requirement)

Use a memory buffer (pipe or socketpair) as the file descriptor to avoid actual network I/O.

Labels: testing, coverage, protocol

`src/shared/config.c` has only **33% coverage** (66/197 lines). The two most critical functions — `config_send()` and `config_receive()` — have **zero hits**. These functions serialize/deserialize the configuration over the wire, so bugs here cause protocol desync or silent data corruption. Also uncovered: - Config validation logic - Error handling paths (version mismatch, malformed config) - Edge cases around string fields (empty strings, long paths, null pointers) - Transfer of boolean/int fields over wire ## Suggested tests 1. `config_send()` + `config_receive()` round-trip — create Config, serialize to buffer, deserialize, verify all fields match 2. Round-trip with all field combinations (compression on/off, multithreading, metadata, TLS, etc.) 3. Round-trip with edge-case strings (empty, very long, unicode, null characters) 4. Version mismatch handling 5. Partial/corrupted data recovery 6. Test that TLS cert/key paths are NOT sent over wire (security requirement) Use a memory buffer (pipe or socketpair) as the file descriptor to avoid actual network I/O. **Labels**: testing, coverage, protocol
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TapTap/FastSync#133