Simon Glass | 2e7d35d | 2014-02-26 15:59:21 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Simple unit test library for driver model |
| 3 | * |
| 4 | * Copyright (c) 2013 Google, Inc |
| 5 | * |
| 6 | * SPDX-License-Identifier: GPL-2.0+ |
| 7 | */ |
| 8 | |
| 9 | #include <common.h> |
| 10 | #include <dm/test.h> |
| 11 | #include <dm/ut.h> |
| 12 | |
| 13 | struct dm_test_state; |
| 14 | |
| 15 | void ut_fail(struct dm_test_state *dms, const char *fname, int line, |
| 16 | const char *func, const char *cond) |
| 17 | { |
| 18 | printf("%s:%d, %s(): %s\n", fname, line, func, cond); |
| 19 | dms->fail_count++; |
| 20 | } |
| 21 | |
| 22 | void ut_failf(struct dm_test_state *dms, const char *fname, int line, |
| 23 | const char *func, const char *cond, const char *fmt, ...) |
| 24 | { |
| 25 | va_list args; |
| 26 | |
| 27 | printf("%s:%d, %s(): %s: ", fname, line, func, cond); |
| 28 | va_start(args, fmt); |
| 29 | vprintf(fmt, args); |
| 30 | va_end(args); |
| 31 | putc('\n'); |
| 32 | dms->fail_count++; |
| 33 | } |