pcloudcc-lneely/tests/unit-tests
Levi Neely 78a517ebba Implement Tasks #11 and #12: plocks stress test + pfsupload send tests
Task #11 — plocks.c stress test (test_plocks.c)
  7 tests: basic rdlock/wrlock round-trip, recursive TLS counting (same
  thread acquires rdlock N times; unlock only releases on final decrement),
  upgrade under contention (N readers + towrlock; barrier-synchronized),
  writer starvation prevention (sustained reader load; writer acquires
  within 500ms), N-reader + M-writer counter-integrity stress test (ASAN),
  and try-variant contention (trywrlock fails when another thread holds
  rdlock).  TSAN note documented: custom lock internals require ASAN-only
  when ThreadSanitizer annotations are absent.

Task #12 — pfsupload send-function tests (pfsupload_send.c/h + test_pfsupload.c)
  Extract psync_send_task_mkdir and psync_send_task_rmdir from pfsupload.c
  into pclsync/pfsupload_send.c as non-static pfsupload_send_mkdir/rmdir.
  Expose fsupload_task_t struct via pclsync/pfsupload_send.h.  Add
  __attribute__((weak)) get_urls() as an injectable URL seam for large-
  upload paths.  pfsupload.c updated to include pfsupload_send.h and use
  the renamed functions in its dispatch table; pfsupload_send.o is
  automatically picked up by the production wildcard build.

  5 tests: mkdir (non-encrypted) command + folderid param, mkdir
  (encrypted) key param present, rmdir command + sfolderid, API error path
  (papi_send failure → -1), get_urls() weak override.  Uses
  --wrap=papi_send to intercept API calls and socketpair() to provide a
  valid psock_t without real network I/O.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 07:38:48 +01:00
..
test_pdbg_path.c Add GitHub Actions CI workflow for unit tests (#379) 2026-03-10 17:48:42 +01:00
test_pfs_lock_ordering.c Fix pcl-zqv.5.7: eliminate deadlock in pfs_get_both_locks (#339) 2026-03-03 19:33:56 +01:00
test_pfstasks_db.c Fix P1 review findings in pfstasks_db test and helpers 2026-03-10 19:53:16 +01:00
test_pfstasks_tree.c Implement Tasks #3, #4, #5: tree tests, pfstasks tree layer, DB harness 2026-03-10 19:48:22 +01:00
test_pfsupload.c Implement Tasks #11 and #12: plocks stress test + pfsupload send tests 2026-03-11 07:38:48 +01:00
test_pintervaltree.c Implement Tasks #3, #4, #5: tree tests, pfstasks tree layer, DB harness 2026-03-10 19:48:22 +01:00
test_plocks.c Implement Tasks #11 and #12: plocks stress test + pfsupload send tests 2026-03-11 07:38:48 +01:00
test_prun.c Add GitHub Actions CI workflow for unit tests (#379) 2026-03-10 17:48:42 +01:00
test_ptask_free.c Refactor test_ptask_free to link production code via --wrap 2026-03-10 19:32:05 +01:00
test_ptools_errptr.c Fix ASAN/LSAN failures: ppath_home stack-use-after-scope + intentional leak 2026-03-10 19:59:33 +01:00
test_ptools_params.c Fix pcl-a1j: buffer overflow in ptools_create_backend_event() via unchecked sprintf and strcat (#355) 2026-03-07 18:35:43 +01:00
test_ptree.c Implement Tasks #3, #4, #5: tree tests, pfstasks tree layer, DB harness 2026-03-10 19:48:22 +01:00
test_read_response.cpp Add GitHub Actions CI workflow for unit tests (#379) 2026-03-10 17:48:42 +01:00