diff options
author | Philipp Wagner <mail@philipp-wagner.com> | 2019-05-20 21:36:41 +0100 |
---|---|---|
committer | Tim Newsome <tim@sifive.com> | 2019-05-20 13:36:41 -0700 |
commit | 44f595b2b80618674813252485421473db372dfe (patch) | |
tree | d7e6b57ef396a87304ac0f29afb0ad7864cad172 /src | |
parent | 45b5178b1a0e8d66fa436c4cce48e1959e9b7326 (diff) | |
download | riscv-openocd-44f595b2b80618674813252485421473db372dfe.zip riscv-openocd-44f595b2b80618674813252485421473db372dfe.tar.gz riscv-openocd-44f595b2b80618674813252485421473db372dfe.tar.bz2 |
RISC-V: Make compliance tests more verbose (#366)
Currently the RISC-V compliance test suite doesn't output the test is
currently runs before it succeeds. It also uses the same message for
many tests. This makes it very hard to find out which test fails.
This commit makes things slightly easier by printing the test that's
being executed before it actually runs, and by adding the source code
line where the test is located, making it easier to look up the test in
the source code.
New output looks like this:
Info : Executing test 149 (riscv-013.c:3800): Regular calls must return ERROR_OK
Info : PASSED
Diffstat (limited to 'src')
-rw-r--r-- | src/target/riscv/riscv-013.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c index a3381b6..0f18ce3 100644 --- a/src/target/riscv/riscv-013.c +++ b/src/target/riscv/riscv-013.c @@ -3687,14 +3687,22 @@ void riscv013_clear_abstract_error(struct target *target) dmi_write(target, DMI_ABSTRACTCS, abstractcs & DMI_ABSTRACTCS_CMDERR); } +#ifdef _WIN32 +#define FILE_SEP '\\' +#else +#define FILE_SEP '/' +#endif #define COMPLIANCE_TEST(b, message) \ -{ \ +{ \ + const char *last_sep = strrchr(__FILE__, FILE_SEP); \ + const char *fname = (last_sep == NULL ? __FILE__ : last_sep + 1); \ + LOG_INFO("Executing test %d (%s:%d): %s", total_tests, fname, __LINE__, message); \ int pass = 0; \ if (b) { \ pass = 1; \ passed_tests++; \ } \ - LOG_INFO("%s test %d (%s)\n", (pass) ? "PASSED" : "FAILED", total_tests, message); \ + LOG_INFO(" %s", (pass) ? "PASSED" : "FAILED"); \ assert(pass); \ total_tests++; \ } |