Re: [Piglit] [PATCH 2/2] shader_runner: Support PIGLIT_DEFAULT_SIZE env var

2018-01-31 Thread Brian Paul

On 01/31/2018 05:02 PM, Jordan Justen wrote:

Signed-off-by: Jordan Justen 
---
  tests/shaders/shader_runner.c | 12 
  1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 700b11327..c6ee8e3de 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -46,8 +46,10 @@ decode_drawing_mode(const char *mode_str);
  
  PIGLIT_GL_TEST_CONFIG_BEGIN
  
-	config.window_width = DEFAULT_WINDOW_WIDTH;

-   config.window_height = DEFAULT_WINDOW_HEIGHT;
+   if (!piglit_gl_test_config_override_size(&config)) {
+   config.window_width = DEFAULT_WINDOW_WIDTH;
+   config.window_height = DEFAULT_WINDOW_HEIGHT;
+   }
config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
config.khr_no_error_support = PIGLIT_NO_ERRORS;
  
@@ -3926,8 +3928,10 @@ validate_current_gl_context(const char *filename)

  {
struct piglit_gl_test_config config = { 0 };
  
-	config.window_width = DEFAULT_WINDOW_WIDTH;

-   config.window_height = DEFAULT_WINDOW_HEIGHT;
+   if (!piglit_gl_test_config_override_size(&config)) {
+   config.window_width = DEFAULT_WINDOW_WIDTH;
+   config.window_height = DEFAULT_WINDOW_HEIGHT;
+   }
  
  	get_required_config(filename, &config);
  



For the series,
Reviewed-by: Brian Paul 
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 2/2] shader_runner: Support PIGLIT_DEFAULT_SIZE env var

2018-01-31 Thread Jordan Justen
Signed-off-by: Jordan Justen 
---
 tests/shaders/shader_runner.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 700b11327..c6ee8e3de 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -46,8 +46,10 @@ decode_drawing_mode(const char *mode_str);
 
 PIGLIT_GL_TEST_CONFIG_BEGIN
 
-   config.window_width = DEFAULT_WINDOW_WIDTH;
-   config.window_height = DEFAULT_WINDOW_HEIGHT;
+   if (!piglit_gl_test_config_override_size(&config)) {
+   config.window_width = DEFAULT_WINDOW_WIDTH;
+   config.window_height = DEFAULT_WINDOW_HEIGHT;
+   }
config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
config.khr_no_error_support = PIGLIT_NO_ERRORS;
 
