blob: 57eda2e207bd00a40d929cf223108d3ae0aaf263 [file] [log] [blame]
Brad Bishop19323692019-04-05 15:28:33 -04001Upstream-Status: Submitted [mailing list]
2Signed-off-by: Ross Burton <ross.burton@intel.com>
3
4From 0e0a2a69261031d55d52b6045990e8982ea12912 Mon Sep 17 00:00:00 2001
Patrick Williamsc0f7c042017-02-23 20:41:17 -06005From: Khem Raj <raj.khem@gmail.com>
6Date: Sat, 9 Jul 2016 07:52:19 +0000
Brad Bishop19323692019-04-05 15:28:33 -04007Subject: [PATCH] tests: only run rounding tests if FE_UPWARD is present
Patrick Williamsc0f7c042017-02-23 20:41:17 -06008
Brad Bishop19323692019-04-05 15:28:33 -04009On ARM, musl does not define FE_* when the architecture does not have VFP (which
10is the right interpretation).
Patrick Williamsc0f7c042017-02-23 20:41:17 -060011
Brad Bishop19323692019-04-05 15:28:33 -040012As these tests depend on calling fesetround(), skip the test if FE_UPWARD isn't
13available.
Patrick Williamsc0f7c042017-02-23 20:41:17 -060014
Brad Bishop19323692019-04-05 15:28:33 -040015Signed-off-by: Ross Burton <ross.burton@intel.com>
Patrick Williamsc0f7c042017-02-23 20:41:17 -060016---
Brad Bishop19323692019-04-05 15:28:33 -040017 tests/general/roundmode-getintegerv.c | 12 ++++++++----
18 tests/general/roundmode-pixelstore.c | 12 ++++++++----
19 2 files changed, 16 insertions(+), 8 deletions(-)
Patrick Williamsc0f7c042017-02-23 20:41:17 -060020
21diff --git a/tests/general/roundmode-getintegerv.c b/tests/general/roundmode-getintegerv.c
Brad Bishop19323692019-04-05 15:28:33 -040022index 28ecfaf55..aa99044a1 100644
Patrick Williamsc0f7c042017-02-23 20:41:17 -060023--- a/tests/general/roundmode-getintegerv.c
24+++ b/tests/general/roundmode-getintegerv.c
Brad Bishop19323692019-04-05 15:28:33 -040025@@ -79,13 +79,17 @@ test(float val, int expect)
26 void
27 piglit_init(int argc, char **argv)
Patrick Williamsc0f7c042017-02-23 20:41:17 -060028 {
Brad Bishop19323692019-04-05 15:28:33 -040029- int ret;
Patrick Williamsc0f7c042017-02-23 20:41:17 -060030 bool pass = true;
Brad Bishop19323692019-04-05 15:28:33 -040031- ret = fesetround(FE_UPWARD);
32- if (ret != 0) {
33- printf("Couldn't set rounding mode\n");
34+
Patrick Williamsc0f7c042017-02-23 20:41:17 -060035+#ifdef FE_UPWARD
Brad Bishop19323692019-04-05 15:28:33 -040036+ if (fesetround(FE_UPWARD) != 0) {
37+ printf("Setting rounding mode failed\n");
Patrick Williamsc0f7c042017-02-23 20:41:17 -060038 piglit_report_result(PIGLIT_SKIP);
Brad Bishop19323692019-04-05 15:28:33 -040039 }
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 Williamsc0f7c042017-02-23 20:41:17 -060047diff --git a/tests/general/roundmode-pixelstore.c b/tests/general/roundmode-pixelstore.c
Brad Bishop19323692019-04-05 15:28:33 -040048index 8a029b257..57ec11c09 100644
Patrick Williamsc0f7c042017-02-23 20:41:17 -060049--- a/tests/general/roundmode-pixelstore.c
50+++ b/tests/general/roundmode-pixelstore.c
Brad Bishop19323692019-04-05 15:28:33 -040051@@ -79,13 +79,17 @@ test(float val, int expect)
52 void
53 piglit_init(int argc, char **argv)
Patrick Williamsc0f7c042017-02-23 20:41:17 -060054 {
Brad Bishop19323692019-04-05 15:28:33 -040055- int ret;
Patrick Williamsc0f7c042017-02-23 20:41:17 -060056 bool pass = true;
Brad Bishop19323692019-04-05 15:28:33 -040057- ret = fesetround(FE_UPWARD);
58- if (ret != 0) {
59- printf("Couldn't set rounding mode\n");
60+
Patrick Williamsc0f7c042017-02-23 20:41:17 -060061+#ifdef FE_UPWARD
Brad Bishop19323692019-04-05 15:28:33 -040062+ if (fesetround(FE_UPWARD) != 0) {
63+ printf("Setting rounding mode failed\n");
Patrick Williamsc0f7c042017-02-23 20:41:17 -060064 piglit_report_result(PIGLIT_SKIP);
Brad Bishop19323692019-04-05 15:28:33 -040065 }
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 Williamsc0f7c042017-02-23 20:41:17 -060073--
Brad Bishop19323692019-04-05 15:28:33 -0400742.11.0
Patrick Williamsc0f7c042017-02-23 20:41:17 -060075