From patchwork Fri Nov 4 22:47:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Ellcey X-Patchwork-Id: 17211 Received: (qmail 26059 invoked by alias); 4 Nov 2016 22:47:16 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 26044 invoked by uid 89); 4 Nov 2016 22:47:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Hx-languages-length:1826, learned X-HELO: camailhost.cavium.com Date: Fri, 4 Nov 2016 15:47:03 -0700 From: Steve Ellcey Message-Id: <201611042247.uA4Ml39C014721@sellcey-lt.caveonetworks.com> To: libc-alpha@sourceware.org Subject: [PATCH] Document do_test in test-skeleton.c Reply-To: sellcey@cavium.com 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. Steve Ellcey sellcey@caviumnetworks.com 2016-11-04 Steve Ellcey * test-skeleton.c: Document do_test usage. diff --git a/test-skeleton.c b/test-skeleton.c index 55841fb..cbd0c2d 100644 --- a/test-skeleton.c +++ b/test-skeleton.c @@ -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 + 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 + 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. */ + #ifndef TEST_FUNCTION # define TEST_FUNCTION do_test (argc, argv) #endif