[Piglit] [PATCH] tests: only run rounding tests if FE_UPWARD is present

2018-11-30 Thread Ross Burton
On ARM, musl does not define FE_* when the architecture does not have VFP (which
is the right interpretation).

As these tests depend on calling fesetround(), skip the test if FE_UPWARD isn't
available.

Signed-off-by: Ross Burton 
---
 tests/general/roundmode-getintegerv.c | 12 
 tests/general/roundmode-pixelstore.c  | 12 
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/tests/general/roundmode-getintegerv.c 
b/tests/general/roundmode-getintegerv.c
index 28ecfaf55..aa99044a1 100644
--- a/tests/general/roundmode-getintegerv.c
+++ b/tests/general/roundmode-getintegerv.c
@@ -79,13 +79,17 @@ test(float val, int expect)
 void
 piglit_init(int argc, char **argv)
 {
-   int ret;
bool pass = true;
-   ret = fesetround(FE_UPWARD);
-   if (ret != 0) {
-   printf("Couldn't set rounding mode\n");
+
+#ifdef FE_UPWARD
+   if (fesetround(FE_UPWARD) != 0) {
+   printf("Setting rounding mode failed\n");
piglit_report_result(PIGLIT_SKIP);
}
+#else
+   printf("Cannot set rounding mode\n");
+   piglit_report_result(PIGLIT_SKIP);
+#endif
 
pass = test(2.2, 2) && pass;
pass = test(2.8, 3) && pass;
diff --git a/tests/general/roundmode-pixelstore.c 
b/tests/general/roundmode-pixelstore.c
index 8a029b257..57ec11c09 100644
--- a/tests/general/roundmode-pixelstore.c
+++ b/tests/general/roundmode-pixelstore.c
@@ -79,13 +79,17 @@ test(float val, int expect)
 void
 piglit_init(int argc, char **argv)
 {
-   int ret;
bool pass = true;
-   ret = fesetround(FE_UPWARD);
-   if (ret != 0) {
-   printf("Couldn't set rounding mode\n");
+
+#ifdef FE_UPWARD
+   if (fesetround(FE_UPWARD) != 0) {
+   printf("Setting rounding mode failed\n");
piglit_report_result(PIGLIT_SKIP);
}
+#else
+   printf("Cannot set rounding mode\n");
+   piglit_report_result(PIGLIT_SKIP);
+#endif
 
pass = test(2.2, 2) && pass;
pass = test(2.8, 3) && pass;
-- 
2.11.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH V2] arb_texture_view: fix security format warnings

2018-11-30 Thread Ross Burton
If built with -Werror=format-security then Piglit fails to build:

/tests/spec/arb_texture_view/rendering-layers-image.c:150:8:
error: format not a string literal and no format arguments 
[-Werror=format-security]
 (desc)); \
 ^~

In this case test->uniform_type is being turned into a string using snprintf()
and then passed to piglit_report_subtest_result() which takes a format string,
but GCC can't verify the format.

As _subtest_report() takes a format string, we can just remove the snprintf()
and let it construct the label.

Also as X is used once and doesn't make the code clearer, just inline it.

Signed-off-by: Ross Burton 
---
 tests/spec/arb_texture_view/rendering-layers-image.c | 19 ++-
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/tests/spec/arb_texture_view/rendering-layers-image.c 
b/tests/spec/arb_texture_view/rendering-layers-image.c
index 415b01657..86148075b 100644
--- a/tests/spec/arb_texture_view/rendering-layers-image.c
+++ b/tests/spec/arb_texture_view/rendering-layers-image.c
@@ -142,26 +142,19 @@ test_render_layers(const struct test_info *test)
return pass;
 }
 
-#define X(f, desc) \
-   do { \
-   const bool subtest_pass = (f); \
-   piglit_report_subtest_result(subtest_pass \
-? PIGLIT_PASS : PIGLIT_FAIL, \
-(desc)); \
-   pass = pass && subtest_pass; \
-   } while (0)
-
 enum piglit_result
 piglit_display(void)
 {
bool pass = true;
for (int test_idx = 0; test_idx < ARRAY_SIZE(tests); test_idx++) {
const struct test_info *test = &tests[test_idx];
-   char test_name[128];
-   snprintf(test_name, sizeof(test_name), "layers rendering of 
%s", test->uniform_type);
-   X(test_render_layers(test), test_name);
+
+   const bool subtest_pass = test_render_layers(test);
+
+   piglit_report_subtest_result(subtest_pass ? PIGLIT_PASS : 
PIGLIT_FAIL,
+"layers rendering of %s", 
test->uniform_type);
+   pass = pass && subtest_pass;
}
-#undef X
pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
-- 
2.11.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 1/3] cmake: use proper WAYLAND_INCLUDE_DIRS variable

2018-11-30 Thread Ross Burton
From: Pascal Bach 

WAYLAND_wayland-client_INCLUDEDIR is an internal variable and is not correctly
set when cross compiling. WAYLAND_INCLUDE_DIRS includes the correct path even
when cross compiling.

Signed-off-by: Pascal Bach 
---
 tests/util/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/util/CMakeLists.txt b/tests/util/CMakeLists.txt
index a5f080156..a303a9f58 100644
--- a/tests/util/CMakeLists.txt
+++ b/tests/util/CMakeLists.txt
@@ -97,7 +97,7 @@ if(PIGLIT_USE_WAFFLE)
piglit-framework-gl/piglit_wl_framework.c
)
list(APPEND UTIL_GL_INCLUDES
-   ${WAYLAND_wayland-client_INCLUDEDIR}
+   ${WAYLAND_INCLUDE_DIRS}
)
endif()
if(PIGLIT_HAS_X11)
-- 
2.11.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 3/3] arb_texture_view: fix security format warnings

