]> git.ipfire.org Git - people/ms/u-boot.git/blame - test/ut.c
Merge branch 'master' of git://git.denx.de/u-boot-spi
[people/ms/u-boot.git] / test / ut.c
CommitLineData
2e7d35d2 1/*
e721b882 2 * Simple unit test library
2e7d35d2
SG
3 *
4 * Copyright (c) 2013 Google, Inc
5 *
6 * SPDX-License-Identifier: GPL-2.0+
7 */
8
9#include <common.h>
e721b882
JH
10#include <test/test.h>
11#include <test/ut.h>
2e7d35d2 12
e721b882 13void ut_fail(struct unit_test_state *uts, const char *fname, int line,
2e7d35d2
SG
14 const char *func, const char *cond)
15{
16 printf("%s:%d, %s(): %s\n", fname, line, func, cond);
e721b882 17 uts->fail_count++;
2e7d35d2
SG
18}
19
e721b882 20void ut_failf(struct unit_test_state *uts, const char *fname, int line,
2e7d35d2
SG
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');
e721b882 30 uts->fail_count++;
2e7d35d2 31}