From patchwork Thu Nov 1 19:34:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gabriel F. T. Gomes" X-Patchwork-Id: 29997 Received: (qmail 68173 invoked by alias); 1 Nov 2018 19:34:26 -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 68069 invoked by uid 89); 1 Nov 2018 19:34:25 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=H*F:D*br X-HELO: mo19.mail-out.ovh.net From: "Gabriel F. T. Gomes" To: Subject: [PATCH v2 1/2] Convert tst-efgcvt to the new test framework Date: Thu, 1 Nov 2018 16:34:11 -0300 Message-ID: <20181101193412.3073-2-gabriel@inconstante.eti.br> In-Reply-To: <20181101193412.3073-1-gabriel@inconstante.eti.br> References: <20181101193412.3073-1-gabriel@inconstante.eti.br> MIME-Version: 1.0 X-Ovh-Tracer-Id: 6142346942099082947 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedtkedrieehgdduvdeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenuc New since v1. -- 8< -- The function do_test in tst-efgcvt.c increments an error counter for each error that it finds, then returns it to the test framework. However, the test framework does not expect an error count as return, but zero for a passing test, one for a failing test, or 77 for an unsupported test. Alternatively, the framework provides the function support_record_failure that records errors, which then allows the test program to return zero unconditionally. This patch removes the error counter, replaces each increment of the counter with a call to support_record_failure, and makes do_test unconditionally return zero. Tested for powerpc64le (as-is and with a patched results table to check that the error reporting actually works). * misc/tst-efgcvt.c: Include support/check.h and support/test-driver.c. (error_count): Remove. (output_error): Replace increments to error_count with calls to support_record_failure. (output_r_error): Likewise. (special): Likewise. (do_test): Unconditionally return zero. --- misc/tst-efgcvt.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/misc/tst-efgcvt.c b/misc/tst-efgcvt.c index bb716d5198..5a598f49e3 100644 --- a/misc/tst-efgcvt.c +++ b/misc/tst-efgcvt.c @@ -25,7 +25,7 @@ #include #include -int error_count; +#include typedef struct { @@ -101,7 +101,7 @@ output_error (const char *name, double value, int ndigit, res_p, res_decpt, res_sign); printf ("Should be p: \"%s\", decpt: %d, sign: %d\n", exp_p, exp_decpt, exp_sign); - ++error_count; + support_record_failure (); } @@ -116,7 +116,7 @@ output_r_error (const char *name, double value, int ndigit, res_p, res_decpt, res_sign, res_return); printf ("Should be buf: \"%s\", decpt: %d, sign: %d\n", exp_p, exp_decpt, exp_sign); - ++error_count; + support_record_failure (); } static void @@ -189,13 +189,13 @@ special (void) if (res == 0) { printf ("ecvt_r with a too small buffer was succesful.\n"); - ++error_count; + support_record_failure (); } res = fcvt_r (123.456, 10, &decpt, &sign, buf, 1); if (res == 0) { printf ("fcvt_r with a too small buffer was succesful.\n"); - ++error_count; + support_record_failure (); } } @@ -209,8 +209,7 @@ do_test (void) test_r (fcvt_tests, fcvt_r, "fcvt_r"); special (); - return error_count; + return 0; } -#define TEST_FUNCTION do_test () -#include "../test-skeleton.c" +#include