2018-11-30 Thread Ross Burton
If built with -Werror=format-security then Piglit fails to build:

/tests/spec/arb_texture_view/rendering-layers-image.c:150:8:
error: format not a string literal and no format arguments 
[-Werror=format-security]
 (desc)); \
 ^~

In this case test->uniform_type is being turned into a string using snprintf()
and then passed to piglit_report_subtest_result() which takes a format string,
but GCC can't verify the format.

As _subtest_report() takes a format string, we can just remove the snprintf()
and let it construct the label.

Signed-off-by: Ross Burton 
---
 tests/spec/arb_texture_view/rendering-layers-image.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/tests/spec/arb_texture_view/rendering-layers-image.c 
b/tests/spec/arb_texture_view/rendering-layers-image.c
index 415b01657..070e29a68 100644
--- a/tests/spec/arb_texture_view/rendering-layers-image.c
+++ b/tests/spec/arb_texture_view/rendering-layers-image.c
@@ -142,12 +142,12 @@ test_render_layers(const struct test_info *test)
return pass;
 }
 
-#define X(f, desc) \
+#define X(f, test_type) \
do { \
const bool subtest_pass = (f); \
piglit_report_subtest_result(subtest_pass \
 ? PIGLIT_PASS : PIGLIT_FAIL, \
-(desc)); \
+"layers rendering of %s", 
(test_type)); \
pass = pass && subtest_pass; \
} while (0)
 
@@ -157,9 +157,7 @@ piglit_display(void)
bool pass = true;
for (int test_idx = 0; test_idx < ARRAY_SIZE(tests); test_idx++) {
const struct test_info *test = &tests[test_idx];
-   char test_name[128];
-   snprintf(test_name, sizeof(test_name), "layers rendering of 
%s", test->uniform_type);
-   X(test_render_layers(test), test_name);
+   X(test_render_layers(test), test->uniform_type);
}
 #undef X
pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
-- 
2.11.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 2/3] tests: Use FE_UPWARD only if its defined in fenv.h

2018-11-30 Thread Ross Burton
From: Khem Raj 

On ARM, musl does not define FE_* when arch does not have
VFP, (which is right interpretation), therefore check if
it is defined before using it.

Fixes errors like:

tests/general/roundmode-pixelstore.c:82:19: error: 'FE_UPWARD' undeclared 
(first use in this function)
  ret = fesetround(FE_UPWARD);
   ^

Signed-off-by: Khem Raj 
---
 tests/general/roundmode-getintegerv.c | 2 ++
 tests/general/roundmode-pixelstore.c  | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/tests/general/roundmode-getintegerv.c 
b/tests/general/roundmode-getintegerv.c
index 28ecfaf55..5c275797b 100644
--- a/tests/general/roundmode-getintegerv.c
+++ b/tests/general/roundmode-getintegerv.c
@@ -81,7 +81,9 @@ piglit_init(int argc, char **argv)
 {
int ret;
bool pass = true;
+#ifdef FE_UPWARD
ret = fesetround(FE_UPWARD);
+#endif
if (ret != 0) {
printf("Couldn't set rounding mode\n");
piglit_report_result(PIGLIT_SKIP);
diff --git a/tests/general/roundmode-pixelstore.c 
b/tests/general/roundmode-pixelstore.c
index 8a029b257..51951a0d9 100644
--- a/tests/general/roundmode-pixelstore.c
+++ b/tests/general/roundmode-pixelstore.c
@@ -81,7 +81,9 @@ piglit_init(int argc, char **argv)
 {
int ret;
bool pass = true;
+#ifdef FE_UPWARD
ret = fesetround(FE_UPWARD);
+#endif
if (ret != 0) {
printf("Couldn't set rounding mode\n");
piglit_report_result(PIGLIT_SKIP);
-- 
2.11.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit