]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
dm: test: Show the test filename when running
authorSimon Glass <sjg@chromium.org>
Fri, 19 May 2017 02:09:15 +0000 (20:09 -0600)
committerSimon Glass <sjg@chromium.org>
Thu, 1 Jun 2017 13:03:09 +0000 (07:03 -0600)
Show the filename of the test being run. Skip the path and show just the
base name.

Signed-off-by: Simon Glass <sjg@chromium.org>
include/test/test.h
test/dm/test-main.c

index b7e1ae2decf997f83f6898b70d3d97b588e28ae2..e3e821c6ea8a9a2183ba9f100aae643af9d8ed65 100644 (file)
@@ -30,6 +30,7 @@ struct unit_test_state {
  * @flags: Flags indicated pre-conditions for test
  */
 struct unit_test {
+       const char *file;
        const char *name;
        int (*func)(struct unit_test_state *state);
        int flags;
@@ -38,6 +39,7 @@ struct unit_test {
 /* Declare a new unit test */
 #define UNIT_TEST(_name, _flags, _suite)                               \
        ll_entry_declare(struct unit_test, _name, _suite) = {           \
+               .file = __FILE__,                                       \
                .name = #_name,                                         \
                .flags = _flags,                                        \
                .func = _name,                                          \
index 2848673e06fd592a83c762ccca9119b12d7f7b60..10d2706377fafc70419eaaff39133b26191897aa 100644 (file)
@@ -75,8 +75,9 @@ static int dm_test_destroy(struct unit_test_state *uts)
 static int dm_do_test(struct unit_test_state *uts, struct unit_test *test)
 {
        struct sandbox_state *state = state_get_current();
+       const char *fname = strrchr(test->file, '/') + 1;
 
-       printf("Test: %s\n", test->name);
+       printf("Test: %s: %s\n", test->name, fname);
        ut_assertok(dm_test_init(uts));
 
        uts->start = mallinfo();