@@ -3926,8 +3928,10 @@ validate_current_gl_context(const char *filename)
 {
struct piglit_gl_test_config config = { 0 };
 
-   config.window_width = DEFAULT_WINDOW_WIDTH;
-   config.window_height = DEFAULT_WINDOW_HEIGHT;
+   if (!piglit_gl_test_config_override_size(&config)) {
+   config.window_width = DEFAULT_WINDOW_WIDTH;
+   config.window_height = DEFAULT_WINDOW_HEIGHT;
+   }
 
get_required_config(filename, &config);
 
-- 
2.15.1

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


[Piglit] [PATCH 1/2] framework-gl: Export window size override function

2018-01-31 Thread Jordan Justen
Signed-off-by: Jordan Justen 
---
 tests/util/piglit-framework-gl.c | 6 +++---
 tests/util/piglit-framework-gl.h | 3 +++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/tests/util/piglit-framework-gl.c b/tests/util/piglit-framework-gl.c
index 1b2078d5c..c80441870 100644
--- a/tests/util/piglit-framework-gl.c
+++ b/tests/util/piglit-framework-gl.c
@@ -47,8 +47,8 @@ static void
 process_args(int *argc, char *argv[], unsigned *force_samples,
 struct piglit_gl_test_config *config);
 
-static bool
-override_size(struct piglit_gl_test_config *config)
+bool
+piglit_gl_test_config_override_size(struct piglit_gl_test_config *config)
 {
const char *default_size;
unsigned int width;
@@ -74,7 +74,7 @@ piglit_gl_test_config_init(struct piglit_gl_test_config 
*config)
 {
memset(config, 0, sizeof(*config));
 
-   if (!override_size(config)) {
+   if (!piglit_gl_test_config_override_size(config)) {
/* Default window size.  Note: Win8's min window width */
/* seems to be 160 pixels.  When the window size is */
/* unexpectedly resized, tests are marked as "WARN". */
diff --git a/tests/util/piglit-framework-gl.h b/tests/util/piglit-framework-gl.h
index 970fd5502..a4ecddbe7 100644
--- a/tests/util/piglit-framework-gl.h
+++ b/tests/util/piglit-framework-gl.h
@@ -226,6 +226,9 @@ void
 piglit_gl_process_args(int *argc, char *argv[],
   struct piglit_gl_test_config *config);
 
+bool
+piglit_gl_test_config_override_size(struct piglit_gl_test_config *config);
+
 /**
  * Get the list of command-line selected tests from the piglit_gl_test_config
  *
-- 
2.15.1

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


Re: [Piglit] [PATCH v3] travis: add docker based cmake build job

2018-01-31 Thread Andres Gomez
On Mon, 2018-01-29 at 14:06 -0800, Eric Anholt wrote:
> Andres Gomez  writes:
> 
> > Until now we were only running the python unit tests.
> > 
> > It seems desirable to also check that the CMake based build compiles
> > successfully. We do that now using docker.
> > 
> > The docker build can be tweaked with some environment variables and,
> > also, be stored in the docker hub if desired. Check the changes for
> > extra details regarding these variables.
> > 
> > v2: Removed other build possibilities other than just from inside
> > Travis-CI, as suggested by Juan.
> > v3: Replaced the "RELEASE" parameter to create the docker image with
> > "PARENT" and removed some unneeded documentation after v2, as
> > suggested by Juan.
> > 
> > Cc: Dylan Baker 
> > Cc: Juan A. Suarez 
> > Signed-off-by: Andres Gomez 
> > Reviewed-by: Juan A. Suarez 
> 
> I'm definitely interested in extending our tests using Travis, but could
> you add some comments explaining what this system does?  Do we do a
> bunch of image build work (numpy/six/mako install) on each Travis build,
> or does it get cached?  Do I need to do any setup in Travis in order for
> this to take effect?

Yes, I should have been already more verbose with explanations when
posting this patch in the first place.

First, thanks to your reply I've sent a new v4 version after finding a
couple of issues.

With this v4 version, you can check this travis build, which is where
I've tested the patch:
https://travis-ci.org/Igalia/piglit/builds/335657962

There you will see that, in addition to the usual 5 python builds
running the unit tests, there is an additional cmake build, this is the
docker based build:
https://travis-ci.org/Igalia/piglit/jobs/335657970

Without any special setup in Travis, the docker build will run with the
default options. This will be done on every run:
 * Download the parent ubuntu:xenial image.
 * Install building dependencies from APT.
 * Install additional Python dependencies (numpy/six/mako).
 * Build piglit.

The build is, however, quite quick since docker and travis have many of
the needed bits cached and it also makes use of ccache, but still this
process has to happen every time.

Now, this patch allows a couple of additional tweaks:
   1. You can select a different parent image by setting in Travis-CI the
  env variable DOCKER_PARENT. You could want to do this for different
  reasons. From the top of my head:
   * To speed up the build; using a parent image with the APT and
  Python dependencies already installed.
   * To create a build in which there are additional or alternative
  libraries installed; for example, at Igalia, we have the docker
  image "igalia/mesa:released-17.3.3.debug". This way, in case we
  want to later use the generated docker image to test piglit, we
  will be able to run the test suite against mesa-17.3.3 built with
  debug symbols.
   2. You can define a docker hub repository to which upload the generated
  build as "$DOCKER_IMAGE:$DOCKER_TAG". For that, you have to set in
  Travis-CI the following env variables:
   * DOCKER_IMAGE: The path to the docker hub repository you want to
  use. We use "igalia/mesa".
   * DOCKER_TAG: The specific tag for the newly created image. For
  example, you could use "piglit". Therefore, in our case, a new
  build will be uploaded as "igalia/mesa:piglit".
   * DOCKER_USERNAME: Your user to the docker hub.
   * DOCKER_PASSWORD: Your password for the docker hub.

Combining 1. and 2. you could have, for example, automatic builds of
piglit's master uploaded to your personal docker hub with a specific
mesa version installed. This is very useful for later running the test
suite. It is also a good way of providing a specific environment for
debugging/reproducing a bug and share with other developers.

I hope this clarifies further the aim of this integration.

PS: If this is accepted in piglit, my next step is to work in a patch
proposal for having a similar use case for mesa. This will ease the
combination of 1. and 2. that I was mentioning.
-- 
Br,

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


[Piglit] [PATCH v4] travis: add docker based cmake build job

2018-01-31 Thread Andres Gomez
Until now we were only running the python unit tests.

It seems desirable to also check that the CMake based build compiles
successfully. We do that now using docker.

The docker build can be tweaked with some environment variables and,
also, be stored in the docker hub if desired. Check the changes for
extra details regarding these variables.

v2: Removed other build possibilities other than just from inside
Travis-CI, as suggested by Juan.
v3: Replaced the "RELEASE" parameter to create the docker image with
"PARENT" and removed some unneeded documentation after v2, as
suggested by Juan.
v4:
  - Use DOCKER_PARENT, DOCKER_IMAGE and DOCKER_TAG variables from the
custom Travis-CI setup to define the PARENT, IMAGE and TAG
parameters during the docker image creation.
  - Upload the image only if DOCKER_IMAGE and DOCKER_TAG are set.

Cc: Dylan Baker 
Cc: Juan A. Suarez 
Signed-off-by: Andres Gomez 
Reviewed-by: Juan A. Suarez 
---
 .travis.yml  | 47 --
 docker/Rockerfile.piglit | 74 
 2 files changed, 118 insertions(+), 3 deletions(-)
 create mode 100644 docker/Rockerfile.piglit

diff --git a/.travis.yml b/.travis.yml
index b47829ff9..b4cbcca49 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,16 @@
+sudo: false
+os: linux
 language: python
-cache: pip
+cache:
+  - ccache
+  - pip
+services:
+  - docker
+
+env:
+  global:
+- BUILD=pytest
+
 matrix:
   include:
 - python: 2.7
@@ -12,7 +23,37 @@ matrix:
   env: TOX_ENV="py35-{generator,noaccel,accel-nix,streams}"
 - python: 3.6
   env: TOX_ENV="py36-{generator,noaccel,accel-nix,streams}"
+- env: BUILD=cmake
+
 install:
-pip install tox
+  - |
+if [[ $BUILD == pytest ]]; then
+  pip install tox
+else
+  wget 
https://github.com/grammarly/rocker/releases/download/1.3.1/rocker-1.3.1-linux_amd64.tar.gz
+  tar xvf rocker-1.3.1-linux_amd64.tar.gz
+  rm rocker-1.3.1-linux_amd64.tar.gz
+fi
+
+before_script:
+  - |
+if [[ $BUILD != pytest ]]; then
+  mkdir -p -m777 ~/.ccache
+fi
+
 script:
-- tox -e $TOX_ENV
+  - |
+if [[ $BUILD == pytest ]]; then
+  tox -e $TOX_ENV
+else
+  ./rocker build -f docker/Rockerfile.piglit ${DOCKER_TAG:+--var 
TAG=}${DOCKER_TAG} ${DOCKER_IMAGE:+--var IMAGE=}${DOCKER_IMAGE} 
${DOCKER_PARENT:+--var PARENT=}${DOCKER_PARENT} .
+fi
+
+after_success:
+  - |
+if [[ $BUILD != pytest ]]; then
+  if [[ -n $DOCKER_IMAGE && -n $DOCKER_TAG && -n $DOCKER_USERNAME && 
$TRAVIS_BRANCH == master ]]; then
+docker login -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}"
+docker push "${DOCKER_IMAGE}":"${DOCKER_TAG}"
+  fi
+fi
diff --git a/docker/Rockerfile.piglit b/docker/Rockerfile.piglit
new file mode 100644
index 0..0d8f8bb45
--- /dev/null
+++ b/docker/Rockerfile.piglit
@@ -0,0 +1,74 @@
+#
+# This builds Piglit.
+#
+# ~~~
+#  rocker build -f Rockerfile.piglit [--attach]
 \
+#[--var IMAGE=freedesktop/mesa] # freedesktop/mesa, myrepo/myproyect, ...  
 \
+#[--var TAG=piglit] # piglit-17.0, piglit-13.0, ...
 \
+#[--var PARENT=ubuntu:xenial]   # ubuntu:xenial, freedesktop/mesa:17.3, ...
+# ~~~
+#
+# Environment variables that are used in the build:
+#  - MAKEFLAGS: flags to pass to make (e.g., "-j8")
+#  - CCACHE_DIR: ccache directory (default: ~/.ccache)
+#
+# To run
+#
+# ~~~
+#   mkdir -p -m777 ~/my_results_dir
+#   docker run --privileged --rm -t -v ~/my_results_dir:/results:Z  \
+#  -v /tmp/.X11-unix:/tmp/.X11-unix freedesktop/mesa:piglit
+# ~~~
+#
+
+{{ $image := (or .IMAGE "freedesktop/mesa") }}
+{{ $parent_image := (or .PARENT "ubuntu:xenial") }}
+{{ $ccachedir := (or .Env.CCACHE_DIR "~/.ccache") }}
+
+FROM {{ $parent_image }}
+
+LABEL maintainer "Andres Gomez "
+
+USER root
+
+ENV LC_ALL=C.UTF-8
+
+RUN apt-get update  \
+  && apt-get -y --no-install-recommends install sudo gcc g++ ccache \
+git pkg-config bash-completion cmake\
+libz-dev libpng-dev libgl-dev libegl1-mesa-dev libwaffle-dev\
+python3-setuptools python3-pip  \
+  && rm -fr /var/lib/apt/lists/*
+
+RUN pip3 install numpy six mako
+
+RUN getent passwd local > /dev/null || adduser --gecos "" local && passwd -d 
local && adduser local sudo
+
+USER local
+
+{{ if .Env.MAKEFLAGS }}
+ENV MAKEFLAGS={{ .Env.MAKEFLAGS }}
+{{ end }}
+
+WORKDIR /home/local
+
+MOUNT {{ $ccachedir }}:/home/local/.ccache:Z
+
+RUN sudo chown -R local:local /home/local/.ccache
+
+ENV PATH=/usr/lib/ccache:$PATH
+
+ADD . /home/local/piglit
+RUN sudo chown -R local:local /home/local/piglit
+
+WORKDIR /home/local/piglit
+
+ATTACH [ "/bin/bash" ]
+
+RUN cmake . && cmake --build .
+
+VOLUME /results
+
+{{ if .TAG }}
+TAG {{ $image }}:{{ .TAG }}
+{{ end }}
-- 
2.15.1

__