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: 691478 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3t9cRK0vLyz9t1b for ; Sat, 5 Nov 2016 09:47:24 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="l2PyAkI6"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:message-id:to:subject:reply-to; q= dns; s=default; b=eb+mnP59M4/Um28e/fzzvEQOoQyZAVLvC+vlq0oHnnYCTo 3WK8P9yj4lt6uXbSPmMT6Da4wiBsn0W/EM+CsacAui94+JDMb36Fv2QAEk+GZu8D YaoYeVFhUwQ6ycWOf+p18FdXF2WBVAoLn6OQCDr/r3WA1dSeuppSmNhMQ9+lk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:message-id:to:subject:reply-to; s= default; bh=P6L/lndxuwOQfHkTc5VjMA5c7Eg=; b=l2PyAkI6USY4U1fVM9/0 +n04/2WQd6MhCNBYNIeIUtaLZvoPaYtawgdNYxkcMA2OwIXeNMvT5j5RSLy4K4Pe yShrmtCln/0p/DdbR65pF8Cgqm6ot2QOgaj0X7/sc2uam8MBiquspmHDcgq2kNbW IB3wGLLLKSW0r7F4R1jLFGs= 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