Piglit is the opensource OpenGL/OpenCL test suite. Currently
only OpenCL tests are working. OpenGL needs some more work, but this
should be a solid foundation for future work.

Signed-off-by: Lucas Stach <[email protected]>
---
 .../0001-refine-dependency-checks.patch            | 51 ++++++++++++++++++
 ...on-t-pass-NULL-ptr-to-initial-strtok-call.patch | 39 ++++++++++++++
 patches/piglit-6ed55113338ebebe/series             |  5 ++
 rules/piglit.in                                    | 43 +++++++++++++++
 rules/piglit.make                                  | 63 ++++++++++++++++++++++
 5 files changed, 201 insertions(+)
 create mode 100644 
patches/piglit-6ed55113338ebebe/0001-refine-dependency-checks.patch
 create mode 100644 
patches/piglit-6ed55113338ebebe/0002-cl-tests-don-t-pass-NULL-ptr-to-initial-strtok-call.patch
 create mode 100644 patches/piglit-6ed55113338ebebe/series
 create mode 100644 rules/piglit.in
 create mode 100644 rules/piglit.make

diff --git 
a/patches/piglit-6ed55113338ebebe/0001-refine-dependency-checks.patch 
b/patches/piglit-6ed55113338ebebe/0001-refine-dependency-checks.patch
new file mode 100644
index 000000000000..3ce9e901279c
--- /dev/null
+++ b/patches/piglit-6ed55113338ebebe/0001-refine-dependency-checks.patch
@@ -0,0 +1,51 @@
+From: Lucas Stach <[email protected]>
+Date: Wed, 3 Jun 2015 16:47:50 +0200
+Subject: [PATCH] refine dependency checks
+
+Allows to build OpenCL tests without the need for python-numpy and
+libwaffle or GLUT.
+
+Signed-off-by: Lucas Stach <[email protected]>
+---
+ CMakeLists.txt | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 2208dc73b46a..1159c4bf28b4 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -48,6 +48,8 @@ else()
+       option(PIGLIT_USE_WAFFLE "Use Waffle in place of GLUT" OFF)
+ endif()
+ 
++if(PIGLIT_BUILD_GL_TESTS OR PIGLIT_BUILD_GLES1_TESTS OR
++   PIGLIT_BUILD_GLES2_TESTS OR PIGLIT_BUILD_GLES3_TESTS)
+ if(PIGLIT_USE_WAFFLE)
+       if (NOT WIN32)
+               pkg_check_modules(Waffle REQUIRED waffle-1)
+@@ -104,6 +106,8 @@ else()
+               message(FATAL_ERROR "GLUT library not found")
+       endif()
+ endif(PIGLIT_USE_WAFFLE)
++endif(PIGLIT_BUILD_GL_TESTS OR PIGLIT_BUILD_GLES1_TESTS OR
++      PIGLIT_BUILD_GLES2_TESTS OR PIGLIT_BUILD_GLES3_TESTS)
+ 
+ if(PIGLIT_BUILD_GLES1_TESTS AND NOT PIGLIT_USE_WAFFLE)
+       message(FATAL_ERROR "Option PIGLIT_BUILD_GLES1_TESTS requires 
PIGLIT_USE_WAFFLE")
+@@ -195,10 +199,15 @@ IF(PIGLIT_BUILD_GLX_TESTS)
+ ENDIF()
+ 
+ find_package(PythonInterp 2.7 REQUIRED)
+-find_package(PythonNumpy 1.6.2 REQUIRED)
+ find_package(PythonMako 0.8.0 REQUIRED)
+ find_package(PythonSix 1.4.0 REQUIRED)
+ 
++if(PIGLIT_BUILD_GL_TESTS OR PIGLIT_BUILD_GLES1_TESTS OR
++   PIGLIT_BUILD_GLES2_TESTS OR PIGLIT_BUILD_GLES3_TESTS)
++      find_package(PythonNumpy 1.6.2 REQUIRED)
++endif(PIGLIT_BUILD_GL_TESTS OR PIGLIT_BUILD_GLES1_TESTS OR
++      PIGLIT_BUILD_GLES2_TESTS OR PIGLIT_BUILD_GLES3_TESTS)
++
+ # Default to compiling with debug information (`gcc -g`):
+ if(NOT CMAKE_BUILD_TYPE)
+       SET(CMAKE_BUILD_TYPE Debug CACHE STRING
diff --git 
a/patches/piglit-6ed55113338ebebe/0002-cl-tests-don-t-pass-NULL-ptr-to-initial-strtok-call.patch
 
b/patches/piglit-6ed55113338ebebe/0002-cl-tests-don-t-pass-NULL-ptr-to-initial-strtok-call.patch
new file mode 100644
index 000000000000..6268e445ed6d
--- /dev/null
+++ 
b/patches/piglit-6ed55113338ebebe/0002-cl-tests-don-t-pass-NULL-ptr-to-initial-strtok-call.patch
@@ -0,0 +1,39 @@
+From: Lucas Stach <[email protected]>
+Date: Wed, 3 Jun 2015 16:49:07 +0200
+Subject: [PATCH] cl-tests: don't pass NULL ptr to initial strtok call
+
+If the test doesn't require specific extensions a NULL ptr is
+passed to the initial call of strtok(). Apparently this works on
+x86, but crashes on ARM. The documentation does not really say
+what the expected behavior is, but bailing out in this case fixes
+the segfault and allows the tests to run.
+
+Signed-off-by: Lucas Stach <[email protected]>
+---
+ tests/util/piglit-framework-cl.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/tests/util/piglit-framework-cl.c 
b/tests/util/piglit-framework-cl.c
+index 9a7efef1d93b..9dc73c7e3508 100644
+--- a/tests/util/piglit-framework-cl.c
++++ b/tests/util/piglit-framework-cl.c
+@@ -86,6 +86,9 @@ bool check_platform_extensions(cl_platform_id platform_id, 
char* extensions)
+ {
+       char* pch;
+ 
++      if (!extensions)
++              return true;
++
+       pch = strtok(extensions, " ");
+       while(pch != NULL) {
+               if(   strlen(pch) > 0
+@@ -108,6 +111,9 @@ bool check_device_extensions(cl_device_id device_id, char* 
extensions)
+ {
+       char* pch;
+ 
++      if (!extensions)
++              return true;
++
+       pch = strtok(extensions, " ");
+       while(pch != NULL) {
+               if(   strlen(pch) > 0
diff --git a/patches/piglit-6ed55113338ebebe/series 
b/patches/piglit-6ed55113338ebebe/series
new file mode 100644
index 000000000000..260ecedb3dcc
--- /dev/null
+++ b/patches/piglit-6ed55113338ebebe/series
@@ -0,0 +1,5 @@
+# generated by git-ptx-patches
+#tag:base --start-number 1
+0001-refine-dependency-checks.patch
+0002-cl-tests-don-t-pass-NULL-ptr-to-initial-strtok-call.patch
+# 510c99d0cb02d3d3f3c258d3f615804e  - git-ptx-patches magic
diff --git a/rules/piglit.in b/rules/piglit.in
new file mode 100644
index 000000000000..70842d68637a
--- /dev/null
+++ b/rules/piglit.in
@@ -0,0 +1,43 @@
+## SECTION=test_suites
+
+menuconfig PIGLIT
+       tristate
+       prompt "piglit"
+       select HOST_CMAKE
+       select HOST_PYTHON
+       select HOST_PYTHON_SIX
+       select HOST_PYTHON_SETUPTOOLS
+       select PYTHON
+       select PYTHON_MAKO
+       help
+         Piglit is the opensource OpenGL/OpenCL test suite.
+
+if PIGLIT
+
+# OpenGL tests need some more dependencies sorted out
+
+config PIGLIT_TESTS_OPENGL
+       bool
+       prompt "build OpenGL tests"
+       depends on BROKEN
+
+config PIGLIT_TESTS_OPENGLES1
+       bool
+       prompt "build OpenGL ES1 tests"
+       depends on BROKEN
+
+config PIGLIT_TESTS_OPENGLES2
+       bool
+       prompt "build OpenGL ES2 tests"
+       depends on BROKEN
+
+config PIGLIT_TESTS_OPENGLES3
+       bool
+       prompt "build OpenGL ES3 tests"
+       depends on BROKEN
+
+config PIGLIT_TESTS_OPENCL
+       bool
+       prompt "build OpenCL tests"
+
+endif
diff --git a/rules/piglit.make b/rules/piglit.make
new file mode 100644
index 000000000000..f522d59da88e
--- /dev/null
+++ b/rules/piglit.make
@@ -0,0 +1,63 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2015 by Lucas Stach <[email protected]>
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+PACKAGES-$(PTXCONF_PIGLIT) += piglit
+
+#
+# Paths and names
+#
+PIGLIT_VERSION := 6ed55113338ebebe
+PIGLIT_MD5     := c72ae684ba39f00db039f76818489b48
+PIGLIT         := piglit-$(PIGLIT_VERSION)
+PIGLIT_SUFFIX  := tar.xz
+PIGLIT_URL     := 
http://anongit.freedesktop.org/git/piglit.git;tag=$(PIGLIT_VERSION)
+PIGLIT_SOURCE  := $(SRCDIR)/$(PIGLIT).$(PIGLIT_SUFFIX)
+PIGLIT_DIR     := $(BUILDDIR)/$(PIGLIT)
+PIGLIT_LICENSE := unknown
+
+# ----------------------------------------------------------------------------
+# Prepare
+# ----------------------------------------------------------------------------
+
+PIGLIT_BUILD_OOT       := NO
+PIGLIT_CONF_TOOL       := cmake
+
+PIGLIT_CONF_OPT        := $(CROSS_CMAKE_USR) \
+       -DPIGLIT_USE_WAFFLE=0 \
+       -DPIGLIT_BUILD_GL_TESTS=$(call ptx/ifdef, 
PTXCONF_PIGLIT_TESTS_OPENGL,1,0) \
+       -DPIGLIT_BUILD_GLES1_TESTS=$(call ptx/ifdef, 
PTXCONF_PIGLIT_TESTS_OPENGLES1,1,0) \
+       -DPIGLIT_BUILD_GLES2_TESTS=$(call ptx/ifdef, 
PTXCONF_PIGLIT_TESTS_OPENGLES2,1,0) \
+       -DPIGLIT_BUILD_GLES3_TESTS=$(call ptx/ifdef, 
PTXCONF_PIGLIT_TESTS_OPENGLES3,1,0) \
+       -DPIGLIT_BUILD_CL_TESTS=$(call ptx/ifdef, 
PTXCONF_PIGLIT_TESTS_OPENCL,1,0)
+
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/piglit.targetinstall:
+       @$(call targetinfo)
+
+       @$(call install_init, piglit)
+       @$(call install_fixup, piglit,PRIORITY,optional)
+       @$(call install_fixup, piglit,SECTION,base)
+       @$(call install_fixup, piglit,AUTHOR,"Lucas Stach 
<[email protected]>")
+       @$(call install_fixup, piglit,DESCRIPTION,missing)
+
+       @$(call install_copy, piglit, 0, 0, 755, -, /usr/bin/piglit)
+       @$(call install_tree, piglit, 0, 0, -, /usr/lib/piglit)
+
+       @$(call install_finish, piglit)
+
+       @$(call touch)
+
+# vim: syntax=make
-- 
2.1.4


-- 
ptxdist mailing list
[email protected]

Reply via email to