Testing: no coverage data for client_cli.c and server.c — CLI and server entry points untested #136

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

Two key source files are missing from the coverage report entirely:

  • src/client/client_cli.c — 336 lines (CLI parsing, argument validation, flag conflicts)
  • src/server/server.c — server main loop and request handling

This is likely because:

  1. Coverage is collected from unit tests only (which don't run main())
  2. Integration tests run the built binaries but aren't instrumented for coverage

Impact

  • CLI flag parsing bugs are not caught by tests
  • Flag conflict detection (e.g., -f with -c) is untested
  • The --version, --help paths are untested
  • Server request handling, connection limits, error responses are untested

Suggested fixes

  1. Build with coverage instrumentation when running integration tests (-DENABLE_COVERAGE=ON + --coverage flag)
  2. Add unit tests for client_cli by refactoring CLI parsing into testable functions (parse argv into Config, separate from main)
  3. Add integration tests that exercise specific CLI flag combinations
  4. Add tests for edge cases: missing args, invalid ports, conflicting flags, env var fallbacks
  5. Add tests for server behavior: invalid requests, protocol errors, connection handling

Labels: testing, coverage, cli, server

Two key source files are **missing from the coverage report entirely**: - `src/client/client_cli.c` — 336 lines (CLI parsing, argument validation, flag conflicts) - `src/server/server.c` — server main loop and request handling This is likely because: 1. Coverage is collected from unit tests only (which don't run main()) 2. Integration tests run the built binaries but aren't instrumented for coverage ## Impact - CLI flag parsing bugs are not caught by tests - Flag conflict detection (e.g., -f with -c) is untested - The `--version`, `--help` paths are untested - Server request handling, connection limits, error responses are untested ## Suggested fixes 1. Build with coverage instrumentation when running integration tests (`-DENABLE_COVERAGE=ON` + `--coverage` flag) 2. Add unit tests for client_cli by refactoring CLI parsing into testable functions (parse argv into Config, separate from main) 3. Add integration tests that exercise specific CLI flag combinations 4. Add tests for edge cases: missing args, invalid ports, conflicting flags, env var fallbacks 5. Add tests for server behavior: invalid requests, protocol errors, connection handling **Labels**: testing, coverage, cli, server
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TapTap/FastSync#136