ut.c 674 B

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