diff options
author | Michael Widenius <monty@askmonty.org> | 2010-08-05 22:56:11 +0300 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2010-08-05 22:56:11 +0300 |
commit | d042146e5b41b6222df3e6b4c16a44f3ef2939b7 (patch) | |
tree | e40f5b435f7d17ed1c24dfb787ab8cd5f4f7d5d8 /unittest | |
parent | 3e610bc58d0ba325fdca3b06dfa976ecc513dc1e (diff) | |
parent | f0f21036951f6fed2fddeb58375425f957751fd5 (diff) | |
download | mariadb-git-d042146e5b41b6222df3e6b4c16a44f3ef2939b7.tar.gz |
Merge with MariaDB 5.1.49
Removed references to HA_END_SPACE_KEY (which has been 0 for a long time)
Diffstat (limited to 'unittest')
-rw-r--r-- | unittest/examples/Makefile.am | 3 | ||||
-rw-r--r-- | unittest/examples/no_plan-t.c | 11 | ||||
-rw-r--r-- | unittest/mytap/tap.c | 11 | ||||
-rw-r--r-- | unittest/mytap/tap.h | 13 |
4 files changed, 25 insertions, 13 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, " "); diff --git a/unittest/mytap/tap.c b/unittest/mytap/tap.c index a7552b15eed..2f1747d7167 100644 --- a/unittest/mytap/tap.c +++ b/unittest/mytap/tap.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 @@ -50,7 +50,7 @@ @ingroup MyTAP_Internal */ -static TEST_DATA g_test = { 0, 0, 0, "" }; +static TEST_DATA g_test = { NO_PLAN, 0, 0, "" }; /** Output stream for test report message. @@ -84,6 +84,7 @@ vemit_tap(int pass, char const *fmt, va_list ap) (fmt && *fmt) ? " - " : ""); if (fmt && *fmt) vfprintf(tapout, fmt, ap); + fflush(tapout); } @@ -106,6 +107,7 @@ static void emit_dir(const char *dir, const char *why) { fprintf(tapout, " # %s %s", dir, why); + fflush(tapout); } @@ -118,6 +120,7 @@ static void emit_endl() { fprintf(tapout, "\n"); + fflush(tapout); } static void @@ -204,7 +207,10 @@ plan(int count) break; default: if (count > 0) + { fprintf(tapout, "1..%d\n", count); + fflush(tapout); + } break; } } @@ -217,6 +223,7 @@ skip_all(char const *reason, ...) va_start(ap, reason); fprintf(tapout, "1..0 # skip "); vfprintf(tapout, reason, ap); + fflush(tapout); va_end(ap); exit(0); } diff --git a/unittest/mytap/tap.h b/unittest/mytap/tap.h index f92fad1101f..206a939e43b 100644 --- a/unittest/mytap/tap.h +++ b/unittest/mytap/tap.h @@ -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 @@ -90,10 +90,9 @@ extern int skip_big_tests; /** Set number of tests that is planned to execute. - The function also accepts the predefined constant - <code>NO_PLAN</code>. If the function is not called, it is as if - it was called with <code>NO_PLAN</code>, i.e., the test plan will - be printed after all the test lines. + The function also accepts the predefined constant <code>NO_PLAN</code>. + If invoked with this constant -- or not invoked at all -- + the test plan will be printed after all the test lines. The plan() function will install signal handlers for all signals that generate a core, so if you want to override these signals, do @@ -107,7 +106,7 @@ extern int skip_big_tests; @param count The planned number of tests to run. */ -void plan(int count); +void plan(int const count); /** @@ -126,7 +125,7 @@ void plan(int count); which case nothing is printed. */ -void ok(int pass, char const *fmt, ...) +void ok(int const pass, char const *fmt, ...) __attribute__((format(printf,2,3))); |