[Piglit] [PATCH 2/3] gl-1.0-blend-func: add --quick option

Brian Paul brianp at vmware.com
Wed Jan 17 22:54:52 UTC 2018


The test normally runs about 27,000 tests and takes quite a long time
with some drivers. With the --quick option, only 1% of the tests are run.

And update tests/quick.py to run the test with --quick.
---
 tests/quick.py            |  7 +++++++
 tests/spec/gl-1.0/blend.c | 23 ++++++++++++++++++-----
 2 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/tests/quick.py b/tests/quick.py
index 53774e4..73c4678 100644
--- a/tests/quick.py
+++ b/tests/quick.py
@@ -68,6 +68,13 @@ with profile.test_list.group_manager(
     with profile.test_list.allow_reassignment:
         g(['ext_texture_env_combine-combine', '--quick'], 'texture-env-combine')
 
+# Set the --quick flag on the gl-1.0 blending test
+with profile.test_list.group_manager(
+        PiglitGLTest,
+        grouptools.join('spec', '!opengl 1.0')) as g:
+    with profile.test_list.allow_reassignment:
+        g(['gl-1.0-blend-func', '--quick'], 'gl-1.0-blend-func')
+
 # Limit texture size to 512x512 for some texture_multisample tests.
 # The default (max supported size) can be pretty slow.
 with profile.test_list.group_manager(
diff --git a/tests/spec/gl-1.0/blend.c b/tests/spec/gl-1.0/blend.c
index 769339f..192b271 100644
--- a/tests/spec/gl-1.0/blend.c
+++ b/tests/spec/gl-1.0/blend.c
@@ -64,6 +64,8 @@
 
 #define HUGE_STEP 1000
 
+static int test_stride = 1;
+
 /*
  * We will check each pair of blend factors
  * for each pixel in a square image of this
@@ -187,6 +189,13 @@ piglit_init(int argc, char **argv)
 	const char* blend_rgb_tol = getenv("PIGLIT_BLEND_RGB_TOLERANCE");
 	const char* blend_alpha_tol = getenv("PIGLIT_BLEND_ALPHA_TOLERANCE");
 
+	if (argc > 1 && strcmp(argv[1], "--quick") == 0) {
+		/* By default we run 27552 tests which is time consuming.
+		 * With --quick we run only 1% of the tests.
+		 */
+		test_stride = 100;
+	}
+
 	/* 
 	 * Hack: Make driver tests on incorrect hardware feasible
 	 * We want to be able to perform meaningful tests
@@ -687,6 +696,7 @@ run_all_factor_sets(void)
 	bool pass = true;
 	int gl_version = piglit_get_gl_version();
 	int counter = 0; /* Number of tests we have done. */
+	int test_number = 0;
 	int step;
 	int op, opa;
 	int sf, sfa, df, dfa;
@@ -784,11 +794,14 @@ run_all_factor_sets(void)
 						for (dfa = 0; dfa < 
 						     num_dst_factors_sep;
 						     dfa += step) {
-							pass &= proc_factors(
-								sf, sfa, 
-								df, dfa,
-								op, opa);
-							counter++;
+							if (test_number % test_stride == 0) {
+								pass &= proc_factors(
+									sf, sfa, 
+									df, dfa,
+									op, opa);
+								counter++;
+							}
+							test_number++;
 						}
 					}
 				}
-- 
2.7.4



More information about the Piglit mailing list