From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 33135 invoked by alias); 7 Nov 2016 14:51:18 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 33117 invoked by uid 89); 7 Nov 2016 14:51:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.7 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Subject: Re: [PATCH] Document do_test in test-skeleton.c To: sellcey@cavium.com References: <201611042247.uA4Ml39C014721@sellcey-lt.caveonetworks.com> Cc: libc-alpha@sourceware.org From: Florian Weimer Message-ID: Date: Mon, 07 Nov 2016 14:51:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <201611042247.uA4Ml39C014721@sellcey-lt.caveonetworks.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-SW-Source: 2016-11/txt/msg00234.txt.bz2 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. > > 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 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. Thanks, Florian