From: Simon Glass Date: Wed, 10 May 2017 08:21:04 -0600 Subject: [U-Boot] [PATCH v2 25/71] dm: test: Show the test filename when running In-Reply-To: <20170510142150.30515-1-sjg@chromium.org> References: <20170510142150.30515-1-sjg@chromium.org> Message-ID: <20170510142150.30515-26-sjg@chromium.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Show the filename of the test being run. Skip the path and show just the base name. Signed-off-by: Simon Glass --- Changes in v2: None include/test/test.h | 2 ++ test/dm/test-main.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/test/test.h b/include/test/test.h index b7e1ae2dec..e3e821c6ea 100644 --- a/include/test/test.h +++ b/include/test/test.h @@ -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, \ diff --git a/test/dm/test-main.c b/test/dm/test-main.c index 2848673e06..10d2706377 100644 --- a/test/dm/test-main.c +++ b/test/dm/test-main.c @@ -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(); -- 2.13.0.rc2.291.g57267f2277-goog