From patchwork Wed Mar 19 16:43:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wilco Dijkstra X-Patchwork-Id: 169 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx21.g.dreamhost.com (caibbdcaaahb.dreamhost.com [208.113.200.71]) by wilcox.dreamhost.com (Postfix) with ESMTP id AA2843600D6 for ; Wed, 19 Mar 2014 09:43:32 -0700 (PDT) Received: by homiemail-mx21.g.dreamhost.com (Postfix, from userid 14307373) id 56F2ECA3249; Wed, 19 Mar 2014 09:43:32 -0700 (PDT) X-Original-To: glibc@patchwork.siddhesh.in Delivered-To: x14307373@homiemail-mx21.g.dreamhost.com 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 homiemail-mx21.g.dreamhost.com (Postfix) with ESMTPS id 2BEA7C9F50E for ; Wed, 19 Mar 2014 09:43:32 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:mime-version :content-type:content-transfer-encoding; q=dns; s=default; b=vxV omrILw8s3W1bo6lZA3NCXerU0thWoOlkLn0aOAuvgllC6fAgGarl5QTUi0ympijn lZLJijzrcSb9insOEytrYUr0lP6HqkJQoc7q8EGOV5N2lLqShtyduNUyLwFl3ZqS mgixOMVywCtY3Vkx/6NZpjCAMjNM8gJEroPNHWts= 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:from:to:subject:date:message-id:mime-version :content-type:content-transfer-encoding; s=default; bh=Ujv2go7j1 z6HMXC74s8U0DYt0+k=; b=MURGIQtcXGFMLOffqcxOb1mTJEFc9xKI2KgUr2OvX +bN5rirkWL48sS0cWYJ7jQ6qJaZbzfh2BI+xfSCT0h+NkzkFTMkbLx1RWbTTidA5 PwOqjA7+uHMjWAn0x69cuRKYNPgSQLaPV/VwSTqRDTkZPYeksnAOzXyS5L2dHp+D k0= Received: (qmail 2416 invoked by alias); 19 Mar 2014 16:43:30 -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 2402 invoked by uid 89); 19 Mar 2014 16:43:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: service87.mimecast.com From: "Wilco" To: Subject: [PATCH] [ARM] Add fenv test support for targets which don't have FP traps Date: Wed, 19 Mar 2014 16:43:14 -0000 Message-ID: <000101cf4392$529cd5d0$f7d68170$@com> MIME-Version: 1.0 X-MC-Unique: 114031916430501201 X-DH-Original-To: glibc@patchwork.siddhesh.in Hi, This patch adds support in the fenv tests for VFP implementations which don't support trapping on FP exceptions. If EXCEPTION_ENABLE_SUPPORTED is false, tests which use traps are skipped without error when fesetenv or feenableexcept fail to enable an exception trap. Any failures on targets which do support traps are not hidden. Math/test-fenv.c now passes without failures on Cortex-A15. OK for commit? Wilco --- math/test-fenv.c | 25 +++++++++++++++---------- sysdeps/arm/math-tests.h | 3 +++ sysdeps/generic/math-tests.h | 7 +++++++ 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/math/test-fenv.c b/math/test-fenv.c index 73cd1a7..23e47d4 100644 --- a/math/test-fenv.c +++ b/math/test-fenv.c @@ -36,6 +36,7 @@ #include #include #include +#include /* Since not all architectures might define all exceptions, we define @@ -233,14 +234,9 @@ feenv_nomask_test (const char *flag_name, int fe_exc) #if defined FE_NOMASK_ENV int status; pid_t pid; - fenv_t saved; - fegetenv (&saved); - errno = 0; - fesetenv (FE_NOMASK_ENV); - status = errno; - fesetenv (&saved); - if (status == ENOSYS) + if (!EXCEPTION_ENABLE_SUPPORTED (FE_ALL_EXCEPT) + && fesetenv (FE_NOMASK_ENV) != 0) { printf ("Test: not testing FE_NOMASK_ENV, it isn't implemented.\n"); return; @@ -349,7 +345,13 @@ feexcp_nomask_test (const char *flag_name, int fe_exc) int status; pid_t pid; - printf ("Test: after fedisableexcept (%s) processes will abort\n", + if (!EXCEPTION_ENABLE_SUPPORTED (fe_exc) && feenableexcept (fe_exc) == -1) + { + printf ("Test: not testing feenableexcept, it isn't implemented.\n"); + return; + } + + printf ("Test: after feenableexcept (%s) processes will abort\n", flag_name); printf (" when feraiseexcept (%s) is called.\n", flag_name); pid = fork (); @@ -470,7 +472,6 @@ feenable_test (const char *flag_name, int fe_exc) { int excepts; - printf ("Tests for feenableexcepts etc. with flag %s\n", flag_name); /* First disable all exceptions. */ @@ -488,8 +489,12 @@ feenable_test (const char *flag_name, int fe_exc) flag_name, excepts); ++count_errors; } - excepts = feenableexcept (fe_exc); + if (!EXCEPTION_ENABLE_SUPPORTED (fe_exc) && excepts == -1) + { + printf ("Test: not testing feenableexcept, it isn't implemented.\n"); + return; + } if (excepts == -1) { printf ("Test: feenableexcept (%s) failed\n", flag_name); diff --git a/sysdeps/arm/math-tests.h b/sysdeps/arm/math-tests.h index e65f135..ea5f8dc 100644 --- a/sysdeps/arm/math-tests.h +++ b/sysdeps/arm/math-tests.h @@ -29,4 +29,7 @@ # define EXCEPTION_TESTS_long_double 0 #endif +/* Not all VFP implementations support trapping exceptions. */ +#define EXCEPTION_ENABLE_SUPPORTED(EXCEPT) ((EXCEPT) == 0) + #include_next diff --git a/sysdeps/generic/math-tests.h b/sysdeps/generic/math-tests.h index c86b067..3df6948 100644 --- a/sysdeps/generic/math-tests.h +++ b/sysdeps/generic/math-tests.h @@ -76,3 +76,10 @@ (sizeof (TYPE) == sizeof (float) ? EXCEPTION_TESTS_float \ : sizeof (TYPE) == sizeof (double) ? EXCEPTION_TESTS_double \ : EXCEPTION_TESTS_long_double) + +/* Indicate whether the given exception trap(s) can be enabled + in feenableexcept. All traps are supported unless overridden. */ +#ifndef EXCEPTION_ENABLE_SUPPORTED +# define EXCEPTION_ENABLE_SUPPORTED(EXCEPT) \ + (EXCEPTION_TESTS_float || EXCEPTION_TESTS_double) +#endif