@@ -24,6 +24,7 @@ static void mkdtemp_chdir_chattr(char *path) {
2424}
2525
2626static void test_non_empty (void ) {
27+ _cleanup_ (mmap_cache_unrefp ) MMapCache * m = NULL ;
2728 dual_timestamp ts ;
2829 JournaldFile * f ;
2930 struct iovec iovec ;
@@ -35,9 +36,12 @@ static void test_non_empty(void) {
3536
3637 test_setup_logging (LOG_DEBUG );
3738
39+ m = mmap_cache_new ();
40+ assert_se (m != NULL );
41+
3842 mkdtemp_chdir_chattr (t );
3943
40- assert_se (journald_file_open (-1 , "test.journal" , O_RDWR |O_CREAT , 0666 , true, UINT64_MAX , true, NULL , NULL , NULL , NULL , & f ) == 0 );
44+ assert_se (journald_file_open (-1 , "test.journal" , O_RDWR |O_CREAT , 0666 , true, UINT64_MAX , true, NULL , m , NULL , NULL , & f ) == 0 );
4145
4246 assert_se (dual_timestamp_get (& ts ));
4347 assert_se (sd_id128_randomize (& fake_boot_id ) == 0 );
@@ -98,8 +102,8 @@ static void test_non_empty(void) {
98102
99103 assert_se (journal_file_move_to_entry_by_seqnum (f -> file , 10 , DIRECTION_DOWN , & o , NULL ) == 0 );
100104
101- journald_file_rotate (& f , true, UINT64_MAX , true, NULL );
102- journald_file_rotate (& f , true, UINT64_MAX , true, NULL );
105+ journald_file_rotate (& f , m , true, UINT64_MAX , true, NULL );
106+ journald_file_rotate (& f , m , true, UINT64_MAX , true, NULL );
103107
104108 (void ) journald_file_close (f );
105109
@@ -117,17 +121,21 @@ static void test_non_empty(void) {
117121}
118122
119123static void test_empty (void ) {
124+ _cleanup_ (mmap_cache_unrefp ) MMapCache * m = NULL ;
120125 JournaldFile * f1 , * f2 , * f3 , * f4 ;
121126 char t [] = "/var/tmp/journal-XXXXXX" ;
122127
123128 test_setup_logging (LOG_DEBUG );
124129
130+ m = mmap_cache_new ();
131+ assert_se (m != NULL );
132+
125133 mkdtemp_chdir_chattr (t );
126134
127- assert_se (journald_file_open (-1 , "test.journal" , O_RDWR |O_CREAT , 0666 , false, UINT64_MAX , false, NULL , NULL , NULL , NULL , & f1 ) == 0 );
128- assert_se (journald_file_open (-1 , "test-compress.journal" , O_RDWR |O_CREAT , 0666 , true, UINT64_MAX , false, NULL , NULL , NULL , NULL , & f2 ) == 0 );
129- assert_se (journald_file_open (-1 , "test-seal.journal" , O_RDWR |O_CREAT , 0666 , false, UINT64_MAX , true, NULL , NULL , NULL , NULL , & f3 ) == 0 );
130- assert_se (journald_file_open (-1 , "test-seal-compress.journal" , O_RDWR |O_CREAT , 0666 , true, UINT64_MAX , true, NULL , NULL , NULL , NULL , & f4 ) == 0 );
135+ assert_se (journald_file_open (-1 , "test.journal" , O_RDWR |O_CREAT , 0666 , false, UINT64_MAX , false, NULL , m , NULL , NULL , & f1 ) == 0 );
136+ assert_se (journald_file_open (-1 , "test-compress.journal" , O_RDWR |O_CREAT , 0666 , true, UINT64_MAX , false, NULL , m , NULL , NULL , & f2 ) == 0 );
137+ assert_se (journald_file_open (-1 , "test-seal.journal" , O_RDWR |O_CREAT , 0666 , false, UINT64_MAX , true, NULL , m , NULL , NULL , & f3 ) == 0 );
138+ assert_se (journald_file_open (-1 , "test-seal-compress.journal" , O_RDWR |O_CREAT , 0666 , true, UINT64_MAX , true, NULL , m , NULL , NULL , & f4 ) == 0 );
131139
132140 journal_file_print_header (f1 -> file );
133141 puts ("" );
@@ -156,6 +164,7 @@ static void test_empty(void) {
156164
157165#if HAVE_COMPRESSION
158166static bool check_compressed (uint64_t compress_threshold , uint64_t data_size ) {
167+ _cleanup_ (mmap_cache_unrefp ) MMapCache * m = NULL ;
159168 dual_timestamp ts ;
160169 JournaldFile * f ;
161170 struct iovec iovec ;
@@ -170,9 +179,12 @@ static bool check_compressed(uint64_t compress_threshold, uint64_t data_size) {
170179
171180 test_setup_logging (LOG_DEBUG );
172181
182+ m = mmap_cache_new ();
183+ assert_se (m != NULL );
184+
173185 mkdtemp_chdir_chattr (t );
174186
175- assert_se (journald_file_open (-1 , "test.journal" , O_RDWR |O_CREAT , 0666 , true, compress_threshold , true, NULL , NULL , NULL , NULL , & f ) == 0 );
187+ assert_se (journald_file_open (-1 , "test.journal" , O_RDWR |O_CREAT , 0666 , true, compress_threshold , true, NULL , m , NULL , NULL , & f ) == 0 );
176188
177189 dual_timestamp_get (& ts );
178190
0 commit comments