On 07/09/2014 02:28 PM, Andreas Färber wrote: > The buffer was being allocated of size string length plus two. > Around the string two quotes were being added, but no terminating NUL. > It was then compared using g_assert_cmpstr(), resulting in fairly random > assertion failures: > > ERROR:tests/test-string-output-visitor.c:213:test_visitor_out_enum: assertion failed (str == str_human): ("\"value1\"" == "\"value1\"\001EEEEEEEEEEEEEE\0171") > > There is no g_assert_cmpnstr() counterpart, so use g_strdup_printf() > for safely assembling the string in the first place. > > Cc: Hu Tao > Cc: Michael S. Tsirkin > Suggested-by: Eric Blake > Fixes: b4900c0 tests: add human format test for string output visitor > Signed-off-by: Andreas Färber > --- > tests/test-string-output-visitor.c | 7 +------ > 1 file changed, 1 insertion(+), 6 deletions(-) Reviewed-by: Eric Blake -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org