[Intel-gfx] [PATCH i-g-t 2/2] lib/os: Push simulation test down into intel_require_memory

Daniel Vetter daniel.vetter at ffwll.ch
Mon Nov 17 15:18:58 CET 2014


This has the upside that we'll never forget to add it to thrashing
tests. But we'll also never miss to move it when adding basic
functionality tests to existing binaries. Chris already started this
refining work in e.g.

commit d77eda6614a1955717f224be023dedf74eb7735d
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Nov 14 07:45:40 2014 +0000

    igt/gem_linear_blits: Require that we do the full test

by moving igt_skip_on_simulation into subtests.

Cc: Chris Wilson <chris at chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
---
 lib/intel_os.c               | 7 ++++++-
 tests/gem_evict_alignment.c  | 2 --
 tests/gem_evict_everything.c | 2 --
 tests/gem_linear_blits.c     | 4 ----
 tests/gem_tiled_blits.c      | 4 ----
 tests/gem_tiled_swapping.c   | 1 -
 tests/gem_userptr_blits.c    | 2 --
 7 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/lib/intel_os.c b/lib/intel_os.c
index c1b88bccfef5..db7889b44674 100644
--- a/lib/intel_os.c
+++ b/lib/intel_os.c
@@ -210,7 +210,10 @@ intel_get_total_swap_mb(void)
  * there is not enough RAM + SWAP!
  *
  * If there is not enough RAM this function calls igt_skip with an appropriate
- * message. It only ever returns if the requirement is fullfilled.
+ * message. It only ever returns if the requirement is fullfilled. This function
+ * also causes the test to be skipped automatically on simulation under the
+ * assumption that any test that needs to check for memory requirements is a
+ * thrashing test unsuitable for slow simulated systems.
  */
 void intel_require_memory(uint32_t count, uint32_t size, unsigned mode)
 {
@@ -239,6 +242,8 @@ void intel_require_memory(uint32_t count, uint32_t size, unsigned mode)
 		      (long long)required, (long long)total,
 		      mode & (CHECK_RAM | CHECK_SWAP) ? "RAM" : "",
 		      mode & CHECK_SWAP ? " + swap": "");
+
+	igt_skip_on_simulation();
 }
 
 void
diff --git a/tests/gem_evict_alignment.c b/tests/gem_evict_alignment.c
index e2d42a04058d..86676b05e317 100644
--- a/tests/gem_evict_alignment.c
+++ b/tests/gem_evict_alignment.c
@@ -191,8 +191,6 @@ igt_main
 {
 	int size, count;
 
-	igt_skip_on_simulation();
-
 	igt_fixture {
 		fd = drm_open_any();
 	}
diff --git a/tests/gem_evict_everything.c b/tests/gem_evict_everything.c
index 4b7768c1f948..fae89032fcb5 100644
--- a/tests/gem_evict_everything.c
+++ b/tests/gem_evict_everything.c
@@ -182,8 +182,6 @@ igt_main
 	size = count = 0;
 	fd = -1;
 
-	igt_skip_on_simulation();
-
 	igt_fixture {
 		fd = drm_open_any();
 
diff --git a/tests/gem_linear_blits.c b/tests/gem_linear_blits.c
index 78c539ae8346..cbd115678093 100644
--- a/tests/gem_linear_blits.c
+++ b/tests/gem_linear_blits.c
@@ -264,8 +264,6 @@ int main(int argc, char **argv)
 	igt_subtest("normal") {
 		int count;
 
-		igt_skip_on_simulation();
-
 		count = 3 * gem_aperture_size(fd) / (1024*1024) / 2;
 		igt_require(count > 1);
 		intel_require_memory(count, sizeof(linear), CHECK_RAM);
@@ -275,8 +273,6 @@ int main(int argc, char **argv)
 	igt_subtest("interruptible") {
 		int count;
 
-		igt_skip_on_simulation();
-
 		count = 3 * gem_aperture_size(fd) / (1024*1024) / 2;
 		igt_require(count > 1);
 		intel_require_memory(count, sizeof(linear), CHECK_RAM);
diff --git a/tests/gem_tiled_blits.c b/tests/gem_tiled_blits.c
index 76d256f4d8d8..0f883286e3a9 100644
--- a/tests/gem_tiled_blits.c
+++ b/tests/gem_tiled_blits.c
@@ -214,8 +214,6 @@ int main(int argc, char **argv)
 	igt_subtest("normal") {
 		int count;
 
-		igt_skip_on_simulation();
-
 		count = 3 * gem_aperture_size(fd) / (1024*1024) / 2;
 		count += (count & 1) == 0;
 		intel_require_memory(count, 1024*1024, CHECK_RAM);
@@ -226,8 +224,6 @@ int main(int argc, char **argv)
 	igt_subtest("interruptible") {
 		int count;
 
-		igt_skip_on_simulation();
-
 		count = 3 * gem_aperture_size(fd) / (1024*1024) / 2;
 		count += (count & 1) == 0;
 		intel_require_memory(count, 1024*1024, CHECK_RAM);
diff --git a/tests/gem_tiled_swapping.c b/tests/gem_tiled_swapping.c
index 4520d4734c03..69d1cfae94d2 100644
--- a/tests/gem_tiled_swapping.c
+++ b/tests/gem_tiled_swapping.c
@@ -150,7 +150,6 @@ igt_simple_main
 
 	current_tiling_mode = I915_TILING_X;
 
-	igt_skip_on_simulation();
 	intel_purge_vm_caches();
 
 	fd = drm_open_any();
diff --git a/tests/gem_userptr_blits.c b/tests/gem_userptr_blits.c
index 886a62993a89..d641c12046e7 100644
--- a/tests/gem_userptr_blits.c
+++ b/tests/gem_userptr_blits.c
@@ -1240,8 +1240,6 @@ int main(int argc, char **argv)
 {
 	int size = sizeof(linear);
 
-	igt_skip_on_simulation();
-
 	igt_subtest_init(argc, argv);
 
 	igt_fixture {
-- 
2.1.1




More information about the Intel-gfx mailing list