[Intel-gfx] [PATCH 8/8] build: Provide an --enable-simulation configure option

Daniel Vetter daniel at ffwll.ch
Fri Jul 19 19:05:29 CEST 2013


On Fri, Jul 19, 2013 at 05:49:48PM +0100, Damien Lespiau wrote:
> Remembering to set an environment variable is too much trouble, we can
> now specify --enable-simulation at configure time and always run the
> test suite tuned for simulation.
> 
> Signed-off-by: Damien Lespiau <damien.lespiau at intel.com>

tbh I'd vote for runtime detection, we could simply add a debugfs file on
the internal tree which exposes dev_priv->is_simulator. Or heck merge that
part upstream even.

Imo that's better since iirc QA is using a central build server and
distributes binaries to test machines. Ofc they need to build different
sources already, but different options is a bit more messy than just
changing the git remote ...
-Daniel

> ---
>  configure.ac                        | 11 +++++++++++
>  lib/drmtest.c                       | 14 ++++++++++++--
>  tests/.gitignore                    |  1 +
>  tests/{drm_lib.sh => drm_lib.sh.in} |  3 ++-
>  4 files changed, 26 insertions(+), 3 deletions(-)
>  rename tests/{drm_lib.sh => drm_lib.sh.in} (88%)
> 
> diff --git a/configure.ac b/configure.ac
> index 1626ce8..0bf4764 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -168,6 +168,15 @@ if test "x$BUILD_TESTS" = xyes; then
>  fi
>  AM_CONDITIONAL(BUILD_TESTS, [test "x$BUILD_TESTS" = xyes])
>  
> +AC_ARG_ENABLE([simulation],
> +	      [AS_HELP_STRING([--enable-simulation],
> +			      [Tune i-g-t for simulation environments])],
> +	      [], [enable_simulation=no])
> +AS_IF([test x"$enable_simulation" = "xyes"],
> +      [AC_DEFINE([ENABLE_SIMULATION], [1],
> +		 [i-g-t compiled with simulation environments support])])
> +AC_SUBST([ENABLE_SIMULATION], [$enable_simulation])
> +
>  AC_CONFIG_FILES([
>  		 Makefile
>  		 benchmarks/Makefile
> @@ -178,6 +187,7 @@ AC_CONFIG_FILES([
>  		 tests/Makefile
>  		 tools/Makefile
>  		 tools/quick_dump/Makefile
> +		 tests/drm_lib.sh
>  		 debugger/Makefile
>  		 debugger/system_routine/Makefile
>  		 assembler/Makefile
> @@ -195,6 +205,7 @@ echo ""
>  echo " • Tests:"
>  echo "       Build tests        : ${BUILD_TESTS}"
>  echo "       Compile prime tests: ${NOUVEAU}"
> +echo "       Simulation support : ${enable_simulation}"
>  echo ""
>  echo " • Tools:"
>  echo "       Assembler          : ${enable_assembler}"
> diff --git a/lib/drmtest.c b/lib/drmtest.c
> index 26748b3..17e48b0 100644
> --- a/lib/drmtest.c
> +++ b/lib/drmtest.c
> @@ -26,7 +26,10 @@
>   *
>   */
>  
> -#define _GNU_SOURCE
> +#ifdef HAVE_CONFIG_H
> +#include "config.h"
> +#endif
> +
>  #include <stdio.h>
>  #include <fcntl.h>
>  #include <sys/stat.h>
> @@ -700,12 +703,19 @@ static bool env_set(const char *env_var, bool default_value)
>  	return atoi(val) != 0;
>  }
>  
> +#ifdef ENABLE_SIMULATION
> +#define INTEL_SIMULATION_DEFAULT	true
> +#else
> +#define INTEL_SIMULATION_DEFAULT	false
> +#endif
> +
>  bool drmtest_run_in_simulation(void)
>  {
>  	static int simulation = -1;
>  
>  	if (simulation == -1)
> -		simulation = env_set("INTEL_SIMULATION", false);
> +		simulation = env_set("INTEL_SIMULATION",
> +				     INTEL_SIMULATION_DEFAULT);
>  
>  	return simulation;
>  }
> diff --git a/tests/.gitignore b/tests/.gitignore
> index d256695..6131c78 100644
> --- a/tests/.gitignore
> +++ b/tests/.gitignore
> @@ -1,4 +1,5 @@
>  ddi_compute_wrpll
> +drm_lib.sh
>  drm_vma_limiter
>  drm_vma_limiter_cached
>  drm_vma_limiter_cpu
> diff --git a/tests/drm_lib.sh b/tests/drm_lib.sh.in
> similarity index 88%
> rename from tests/drm_lib.sh
> rename to tests/drm_lib.sh.in
> index 25197d4..9e482ea 100755
> --- a/tests/drm_lib.sh
> +++ b/tests/drm_lib.sh.in
> @@ -39,9 +39,10 @@ if [ -d /sys/class/drm ] ; then
>  fi
>  # sysfs may not exist as the 'error' is a new interface in 3.11
>  
> +enable_simulation=@ENABLE_SIMULATION@
>  function drmtest_skip_on_simulation()
>  {
> -	[ -n "$INTEL_SIMULATION" ] && exit 77
> +	[ x"$enable_simulation" = "xyes" -o -n "$INTEL_SIMULATION" ] && exit 77
>  }
>  
>  drmtest_skip_on_simulation
> -- 
> 1.8.3.1
> 

> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx


-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch



More information about the Intel-gfx mailing list