Lines Matching refs:stream

30 static char *get_concatenated_string(struct kunit *test, struct string_stream *stream)  in get_concatenated_string()  argument
32 char *str = string_stream_get_string(stream); in get_concatenated_string()
43 struct string_stream *stream; in string_stream_managed_init_test() local
46 stream = kunit_alloc_string_stream(test, GFP_KERNEL); in string_stream_managed_init_test()
47 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, stream); in string_stream_managed_init_test()
49 KUNIT_EXPECT_EQ(test, stream->length, 0); in string_stream_managed_init_test()
50 KUNIT_EXPECT_TRUE(test, list_empty(&stream->fragments)); in string_stream_managed_init_test()
51 KUNIT_EXPECT_TRUE(test, (stream->gfp == GFP_KERNEL)); in string_stream_managed_init_test()
52 KUNIT_EXPECT_FALSE(test, stream->append_newlines); in string_stream_managed_init_test()
53 KUNIT_EXPECT_TRUE(test, string_stream_is_empty(stream)); in string_stream_managed_init_test()
59 struct string_stream *stream; in string_stream_unmanaged_init_test() local
61 stream = alloc_string_stream(GFP_KERNEL); in string_stream_unmanaged_init_test()
62 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, stream); in string_stream_unmanaged_init_test()
63 kunit_add_action(test, cleanup_raw_stream, stream); in string_stream_unmanaged_init_test()
65 KUNIT_EXPECT_EQ(test, stream->length, 0); in string_stream_unmanaged_init_test()
66 KUNIT_EXPECT_TRUE(test, list_empty(&stream->fragments)); in string_stream_unmanaged_init_test()
67 KUNIT_EXPECT_TRUE(test, (stream->gfp == GFP_KERNEL)); in string_stream_unmanaged_init_test()
68 KUNIT_EXPECT_FALSE(test, stream->append_newlines); in string_stream_unmanaged_init_test()
70 KUNIT_EXPECT_TRUE(test, string_stream_is_empty(stream)); in string_stream_unmanaged_init_test()
73 static void string_stream_destroy_stub(struct string_stream *stream) in string_stream_destroy_stub() argument
79 if (stream == priv->expected_free_stream) { in string_stream_destroy_stub()
92 string_stream_clear(stream); in string_stream_destroy_stub()
93 kfree(stream); in string_stream_destroy_stub()
165 struct string_stream *stream; in string_stream_line_add_test() local
171 stream = kunit_alloc_string_stream(test, GFP_KERNEL); in string_stream_line_add_test()
172 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, stream); in string_stream_line_add_test()
183 string_stream_add(stream, line); in string_stream_line_add_test()
188 concat_string = get_concatenated_string(test, stream); in string_stream_line_add_test()
221 struct string_stream *stream; in string_stream_variable_length_line_test() local
227 stream = kunit_alloc_string_stream(test, GFP_KERNEL); in string_stream_variable_length_line_test()
228 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, stream); in string_stream_variable_length_line_test()
239 string_stream_add(stream, "%s\n", &line[offset]); in string_stream_variable_length_line_test()
244 concat_string = get_concatenated_string(test, stream); in string_stream_variable_length_line_test()
381 struct string_stream *stream; in string_stream_append_empty_string_test() local
384 stream = kunit_alloc_string_stream(test, GFP_KERNEL); in string_stream_append_empty_string_test()
385 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, stream); in string_stream_append_empty_string_test()
388 string_stream_add(stream, "%s", ""); in string_stream_append_empty_string_test()
389 KUNIT_EXPECT_TRUE(test, string_stream_is_empty(stream)); in string_stream_append_empty_string_test()
390 KUNIT_EXPECT_TRUE(test, list_empty(&stream->fragments)); in string_stream_append_empty_string_test()
393 string_stream_add(stream, "Add this line"); in string_stream_append_empty_string_test()
394 original_frag_count = list_count_nodes(&stream->fragments); in string_stream_append_empty_string_test()
396 string_stream_add(stream, "%s", ""); in string_stream_append_empty_string_test()
397 KUNIT_EXPECT_EQ(test, list_count_nodes(&stream->fragments), original_frag_count); in string_stream_append_empty_string_test()
398 KUNIT_EXPECT_STREQ(test, get_concatenated_string(test, stream), "Add this line"); in string_stream_append_empty_string_test()
404 struct string_stream *stream; in string_stream_no_auto_newline_test() local
406 stream = kunit_alloc_string_stream(test, GFP_KERNEL); in string_stream_no_auto_newline_test()
407 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, stream); in string_stream_no_auto_newline_test()
413 string_stream_add(stream, "One"); in string_stream_no_auto_newline_test()
414 string_stream_add(stream, "Two\n"); in string_stream_no_auto_newline_test()
415 string_stream_add(stream, "%s\n", "Three"); in string_stream_no_auto_newline_test()
416 string_stream_add(stream, "%s", "Four\n"); in string_stream_no_auto_newline_test()
417 string_stream_add(stream, "Five\n%s", "Six"); in string_stream_no_auto_newline_test()
418 string_stream_add(stream, "Seven\n\n"); in string_stream_no_auto_newline_test()
419 string_stream_add(stream, "Eight"); in string_stream_no_auto_newline_test()
420 KUNIT_EXPECT_STREQ(test, get_concatenated_string(test, stream), in string_stream_no_auto_newline_test()
427 struct string_stream *stream; in string_stream_auto_newline_test() local
429 stream = kunit_alloc_string_stream(test, GFP_KERNEL); in string_stream_auto_newline_test()
430 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, stream); in string_stream_auto_newline_test()
432 string_stream_set_append_newlines(stream, true); in string_stream_auto_newline_test()
433 KUNIT_EXPECT_TRUE(test, stream->append_newlines); in string_stream_auto_newline_test()
440 string_stream_add(stream, "One"); in string_stream_auto_newline_test()
441 string_stream_add(stream, "Two\n"); in string_stream_auto_newline_test()
442 string_stream_add(stream, "%s\n", "Three"); in string_stream_auto_newline_test()
443 string_stream_add(stream, "%s", "Four\n"); in string_stream_auto_newline_test()
444 string_stream_add(stream, "Five\n%s", "Six"); in string_stream_auto_newline_test()
445 string_stream_add(stream, "Seven\n\n"); in string_stream_auto_newline_test()
446 string_stream_add(stream, "Eight"); in string_stream_auto_newline_test()
447 KUNIT_EXPECT_STREQ(test, get_concatenated_string(test, stream), in string_stream_auto_newline_test()
458 struct string_stream *stream; in string_stream_performance_test() local
464 stream = kunit_alloc_string_stream(test, GFP_KERNEL); in string_stream_performance_test()
465 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, stream); in string_stream_performance_test()
473 string_stream_add(stream, "%s: %d\n", &test_line[offset], i); in string_stream_performance_test()
481 bytes_requested = sizeof(*stream); in string_stream_performance_test()
482 actual_bytes_used = ksize(stream); in string_stream_performance_test()
485 list_for_each_entry(frag_container, &stream->fragments, node) { in string_stream_performance_test()