Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 1 | Upstream-Status: Submitted [mailing list] |
| 2 | Signed-off-by: Ross Burton <ross.burton@intel.com> |
| 3 | |
| 4 | From 0e0a2a69261031d55d52b6045990e8982ea12912 Mon Sep 17 00:00:00 2001 |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 5 | From: Khem Raj <raj.khem@gmail.com> |
| 6 | Date: Sat, 9 Jul 2016 07:52:19 +0000 |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 7 | Subject: [PATCH] tests: only run rounding tests if FE_UPWARD is present |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 8 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 9 | On ARM, musl does not define FE_* when the architecture does not have VFP (which |
| 10 | is the right interpretation). |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 11 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 12 | As these tests depend on calling fesetround(), skip the test if FE_UPWARD isn't |
| 13 | available. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 14 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 15 | Signed-off-by: Ross Burton <ross.burton@intel.com> |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 16 | --- |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 17 | tests/general/roundmode-getintegerv.c | 12 ++++++++---- |
| 18 | tests/general/roundmode-pixelstore.c | 12 ++++++++---- |
| 19 | 2 files changed, 16 insertions(+), 8 deletions(-) |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 20 | |
| 21 | diff --git a/tests/general/roundmode-getintegerv.c b/tests/general/roundmode-getintegerv.c |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 22 | index 28ecfaf55..aa99044a1 100644 |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 23 | --- a/tests/general/roundmode-getintegerv.c |
| 24 | +++ b/tests/general/roundmode-getintegerv.c |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 25 | @@ -79,13 +79,17 @@ test(float val, int expect) |
| 26 | void |
| 27 | piglit_init(int argc, char **argv) |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 28 | { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 29 | - int ret; |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 30 | bool pass = true; |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 31 | - ret = fesetround(FE_UPWARD); |
| 32 | - if (ret != 0) { |
| 33 | - printf("Couldn't set rounding mode\n"); |
| 34 | + |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 35 | +#ifdef FE_UPWARD |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 36 | + if (fesetround(FE_UPWARD) != 0) { |
| 37 | + printf("Setting rounding mode failed\n"); |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 38 | piglit_report_result(PIGLIT_SKIP); |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 39 | } |
| 40 | +#else |
| 41 | + printf("Cannot set rounding mode\n"); |
| 42 | + piglit_report_result(PIGLIT_SKIP); |
| 43 | +#endif |
| 44 | |
| 45 | pass = test(2.2, 2) && pass; |
| 46 | pass = test(2.8, 3) && pass; |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 47 | diff --git a/tests/general/roundmode-pixelstore.c b/tests/general/roundmode-pixelstore.c |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 48 | index 8a029b257..57ec11c09 100644 |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 49 | --- a/tests/general/roundmode-pixelstore.c |
| 50 | +++ b/tests/general/roundmode-pixelstore.c |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 51 | @@ -79,13 +79,17 @@ test(float val, int expect) |
| 52 | void |
| 53 | piglit_init(int argc, char **argv) |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 54 | { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 55 | - int ret; |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 56 | bool pass = true; |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 57 | - ret = fesetround(FE_UPWARD); |
| 58 | - if (ret != 0) { |
| 59 | - printf("Couldn't set rounding mode\n"); |
| 60 | + |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 61 | +#ifdef FE_UPWARD |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 62 | + if (fesetround(FE_UPWARD) != 0) { |
| 63 | + printf("Setting rounding mode failed\n"); |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 64 | piglit_report_result(PIGLIT_SKIP); |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 65 | } |
| 66 | +#else |
| 67 | + printf("Cannot set rounding mode\n"); |
| 68 | + piglit_report_result(PIGLIT_SKIP); |
| 69 | +#endif |
| 70 | |
| 71 | pass = test(2.2, 2) && pass; |
| 72 | pass = test(2.8, 3) && pass; |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 73 | -- |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 74 | 2.11.0 |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 75 | |