xref: /openbmc/u-boot/test/ut.c (revision 8379c799)
1 /*
2  * Simple unit test library
3  *
4  * Copyright (c) 2013 Google, Inc
5  *
6  * SPDX-License-Identifier:	GPL-2.0+
7  */
8 
9 #include <common.h>
10 #include <test/test.h>
11 #include <test/ut.h>
12 
13 void ut_fail(struct unit_test_state *uts, const char *fname, int line,
14 	     const char *func, const char *cond)
15 {
16 	printf("%s:%d, %s(): %s\n", fname, line, func, cond);
17 	uts->fail_count++;
18 }
19 
20 void ut_failf(struct unit_test_state *uts, const char *fname, int line,
21 	      const char *func, const char *cond, const char *fmt, ...)
22 {
23 	va_list args;
24 
25 	printf("%s:%d, %s(): %s: ", fname, line, func, cond);
26 	va_start(args, fmt);
27 	vprintf(fmt, args);
28 	va_end(args);
29 	putc('\n');
30 	uts->fail_count++;
31 }
32