summaryrefslogtreecommitdiff
path: root/unittest/examples
diff options
context:
space:
mode:
authorTor Didriksen <tor.didriksen@sun.com>2010-06-10 13:15:35 +0200
committerTor Didriksen <tor.didriksen@sun.com>2010-06-10 13:15:35 +0200
commita24df71e95fb6379a3ba86322c9941a82b8d6527 (patch)
treecbbeaa1e16e995fa7ff3358a1069ebb16c27870d /unittest/examples
parent34ceaa6a3d030c25500e7e39e95ca92d0f1448b4 (diff)
downloadmariadb-git-a24df71e95fb6379a3ba86322c9941a82b8d6527.tar.gz
Backport of Bug#53303 mytap tests should always have a plan()
The bug was caused by buffered output. Flushing resolved it. We still recommend to allways call plan(). Also fix some compile warnings (formal parameter different from declaration) unittest/examples/Makefile.am: Omit core-t, since it will always fail. unittest/examples/no_plan-t.c: Comment that we recommend calling plan(NO_PLAN) unittest/mytap/tap.c: Use the named constant NO_PLAN Flush all output. unittest/mytap/tap.h: Change documentation for the plan() function.
Diffstat (limited to 'unittest/examples')
-rw-r--r--unittest/examples/Makefile.am3
-rw-r--r--unittest/examples/no_plan-t.c11
2 files changed, 10 insertions, 4 deletions
diff --git a/unittest/examples/Makefile.am b/unittest/examples/Makefile.am
index 94032c00928..a1627a58b4e 100644
--- a/unittest/examples/Makefile.am
+++ b/unittest/examples/Makefile.am
@@ -20,7 +20,8 @@ AM_LDFLAGS = -L$(top_builddir)/unittest/mytap
LDADD = -lmytap
-noinst_PROGRAMS = simple-t skip-t todo-t skip_all-t no_plan-t core-t
+# We omit core-t here, since it will always fail.
+noinst_PROGRAMS = simple-t skip-t todo-t skip_all-t no_plan-t
# Don't update the files from bitkeeper
%::SCCS/s.%
diff --git a/unittest/examples/no_plan-t.c b/unittest/examples/no_plan-t.c
index 56aabd6d752..f22340ae0d1 100644
--- a/unittest/examples/no_plan-t.c
+++ b/unittest/examples/no_plan-t.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006 MySQL AB
+/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -20,14 +20,19 @@
/*
Sometimes, the number of tests is not known beforehand. In those
- cases, the plan can be omitted and will instead be written at the
- end of the test (inside exit_status()).
+ cases, you should invoke plan(NO_PLAN).
+ The plan will be printed at the end of the test (inside exit_status()).
Use this sparingly, it is a last resort: planning how many tests you
are going to run will help you catch that offending case when some
tests are skipped for an unknown reason.
*/
int main() {
+ /*
+ We recommend calling plan(NO_PLAN), but want to verify that
+ omitting the call works as well.
+ plan(NO_PLAN);
+ */
ok(1, " ");
ok(1, " ");
ok(1, " ");