tests: provide test_build_str()
Many test cases use asprintf() to build custom strings. This routine
can fail and the return value is tested using the TEST_ASSERT macros
but this is not the subject of the actual testing. The test case must
also free the string allocated by this function.
As a simplification: pull this functionality into the testing
framework so that we can build custom strings without keeping track of
resources. The new function will also make the whole test suite die if
the internal asprintf() call fails.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>