Skip to contentSkip to conversation

i-g-t --enable-simulation and various build fixes

PATCH In review Damien Lespiau 2 participants 11 messages Jul 19, 2013 Library code

lore
Share & tools
lore
#0 lore raw

Jesse suggested an --enable-simulation configure option because having to remember setting the env variable is too hard. After having experienced that myself and gone through several painful stop/restart cycles of the simulation, I decided it was worth making it happen.

Signature · 1 line
Damien
#1 lore raw

PATCH 1/8 build: Fix a small typo in configure.ac

---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configure.ac +1 -1
index 2eba12a..59d01cf 100644
@@ -61,7 +61,7 @@ XORG_MACROS_VERSION(1.16)
 XORG_DEFAULT_OPTIONS
 
 # warning flags for the assembler. We can't quite use CWARNFLAGS for it yet as
-# it generates waaaay to many warnings.
+# it generates waaaay too many warnings.
 ASSEMBLER_WARN_CFLAGS=""
 if test "x$GCC" = "xyes"; then
 	ASSEMBLER_WARN_CFLAGS="-Wall -Wstrict-prototypes \
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH 2/8 build: Fix unbalanced quoting in the python dumper AC_ARG_ENABLE()

In reply to Damien Lespiau
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configure.ac +1 -1
index 59d01cf..caf929c 100644
@@ -104,7 +104,7 @@ AM_CONDITIONAL(HAVE_NOUVEAU, [test "x$NOUVEAU" = xyes])
 AC_ARG_ENABLE(dumper,
 	      AS_HELP_STRING([--disable-dumper],
 			     [Disable the python based register dumper (default: enabled)]),
-			     DUMPER=$enableval], [DUMPER=yes])
+			     [DUMPER=$enableval], [DUMPER=yes])
 if test "x$DUMPER" == xyes; then
 	AC_DEFINE(HAVE_DUMPER, 1, [Have dumper support])
 	# SWIG configuration
Signature · 1 line
1.8.3.1
#3 lore raw

PATCH 3/8 build: Fix automake 1.13 warnings

In reply to Damien Lespiau

warning: deprecated feature: target 'sr' overrides 'sr$(EXEEXT)'

---
 debugger/system_routine/Makefile.am | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
debugger/system_routine/Makefile.am +2 -2
index 2576e2a..03f0f0f 100644
@@ -21,7 +21,7 @@ sr.c: sr.asm
 	$(GEN4ASM) $(GEN4ASM_FLAGS) sr.asm -o $@
 sr.o : sr.c
 	$(CC) -c -o $@ sr.c
-sr : sr.o
+sr$(EXEEXT) : sr.o
 	$(OBJCOPY) -O binary -K gen_eu_bytes sr.o $@
 
 # Test.g4a is the simplest possible system routine we can run on the GPU
@@ -35,7 +35,7 @@ tiny.c: tiny.asm
 	$(GEN4ASM) $(GEN4ASM_FLAGS) tiny.asm -o $@
 tiny.o : tiny.c
 	$(CC) -c -o $@ tiny.c
-tiny : tiny.o
+tiny$(EXEEXT) : tiny.o
 	$(OBJCOPY) -O binary -K gen_eu_bytes tiny.o $@
 
 CLEANFILES = evict.h sr.cpp sr.asm sr.c tiny.cpp tiny.asm tiny.c
Signature · 1 line
1.8.3.1
#4 lore raw

PATCH 4/8 build: Pimp up the configure summary

In reply to Damien Lespiau

This helps people compiling i-g-t figuring out what can be optional.

---
 configure.ac | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
configure.ac +7 -2
index caf929c..1626ce8 100644
@@ -192,9 +192,14 @@ echo ""
 echo "Intel GPU tools"
 
 echo ""
+echo " • Tests:"
+echo "       Build tests        : ${BUILD_TESTS}"
+echo "       Compile prime tests: ${NOUVEAU}"
+echo ""
 echo " • Tools:"
-echo "       Assembler: ${enable_assembler}"
-echo "       Debugger: ${enable_debugger}"
+echo "       Assembler          : ${enable_assembler}"
+echo "       Debugger           : ${enable_debugger}"
+echo "       Python dumper      : ${DUMPER}"
 echo ""
 
 # vim: set ft=config ts=8 sw=8 tw=0 noet :
Signature · 1 line
1.8.3.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

PATCH 5/8 lib: Allow users of env_set() to specify a default value

