More HMACs.
Adjust error checking, try to save logs upon error.
pkd_lib.c: spin until remote eof and close received
pkd_lib.c: make logging better
pkd_test.c: per-test stdout and stderr

Can't do log cleanup or adjustment from teardown function;
upon assert, cmocka longjmps out of the testing code.