kunit: string-stream: Add tests for freeing resource-managed string_stream
string_stream_managed_free_test() allocates a resource-managed string_stream and tests that kunit_free_string_stream() calls string_stream_destroy(). string_stream_resource_free_test() allocates a resource-managed string_stream and tests that string_stream_destroy() is called when the test resources are cleaned up. The old string_stream_init_test() has been split into two tests, one for kunit_alloc_string_stream() and the other for alloc_string_stream(). Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Reviewed-by: David Gow <davidgow@google.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
This commit is contained in:
committed by
Shuah Khan
parent
a3fdf78478
commit
d1a0d699bf
@@ -6,6 +6,7 @@
|
||||
* Author: Brendan Higgins <brendanhiggins@google.com>
|
||||
*/
|
||||
|
||||
#include <kunit/static_stub.h>
|
||||
#include <kunit/test.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/slab.h>
|
||||
@@ -170,6 +171,8 @@ struct string_stream *alloc_string_stream(gfp_t gfp)
|
||||
|
||||
void string_stream_destroy(struct string_stream *stream)
|
||||
{
|
||||
KUNIT_STATIC_STUB_REDIRECT(string_stream_destroy, stream);
|
||||
|
||||
if (!stream)
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user