summaryrefslogtreecommitdiff
path: root/test/internals
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2015-02-26 17:39:20 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2015-04-16 13:06:13 +0100
commit58eefa1031e14cb402ed0aae85e6bce1ba030a28 (patch)
treeaeb4b40b2bc5cc27aff5560f45374e65ca5825ec /test/internals
parenta6b68598c42d34383d24cf424e0fe740a0bfffb2 (diff)
downloaddbus-58eefa1031e14cb402ed0aae85e6bce1ba030a28.tar.gz
test-shell, test-printf: produce TAP output like the other installable tests
Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89846
Diffstat (limited to 'test/internals')
-rw-r--r--test/internals/printf.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/internals/printf.c b/test/internals/printf.c
index db151518..2006f321 100644
--- a/test/internals/printf.c
+++ b/test/internals/printf.c
@@ -62,20 +62,32 @@ do_test (int minimum,
#define X_TIMES_512 X_TIMES_256 X_TIMES_256
#define X_TIMES_1024 X_TIMES_512 X_TIMES_512
+/* This test outputs TAP syntax: http://testanything.org/ */
int
main (int argc,
char **argv)
{
char buf[] = X_TIMES_1024 X_TIMES_1024 X_TIMES_1024 X_TIMES_1024;
int i;
+ int test_num = 0;
do_test (1, "%d", 0);
+ printf ("ok %d\n", ++test_num);
+
do_test (7, "%d", 1234567);
+ printf ("ok %d\n", ++test_num);
+
do_test (3, "%f", 3.5);
+ printf ("ok %d\n", ++test_num);
do_test (0, "%s", "");
+ printf ("ok %d\n", ++test_num);
+
do_test (1024, "%s", X_TIMES_1024);
+ printf ("ok %d\n", ++test_num);
+
do_test (1025, "%s", X_TIMES_1024 "Y");
+ printf ("ok %d\n", ++test_num);
for (i = 4096; i > 0; i--)
{
@@ -83,6 +95,11 @@ main (int argc,
do_test (i, "%s", buf);
do_test (i + 3, "%s:%d", buf, 42);
}
+ printf ("ok %d\n", ++test_num);
+ /* Tell the TAP driver that we have done all the tests we plan to do.
+ * This is how it can distinguish between an unexpected exit and
+ * successful completion. */
+ printf ("1..%d\n", test_num);
return 0;
}