This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH] Document do_test in test-skeleton.c
- From: Florian Weimer <fweimer at redhat dot com>
- To: sellcey at cavium dot com
- Cc: libc-alpha at sourceware dot org
- Date: Mon, 7 Nov 2016 15:51:04 +0100
- Subject: Re: [PATCH] Document do_test in test-skeleton.c
- Authentication-results: sourceware.org; auth=none
- References: <201611042247.uA4Ml39C014721@sellcey-lt.caveonetworks.com>
On 11/04/2016 11:47 PM, Steve Ellcey wrote:
While working on a patch for math/test-tgmath2.c I learned some information
about do_test and how it should work. Here is my attempt to put that
information into test-skeleton.c. If it looks accurate I could put this
information in the GLIBC Wiki too, in the "Writing a test case" section.
The comments about writing to stdout instead of stderr is already in the Wiki,
but the return value descriptions are not.
2016-11-04 Steve Ellcey <email@example.com>
* test-skeleton.c: Document do_test usage.
diff --git a/test-skeleton.c b/test-skeleton.c
index 55841fb..cbd0c2d 100644
@@ -36,7 +36,22 @@
/* The test function is normally called `do_test' and it is called
with argc and argv as the arguments. We nevertheless provide the
- possibility to overwrite this name. */
+ possibility to overwrite this name.
+ The test function should have a return type of 'int' and should
Perhaps “The TEST_FUNCTION expression should have type 'int'”?
TEST_FUNCTION is an expression, not the name of a function
+ return 0 to indicate a passing test, 1 to indicate a failing test,
+ or 77 to indicate an unsupported test. Other result values could be
+ used to indicate a failing test but since the result of the test
Comma before “but”?
+ function is passed to exit and exit only returns the lower 8 bits of
+ its input a non-zero return with some values could cause a test to
+ incorrectly be considered passing when it really failed. For this
+ reason tests should always return 0, 1, or 77.
+ The test function may print out diagnostic or warning messages as well
+ as messages about failures. These messages should be printed to stdout
+ and not stderr so that the output is properly ordered with respect to
+ the rest of the glibc testsuite run output. */
Rest looks good to me.