summaryrefslogtreecommitdiff
path: root/include/kunit
diff options
context:
space:
mode:
authorAlan Maguire <alan.maguire@oracle.com>2020-03-26 17:25:09 +0300
committerShuah Khan <skhan@linuxfoundation.org>2020-03-26 23:08:41 +0300
commitc3bba690a2643245f59a4d5d66e6b687459696d9 (patch)
tree51fadd44c35c43a7a9f36ef10741432b0a13471d /include/kunit
parenteda8e324f70815e90360bef1032d49ef7c61e877 (diff)
downloadlinux-c3bba690a2643245f59a4d5d66e6b687459696d9.tar.xz
kunit: subtests should be indented 4 spaces according to TAP
Introduce KUNIT_SUBTEST_INDENT macro which corresponds to 4-space indentation and KUNIT_SUBSUBTEST_INDENT macro which corresponds to 8-space indentation in line with TAP spec (e.g. see "Subtests" section of https://node-tap.org/tap-protocol/). Use these macros in place of one or two tabs in strings to clarify why we are indenting. Suggested-by: Frank Rowand <frowand.list@gmail.com> Signed-off-by: Alan Maguire <alan.maguire@oracle.com> Reviewed-by: Frank Rowand <frank.rowand@sony.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'include/kunit')
-rw-r--r--include/kunit/test.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/include/kunit/test.h b/include/kunit/test.h
index f7b2ed4c127e..9b0c46a6ca1f 100644
--- a/include/kunit/test.h
+++ b/include/kunit/test.h
@@ -84,6 +84,14 @@ struct kunit;
/* Size of log associated with test. */
#define KUNIT_LOG_SIZE 512
+/*
+ * TAP specifies subtest stream indentation of 4 spaces, 8 spaces for a
+ * sub-subtest. See the "Subtests" section in
+ * https://node-tap.org/tap-protocol/
+ */
+#define KUNIT_SUBTEST_INDENT " "
+#define KUNIT_SUBSUBTEST_INDENT " "
+
/**
* struct kunit_case - represents an individual test case.
*
@@ -395,7 +403,8 @@ void kunit_log_append(char *log, const char *fmt, ...);
} while (0)
#define kunit_printk(lvl, test, fmt, ...) \
- kunit_log(lvl, test, "\t# %s: " fmt, (test)->name, ##__VA_ARGS__)
+ kunit_log(lvl, test, KUNIT_SUBTEST_INDENT "# %s: " fmt, \
+ (test)->name, ##__VA_ARGS__)
/**
* kunit_info() - Prints an INFO level message associated with @test.