In reply to Damien Lespiau

So when the environment value isn't set, one can specify the default value to return.

---
 lib/drmtest.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
lib/drmtest.c +3 -3
index 016619c..26748b3 100644
@@ -689,13 +689,13 @@ bool drmtest_only_list_subtests(void)
 	return list_subtests;
 }
 
-static bool env_set(const char *env_var)
+static bool env_set(const char *env_var, bool default_value)
 {
 	char *val;
 
 	val = getenv(env_var);
 	if (!val)
-		return false;
+		return default_value;
 
 	return atoi(val) != 0;
 }
@@ -705,7 +705,7 @@ bool drmtest_run_in_simulation(void)
 	static int simulation = -1;
 
 	if (simulation == -1)
-		simulation = env_set("INTEL_SIMULATION");
+		simulation = env_set("INTEL_SIMULATION", false);
 
 	return simulation;
 }
Signature · 1 line
1.8.3.1
#6 lore raw

PATCH 6/8 tests: Allow a shell test to declare it doesn't need to be DRM master

In reply to Damien Lespiau
---
 tests/drm_lib.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tests/drm_lib.sh +2 -1
index 2532352..25197d4 100755
@@ -26,7 +26,8 @@ fi
 
 # read everything we can
 if [ `cat $i915_dfs_path/clients | wc -l` -gt "2" ] ; then
-	die "ERROR: other drm clients running"
+	[ -n "$DRM_LIB_ALLOW_NO_MASTER" ] || \
+		die "ERROR: other drm clients running"
 fi
 
 i915_sfs_path=
Signature · 1 line
1.8.3.1
#7 lore raw

PATCH 7/8 tests: Source drm_lib.sh instead of having its own INTEL_SIMULATION test

In reply to Damien Lespiau

One code path to maintain is always better.

---
 tests/sysfs_edid_timing | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
tests/sysfs_edid_timing +4 -1
index 2a43cca..e90e374 100755
@@ -5,7 +5,10 @@
 # we sometimes take a *really* long time. So let's just check for some reasonable timing here
 #
 
-[ -n "$INTEL_SIMULATION" ] && exit 77
+DRM_LIB_ALLOW_NO_MASTER=1
+
+SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
+. $SOURCE_DIR/drm_lib.sh
 
 TIME1=$(date +%s%N)
 cat $(find /sys/devices/|grep drm | grep /status) > /dev/null
Signature · 1 line
1.8.3.1
#8 lore raw

PATCH 8/8 build: Provide an --enable-simulation configure option

In reply to Damien Lespiau

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.

---
 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%)
configure.ac +11 -0
index 1626ce8..0bf4764 100644
@@ -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}"
lib/drmtest.c +12 -2
index 26748b3..17e48b0 100644
@@ -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;
 }
tests/.gitignore +1 -0
index d256695..6131c78 100644
@@ -1,4 +1,5 @@
 ddi_compute_wrpll
+drm_lib.sh
 drm_vma_limiter
 drm_vma_limiter_cached
 drm_vma_limiter_cpu
tests/drm_lib.sh.in renamed from tests/drm_lib.sh +2 -1
similarity index 88%
rename from tests/drm_lib.sh
rename to tests/drm_lib.sh.in
index 25197d4..9e482ea 100755
@@ -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
Signature · 1 line
1.8.3.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#9 lore raw

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

Quoted 5 lines · Damien Lespiau

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.

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

Quoted 118 lines
---
 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%)
configure.ac +11 -0
index 1626ce8..0bf4764 100644
@@ -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}"
lib/drmtest.c +12 -2
index 26748b3..17e48b0 100644
@@ -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;
 }
tests/.gitignore +1 -0
index d256695..6131c78 100644
@@ -1,4 +1,5 @@
 ddi_compute_wrpll
+drm_lib.sh
 drm_vma_limiter
 drm_vma_limiter_cached
 drm_vma_limiter_cpu
tests/drm_lib.sh.in renamed from tests/drm_lib.sh +2 -1
similarity index 88%
rename from tests/drm_lib.sh
rename to tests/drm_lib.sh.in
index 25197d4..9e482ea 100755
@@ -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
Signature · 7 lines
1.8.3.1


_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#10 lore raw

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

Quoted 10 lines · Daniel Vetter
Quoted 5 lines · Damien Lespiau

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.

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.

I like this better as well. I pushed up to patch 7/8. I'll come back for more.

Signature · 1 line
Damien