blob: be27510a5a232a0b003360289039dae417dfba54 [file] [log] [blame]
Michal Vasko00cbf532020-06-15 13:58:47 +02001/**
Radek Krejcif0e1ba52020-05-22 15:14:35 +02002 * @file test_inout.c
3 * @author: Radek Krejci <rkrejci@cesnet.cz>
4 * @brief unit tests for input and output handlers functions
5 *
Michal Vasko00cbf532020-06-15 13:58:47 +02006 * Copyright (c) 2020 CESNET, z.s.p.o.
Radek Krejcif0e1ba52020-05-22 15:14:35 +02007 *
8 * This source code is licensed under BSD 3-Clause License (the "License").
9 * You may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * https://opensource.org/licenses/BSD-3-Clause
13 */
Radek Iša56ca9e42020-09-08 18:42:00 +020014#define _UTEST_MAIN_
15#include "utests.h"
Radek Krejcif0e1ba52020-05-22 15:14:35 +020016
Radek Krejcif0e1ba52020-05-22 15:14:35 +020017#include <errno.h>
18#include <fcntl.h>
Radek Krejci70593c12020-06-13 20:48:09 +020019#include <stdio.h>
Radek Krejcif0e1ba52020-05-22 15:14:35 +020020#include <sys/stat.h>
Radek Krejcib4ac5a92020-11-23 17:54:33 +010021#include <sys/types.h>
Radek Krejcif0e1ba52020-05-22 15:14:35 +020022#include <unistd.h>
23
Radek Krejci70593c12020-06-13 20:48:09 +020024#include "common.h"
Radek Krejcib4ac5a92020-11-23 17:54:33 +010025#include "in.h"
Radek Krejci70593c12020-06-13 20:48:09 +020026#include "log.h"
Michal Vaskoafac7822020-10-20 14:22:26 +020027#include "out.h"
Radek Krejcif0e1ba52020-05-22 15:14:35 +020028
Michal Vasko4266d2b2022-01-19 09:13:38 +010029#define TEST_INPUT_FILE TESTS_BIN "/libyang_test_input"
30#define TEST_OUTPUT_FILE TESTS_BIN "/libyang_test_output"
31#define TEST_OUTPUT_FILE2 TESTS_BIN "/libyang_test_output2"
32
33static int
34setup_files(void **state)
35{
36 int fd;
37
38 UTEST_SETUP;
39
40 /* create input */
41 fd = open(TEST_INPUT_FILE, O_CREAT | O_WRONLY, 00600);
42 if (fd == -1) {
43 return 1;
44 }
45
46 /* write something */
47 if (write(fd, "data", 4) != 4) {
48 return 1;
49 }
50 close(fd);
51
52 /* create output */
53 fd = open(TEST_OUTPUT_FILE, O_CREAT | O_RDONLY, 00600);
54 if (fd == -1) {
55 return 1;
56 }
57 close(fd);
58
59 /* create output2 */
60 fd = open(TEST_OUTPUT_FILE2, O_CREAT | O_RDONLY, 00600);
61 if (fd == -1) {
62 return 1;
63 }
64 close(fd);
65
66 return 0;
67}
68
69static int
70teardown_files(void **state)
71{
72 unlink(TEST_INPUT_FILE);
73 unlink(TEST_OUTPUT_FILE);
74 unlink(TEST_OUTPUT_FILE2);
75
76 UTEST_TEARDOWN;
77 return 0;
78}
79
Radek Krejcif0e1ba52020-05-22 15:14:35 +020080static void
Radek Iša56ca9e42020-09-08 18:42:00 +020081test_input_mem(void **UNUSED(state))
Radek Krejcif0e1ba52020-05-22 15:14:35 +020082{
83 struct ly_in *in = NULL;
84 char *str1 = "a", *str2 = "b";
85
Radek Krejcif0e1ba52020-05-22 15:14:35 +020086 assert_int_equal(LY_EINVAL, ly_in_new_memory(NULL, NULL));
87 assert_int_equal(LY_EINVAL, ly_in_new_memory(str1, NULL));
88 assert_null(ly_in_memory(NULL, NULL));
89
90 assert_int_equal(LY_SUCCESS, ly_in_new_memory(str1, &in));
91 assert_int_equal(LY_IN_MEMORY, ly_in_type(in));
92 assert_ptr_equal(str1, ly_in_memory(in, str2));
93 assert_ptr_equal(str2, ly_in_memory(in, NULL));
94 assert_ptr_equal(str2, ly_in_memory(in, NULL));
95 ly_in_free(in, 0);
Radek Krejcif0e1ba52020-05-22 15:14:35 +020096}
97
98static void
Radek Iša56ca9e42020-09-08 18:42:00 +020099test_input_fd(void **UNUSED(state))
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200100{
101 struct ly_in *in = NULL;
102 int fd1, fd2;
103 struct stat statbuf;
104
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200105 assert_int_equal(LY_EINVAL, ly_in_new_fd(-1, NULL));
106 assert_int_equal(-1, ly_in_fd(NULL, -1));
107
Michal Vasko4266d2b2022-01-19 09:13:38 +0100108 assert_int_not_equal(-1, fd1 = open(TEST_INPUT_FILE, O_RDONLY));
109 assert_int_not_equal(-1, fd2 = open(TEST_INPUT_FILE, O_RDONLY));
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200110
111 assert_int_equal(LY_EINVAL, ly_in_new_fd(fd1, NULL));
112
113 assert_int_equal(LY_SUCCESS, ly_in_new_fd(fd1, &in));
114 assert_int_equal(LY_IN_FD, ly_in_type(in));
115 assert_ptr_equal(fd1, ly_in_fd(in, fd2));
116 assert_ptr_equal(fd2, ly_in_fd(in, -1));
117 assert_ptr_equal(fd2, ly_in_fd(in, -1));
118 ly_in_free(in, 1);
119 /* fd1 is still open */
120 assert_int_equal(0, fstat(fd1, &statbuf));
121 close(fd1);
Jan Kundrátb1568032021-12-13 20:06:17 +0100122#ifndef _WIN32
123 /* But fd2 was closed by ly_in_free(). This results in an "invalid handler" on Windows. */
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200124 errno = 0;
125 assert_int_equal(-1, fstat(fd2, &statbuf));
126 assert_int_equal(errno, EBADF);
Jan Kundrátb1568032021-12-13 20:06:17 +0100127#endif
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200128}
129
130static void
Radek Iša56ca9e42020-09-08 18:42:00 +0200131test_input_file(void **UNUSED(state))
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200132{
133 struct ly_in *in = NULL;
134 FILE *f1 = NULL, *f2 = NULL;
135
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200136 assert_int_equal(LY_EINVAL, ly_in_new_file(NULL, NULL));
137 assert_null(ly_in_file(NULL, NULL));
138
Michal Vasko4266d2b2022-01-19 09:13:38 +0100139 assert_non_null(f1 = fopen(TEST_INPUT_FILE, "rb"));
140 assert_non_null(f2 = fopen(TEST_INPUT_FILE, "rb"));
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200141
142 assert_int_equal(LY_EINVAL, ly_in_new_file(f1, NULL));
143
144 assert_int_equal(LY_SUCCESS, ly_in_new_file(f1, &in));
145 assert_int_equal(LY_IN_FILE, ly_in_type(in));
146 assert_ptr_equal(f1, ly_in_file(in, f2));
147 assert_ptr_equal(f2, ly_in_file(in, NULL));
148 assert_ptr_equal(f2, ly_in_file(in, NULL));
149 ly_in_free(in, 1);
150 /* f1 is still open */
151 assert_int_not_equal(-1, fileno(f1));
152 fclose(f1);
153 /* but f2 was closed by ly_in_free() */
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200154}
155
156static void
Radek Iša56ca9e42020-09-08 18:42:00 +0200157test_input_filepath(void **UNUSED(state))
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200158{
159 struct ly_in *in = NULL;
Michal Vasko4266d2b2022-01-19 09:13:38 +0100160 const char *path1 = TEST_INPUT_FILE, *path2 = TEST_INPUT_FILE;
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200161
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200162 assert_int_equal(LY_EINVAL, ly_in_new_filepath(NULL, 0, NULL));
163 assert_int_equal(LY_EINVAL, ly_in_new_filepath(path1, 0, NULL));
164 assert_ptr_equal(((void *)-1), ly_in_filepath(NULL, NULL, 0));
165
166 assert_int_equal(LY_SUCCESS, ly_in_new_filepath(path1, 0, &in));
167 assert_int_equal(LY_IN_FILEPATH, ly_in_type(in));
168 assert_ptr_equal(NULL, ly_in_filepath(in, path2, 0));
169 assert_string_equal(path2, ly_in_filepath(in, NULL, 0));
170 ly_in_free(in, 0);
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200171}
172
173static void
Radek Iša56ca9e42020-09-08 18:42:00 +0200174test_output_mem(void **UNUSED(state))
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200175{
176 struct ly_out *out = NULL;
177 char *buf1 = NULL, *buf2 = NULL;
178
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200179 /* manipulate with the handler */
180 assert_int_equal(LY_SUCCESS, ly_out_new_memory(&buf1, 0, &out));
181 assert_int_equal(LY_OUT_MEMORY, ly_out_type(out));
182 ly_write(out, "test", 4);
183 assert_ptr_equal(buf1, ly_out_memory(out, &buf2, 0));
184 assert_ptr_equal(buf2, ly_out_memory(out, NULL, 0));
185 assert_ptr_equal(buf2, ly_out_memory(out, &buf1, strlen(buf1)));
186 ly_out_free(out, NULL, 0);
187
188 assert_int_equal(LY_SUCCESS, ly_out_new_memory(&buf1, strlen(buf1), &out));
189 ly_out_free(out, NULL, 1);
190
191 /* writing data */
192
193 assert_int_equal(LY_SUCCESS, ly_out_new_memory(&buf1, 0, &out));
Michal Vasko5233e962020-08-14 14:26:20 +0200194 assert_int_equal(LY_SUCCESS, ly_print(out, "test %s", "print"));
195 assert_int_equal(10, ly_out_printed(out));
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200196 assert_string_equal("test print", buf1);
197 assert_int_equal(LY_SUCCESS, ly_out_reset(out));
Michal Vasko5233e962020-08-14 14:26:20 +0200198 assert_int_equal(LY_SUCCESS, ly_write(out, "rewrite", 8));
199 assert_int_equal(8, ly_out_printed(out));
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200200 assert_string_equal("rewrite", buf1);
201 ly_out_free(out, NULL, 1);
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200202}
203
204static void
Radek Iša56ca9e42020-09-08 18:42:00 +0200205test_output_fd(void **UNUSED(state))
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200206{
207 struct ly_out *out = NULL;
208 int fd1, fd2;
209 char buf[31] = {0};
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200210
Michal Vasko4266d2b2022-01-19 09:13:38 +0100211 assert_int_not_equal(-1, fd1 = open(TEST_OUTPUT_FILE, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR));
212 assert_int_not_equal(-1, fd2 = open(TEST_OUTPUT_FILE, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR));
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200213
214 /* manipulate with the handler */
215 assert_int_equal(LY_SUCCESS, ly_out_new_fd(fd1, &out));
216 assert_int_equal(LY_OUT_FD, ly_out_type(out));
217 assert_ptr_equal(fd1, ly_out_fd(out, fd2));
218 assert_ptr_equal(fd2, ly_out_fd(out, -1));
219 assert_ptr_equal(fd2, ly_out_fd(out, fd1));
220 ly_out_free(out, NULL, 0);
221 assert_int_equal(0, close(fd2));
222 assert_int_equal(LY_SUCCESS, ly_out_new_fd(fd1, &out));
223 ly_out_free(out, NULL, 1);
224
225 /* writing data */
Michal Vasko4266d2b2022-01-19 09:13:38 +0100226 assert_int_not_equal(-1, fd1 = open(TEST_OUTPUT_FILE, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR));
227 assert_int_not_equal(-1, fd2 = open(TEST_OUTPUT_FILE, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR));
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200228 /* truncate file to start with no data */
229 assert_int_equal(0, ftruncate(fd1, 0));
230
231 assert_int_equal(LY_SUCCESS, ly_out_new_fd(fd1, &out));
Michal Vasko5233e962020-08-14 14:26:20 +0200232 assert_int_equal(LY_SUCCESS, ly_print(out, "test %s", "print"));
233 assert_int_equal(10, ly_out_printed(out));
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200234 ly_print_flush(out);
235 assert_int_equal(10, read(fd2, buf, 30));
236 assert_string_equal("test print", buf);
237 assert_int_equal(0, lseek(fd2, 0, SEEK_SET));
238 assert_int_equal(LY_SUCCESS, ly_out_reset(out));
239
Michal Vasko5233e962020-08-14 14:26:20 +0200240 assert_int_equal(LY_SUCCESS, ly_write(out, "rewrite", 8));
241 assert_int_equal(8, ly_out_printed(out));
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200242 ly_print_flush(out);
243 assert_int_equal(8, read(fd2, buf, 30));
244 assert_string_equal("rewrite", buf);
245
246 close(fd2);
247 ly_out_free(out, NULL, 1);
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200248}
249
250static void
Radek Iša56ca9e42020-09-08 18:42:00 +0200251test_output_file(void **UNUSED(state))
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200252{
253 struct ly_out *out = NULL;
254 FILE *f1, *f2;
255 char buf[31] = {0};
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200256
Michal Vasko4266d2b2022-01-19 09:13:38 +0100257 assert_non_null(f1 = fopen(TEST_OUTPUT_FILE, "wb"));
258 assert_non_null(f2 = fopen(TEST_OUTPUT_FILE, "wb"));
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200259
260 /* manipulate with the handler */
261 assert_int_equal(LY_SUCCESS, ly_out_new_file(f1, &out));
262 assert_int_equal(LY_OUT_FILE, ly_out_type(out));
263 assert_ptr_equal(f1, ly_out_file(out, f2));
264 assert_ptr_equal(f2, ly_out_file(out, NULL));
265 assert_ptr_equal(f2, ly_out_file(out, f1));
266 ly_out_free(out, NULL, 0);
267 assert_int_equal(0, fclose(f2));
268 assert_int_equal(LY_SUCCESS, ly_out_new_file(f1, &out));
269 ly_out_free(out, NULL, 1);
270
271 /* writing data */
Michal Vasko4266d2b2022-01-19 09:13:38 +0100272 assert_non_null(f1 = fopen(TEST_OUTPUT_FILE, "wb"));
273 assert_non_null(f2 = fopen(TEST_OUTPUT_FILE, "rb"));
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200274
275 assert_int_equal(LY_SUCCESS, ly_out_new_file(f1, &out));
Michal Vasko5233e962020-08-14 14:26:20 +0200276 assert_int_equal(LY_SUCCESS, ly_print(out, "test %s", "print"));
277 assert_int_equal(10, ly_out_printed(out));
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200278 ly_print_flush(out);
279 assert_non_null(fgets(buf, 31, f2));
280 assert_string_equal("test print", buf);
281 assert_int_equal(0, fseek(f2, 0, SEEK_SET));
282 assert_int_equal(LY_SUCCESS, ly_out_reset(out));
283
Michal Vasko5233e962020-08-14 14:26:20 +0200284 assert_int_equal(LY_SUCCESS, ly_write(out, "rewrite", 8));
285 assert_int_equal(8, ly_out_printed(out));
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200286 ly_print_flush(out);
287 assert_non_null(fgets(buf, 31, f2));
288 assert_string_equal("rewrite", buf);
289
290 fclose(f2);
291 ly_out_free(out, NULL, 1);
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200292}
293
294static void
Radek Iša56ca9e42020-09-08 18:42:00 +0200295test_output_filepath(void **UNUSED(state))
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200296{
297 struct ly_out *out = NULL;
298 FILE *f1;
299 char buf[31] = {0};
Michal Vasko4266d2b2022-01-19 09:13:38 +0100300 const char *fp1 = TEST_OUTPUT_FILE;
301 const char *fp2 = TEST_OUTPUT_FILE2;
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200302
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200303 /* manipulate with the handler */
304 assert_int_equal(LY_SUCCESS, ly_out_new_filepath(fp1, &out));
305 assert_int_equal(LY_OUT_FILEPATH, ly_out_type(out));
306 assert_ptr_equal(NULL, ly_out_filepath(out, fp2));
307 assert_string_equal(fp2, ly_out_filepath(out, NULL));
308 assert_ptr_equal(NULL, ly_out_filepath(out, fp1));
309 ly_out_free(out, NULL, 0);
310 assert_int_equal(LY_SUCCESS, ly_out_new_filepath(fp1, &out));
311 ly_out_free(out, NULL, 1);
312
313 /* writing data */
Michal Vasko4266d2b2022-01-19 09:13:38 +0100314 assert_non_null(f1 = fopen(fp1, "rb"));
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200315
316 assert_int_equal(LY_SUCCESS, ly_out_new_filepath(fp1, &out));
Michal Vasko5233e962020-08-14 14:26:20 +0200317 assert_int_equal(LY_SUCCESS, ly_print(out, "test %s", "print"));
318 assert_int_equal(10, ly_out_printed(out));
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200319 ly_print_flush(out);
320 assert_non_null(fgets(buf, 31, f1));
321 assert_string_equal("test print", buf);
322 assert_int_equal(0, fseek(f1, 0, SEEK_SET));
323 assert_int_equal(LY_SUCCESS, ly_out_reset(out));
324
Michal Vasko5233e962020-08-14 14:26:20 +0200325 assert_int_equal(LY_SUCCESS, ly_write(out, "rewrite", 8));
326 assert_int_equal(8, ly_out_printed(out));
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200327 ly_print_flush(out);
328 assert_non_null(fgets(buf, 31, f1));
329 assert_string_equal("rewrite", buf);
330
331 fclose(f1);
332 ly_out_free(out, NULL, 1);
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200333}
334
Michal Vasko8759f3c2021-09-22 12:19:43 +0200335static ssize_t
336write_clb(void *user_data, const void *buf, size_t count)
337{
338 return write((uintptr_t)user_data, buf, count);
339}
340
341void
342close_clb(void *arg)
343{
344 close((uintptr_t)arg);
345}
346
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200347static void
Radek Iša56ca9e42020-09-08 18:42:00 +0200348test_output_clb(void **UNUSED(state))
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200349{
350 struct ly_out *out = NULL;
351 int fd1, fd2;
352 char buf[31] = {0};
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200353
Michal Vasko4266d2b2022-01-19 09:13:38 +0100354 assert_int_not_equal(-1, fd1 = open(TEST_OUTPUT_FILE, O_RDWR));
355 assert_int_not_equal(-1, fd2 = open(TEST_OUTPUT_FILE, O_RDWR));
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200356
357 /* manipulate with the handler */
Michal Vasko8759f3c2021-09-22 12:19:43 +0200358 assert_int_equal(LY_SUCCESS, ly_out_new_clb(write_clb, (void *)(intptr_t)fd1, &out));
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200359 assert_int_equal(LY_OUT_CALLBACK, ly_out_type(out));
Radek Krejcib4ac5a92020-11-23 17:54:33 +0100360 assert_ptr_equal(fd1, ly_out_clb_arg(out, (void *)(intptr_t)fd2));
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200361 assert_ptr_equal(fd2, ly_out_clb_arg(out, NULL));
Radek Krejcib4ac5a92020-11-23 17:54:33 +0100362 assert_ptr_equal(fd2, ly_out_clb_arg(out, (void *)(intptr_t)fd1));
Michal Vasko8759f3c2021-09-22 12:19:43 +0200363 assert_ptr_equal(write_clb, ly_out_clb(out, write_clb));
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200364 ly_out_free(out, NULL, 0);
365 assert_int_equal(0, close(fd2));
Michal Vasko8759f3c2021-09-22 12:19:43 +0200366 assert_int_equal(LY_SUCCESS, ly_out_new_clb(write_clb, (void *)(intptr_t)fd1, &out));
367 ly_out_free(out, close_clb, 0);
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200368
369 /* writing data */
Michal Vasko4266d2b2022-01-19 09:13:38 +0100370 assert_int_not_equal(-1, fd1 = open(TEST_OUTPUT_FILE, O_RDWR));
371 assert_int_not_equal(-1, fd2 = open(TEST_OUTPUT_FILE, O_RDWR));
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200372 /* truncate file to start with no data */
373 assert_int_equal(0, ftruncate(fd1, 0));
374
Michal Vasko8759f3c2021-09-22 12:19:43 +0200375 assert_int_equal(LY_SUCCESS, ly_out_new_clb(write_clb, (void *)(intptr_t)fd1, &out));
Michal Vasko5233e962020-08-14 14:26:20 +0200376 assert_int_equal(LY_SUCCESS, ly_print(out, "test %s", "print"));
377 assert_int_equal(10, ly_out_printed(out));
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200378 assert_int_equal(10, read(fd2, buf, 30));
379 assert_string_equal("test print", buf);
380
381 close(fd2);
Michal Vasko8759f3c2021-09-22 12:19:43 +0200382 ly_out_free(out, close_clb, 0);
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200383}
384
Radek Krejcib4ac5a92020-11-23 17:54:33 +0100385int
386main(void)
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200387{
388 const struct CMUnitTest tests[] = {
Radek Iša56ca9e42020-09-08 18:42:00 +0200389 UTEST(test_input_mem),
Michal Vasko4266d2b2022-01-19 09:13:38 +0100390 UTEST(test_input_fd, setup_files, teardown_files),
391 UTEST(test_input_file, setup_files, teardown_files),
392 UTEST(test_input_filepath, setup_files, teardown_files),
Radek Iša56ca9e42020-09-08 18:42:00 +0200393 UTEST(test_output_mem),
Michal Vasko4266d2b2022-01-19 09:13:38 +0100394 UTEST(test_output_fd, setup_files, teardown_files),
395 UTEST(test_output_file, setup_files, teardown_files),
396 UTEST(test_output_filepath, setup_files, teardown_files),
397 UTEST(test_output_clb, setup_files, teardown_files),
Radek Krejcif0e1ba52020-05-22 15:14:35 +0200398 };
399
400 return cmocka_run_group_tests(tests, NULL, NULL);
401}