Testing: multiprocessing.c has only 42% coverage — server thread functions untested #137

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

src/shared/multiprocessing.c has only 42% coverage (48/112 lines). Three key functions are completely uncovered:

Function Line Status
receive_chunk_enqueue() 84 0 hits
receive_thread() 98 0 hits
write_thread() 143 0 hits

These are the server-side multithreading pipeline functions responsible for receiving chunks from the network and writing them to disk. The covered code is mostly the client-side pipeline creation and teardown.

Root cause

  • The server multithreading path is never exercised by unit tests
  • Integration tests start a server but it uses fork() for concurrency, not the thread pool
  • No test creates a threaded server and sends data to it

Suggested tests

  1. Create a test that starts server threads manually using create_pipeline_context_server()
  2. Feed data through the receive thread and verify write thread output
  3. Test queue overflow/underflow in the server pipeline
  4. Test clean shutdown (SIGTERM handling in worker threads)
  5. Test error propagation from worker to main thread

Labels: testing, coverage, threading, server

`src/shared/multiprocessing.c` has only **42% coverage** (48/112 lines). Three key functions are completely uncovered: | Function | Line | Status | |----------|------|--------| | `receive_chunk_enqueue()` | 84 | 0 hits | | `receive_thread()` | 98 | 0 hits | | `write_thread()` | 143 | 0 hits | These are the server-side multithreading pipeline functions responsible for receiving chunks from the network and writing them to disk. The covered code is mostly the client-side pipeline creation and teardown. ## Root cause - The server multithreading path is never exercised by unit tests - Integration tests start a server but it uses `fork()` for concurrency, not the thread pool - No test creates a threaded server and sends data to it ## Suggested tests 1. Create a test that starts server threads manually using `create_pipeline_context_server()` 2. Feed data through the receive thread and verify write thread output 3. Test queue overflow/underflow in the server pipeline 4. Test clean shutdown (SIGTERM handling in worker threads) 5. Test error propagation from worker to main thread **Labels**: testing, coverage, threading, server
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TapTap/FastSync#137