tests: provide test_build_str()
authorBartosz Golaszewski <bartekgola@gmail.com>
Sun, 5 Nov 2017 13:21:54 +0000 (14:21 +0100)
committerBartosz Golaszewski <bartekgola@gmail.com>
Sun, 5 Nov 2017 13:31:21 +0000 (14:31 +0100)
commit8cae086f0497ccd89f06a3568bce276002126635
treec508962664d97a19499a7bfcc3285554c4c3de90
parent230868dcfadd24c8a1cbad7ee4a42127cd4fe127
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>
tests/gpiod-test.c
tests/gpiod-test.h