[Piglit] [PATCH 2/2] util: Create core profiles with GLUT when supported by freeglut.
From: José Fonseca jfons...@vmware.com Handy until we have waffle everywhere. --- .../piglit-framework-gl/piglit_glut_framework.c| 30 +++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/tests/util/piglit-framework-gl/piglit_glut_framework.c b/tests/util/piglit-framework-gl/piglit_glut_framework.c index 716f314..b48fa58 100644 --- a/tests/util/piglit-framework-gl/piglit_glut_framework.c +++ b/tests/util/piglit-framework-gl/piglit_glut_framework.c @@ -119,6 +119,18 @@ init_glut(void) glutInitWindowSize(test_config-window_width, test_config-window_height); glutInitDisplayMode(flags); + +#ifdef GLUT_CORE_PROFILE + if (test_config-supports_gl_core_version) { + glutInitContextVersion(test_config-supports_gl_core_version / 10, + test_config-supports_gl_core_version % 10); + glutInitContextFlags(GLUT_CORE_PROFILE); + } else { + glutInitContextVersion(test_config-supports_gl_compat_version / 10, + test_config-supports_gl_compat_version % 10); + } +#endif + glut_fw.window = glutCreateWindow(Piglit); glutDisplayFunc(display); @@ -178,9 +190,19 @@ check_gl_version(const struct piglit_gl_test_config *test_config) { int actual_version = piglit_get_gl_version(); - /* GLUT only supports GL compatibility contexts, so we only -* have to check supports_gl_compat_version. -*/ + if (test_config-supports_gl_core_version) { + if (actual_version test_config-supports_gl_core_version) { + printf(Test requires GL version %d.%d, but actual version is + %d.%d\n, + test_config-supports_gl_core_version / 10, + test_config-supports_gl_core_version % 10, + actual_version / 10, + actual_version % 10); + return false; + } + return true; + } + if (actual_version test_config-supports_gl_compat_version) { printf(Test requires GL version %d.%d, but actual version is %d.%d\n, @@ -199,11 +221,13 @@ piglit_glut_framework_create(const struct piglit_gl_test_config *test_config) { bool ok = true; +#ifndef GLUT_CORE_PROFILE if (!test_config-supports_gl_compat_version) { printf(GLUT can create only GL compatibility contexts, which the test does not support running under.\n); piglit_report_result(PIGLIT_SKIP); } +#endif if (test_config-window_samples 1) { printf(GLUT doesn't support MSAA visuals.\n); -- 1.8.3.2 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] FW: [PATCH] fixed oes compressed etc2 texture miptree failure
See tests/util/piglit-framework-gl/piglit_glut_framework.c:84: default_reshape_func(int w, int h) { if (piglit_automatic (w != piglit_width || h != piglit_height)) { printf(Got spurious window resize in automatic run (%d,%d to %d,%d)\n, piglit_width, piglit_height, w, h); piglit_report_result(PIGLIT_WARN); } piglit_width = w; piglit_height = h; glViewport(0, 0, w, h); } My OS is win8. If piglit_width 160, window manager will force it to 160. Many piglit tests have set configure width as 150, then they will all report as warn. At least the following, $ grep -Irne \150\ tests | grep width tests/fbo/fbo-blit-d24s8.c:45: config.window_width = 150; tests/fbo/fbo-blit.c:43:config.window_width = 150; tests/fbo/fbo-copypix.c:40: config.window_width = 150; tests/fbo/fbo-readdrawpix.c:40: config.window_width = 150; tests/spec/arb_es2_compatibility/arb_es2_compatibility-depthrangef.c:36: config.window_width = 150; tests/texturing/incomplete-texture.c:38:config.window_width = 150; tests/texturing/shaders/textureSize.c:55: config.window_width = 150; tests/texturing/texsubimage.c:42: config.window_width = 150; tests/util/piglit-framework-gl.h:272:config.window_width = 150; What is more, glViewport(0, 0, w, h) will change the viewport to (w,h), so in each glut display() function, glViewPort() should be recalled for validity. -Original Message- From: Anuj Phogat [mailto:anuj.pho...@gmail.com] Sent: 2014年4月24日 7:54 To: Guo, Johney Cc: Ian Romanick; piglit@lists.freedesktop.org Subject: Re: [Piglit] FW: [PATCH] fixed oes compressed etc2 texture miptree failure On Tue, Apr 22, 2014 at 7:41 PM, Guo, Johney weijun@amd.com wrote: - glut config.window_width should be 160 so as to avoid warning message. What warning are you seeing for width 160? Add the details to commit message. - fopen ktx texture file should be binary mode - viewport need be reset in each display, since it has changed in glut reshape() function This test doesn't use glut reshape() function. I think viewport stays unchanged in piglit_display() function. Signed-off-by: weijun weijun@amd.com --- tests/spec/gles-3.0/oes_compressed_etc2_texture-miptree.c | 3 ++- tests/util/piglit_ktx.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/spec/gles-3.0/oes_compressed_etc2_texture-miptree.c b/tests/spec/gles-3.0/oes_compressed_etc2_texture-miptree.c index 59d8748..eeda3cb 100644 --- a/tests/spec/gles-3.0/oes_compressed_etc2_texture-miptree.c +++ b/tests/spec/gles-3.0/oes_compressed_etc2_texture-miptree.c @@ -289,6 +289,7 @@ piglit_display(void) bool pass = true; glClear(GL_COLOR_BUFFER_BIT); + glViewport(0, 0, window_width, window_height); for (level = 0; level num_levels; ++level) { glUniform2f(level_pixel_size_loc, (float) level_width, @@ -339,7 +340,7 @@ PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_es_version = 30; - config.window_width = 150; + config.window_width = 160; config.window_height = 150; config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA; PIGLIT_GL_TEST_CONFIG_END diff --git a/tests/util/piglit_ktx.c b/tests/util/piglit_ktx.c index b60f737..d844540 100644 --- a/tests/util/piglit_ktx.c +++ b/tests/util/piglit_ktx.c @@ -436,7 +436,7 @@ piglit_ktx_read_file(const char *filename) if (self == NULL) goto out_of_memory; - file = fopen(filename, r); + file = fopen(filename, rb); if (file == NULL) goto bad_open; @@ -521,7 +521,7 @@ piglit_ktx_write_file(struct piglit_ktx *self, const char *filename) size_t size_written = 0; bool ok = true; - file = fopen(filename, w); + file = fopen(filename, wb); if (file == NULL) goto bad_open; -- 1.8.4.msysgit.0 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH 1/2] framework: add support for a timeout status
On 23 April 2014 19:29, Ilia Mirkin imir...@alum.mit.edu wrote: On Wed, Apr 23, 2014 at 2:25 PM, Daniel Vetter dan...@ffwll.ch wrote: On Wed, Apr 23, 2014 at 12:46:23PM -0400, Ilia Mirkin wrote: So this means that going from Skip (or NotRun) to Timeout would not be counted as a change (regression/etc) by summary. Is that intentional? Futhermore, I'm not 100% sure, but I think going from Pass - Timeout might get considered to be a fix (and Timeout - Pass a regression). Pass-Timeout usually means the kernel deadlocked, so imo should be a regression. Might be another case where we want to treat result order differently ... I was pointing out how the code was going to work as written (and implicitly that I thought that was wrong, perhaps I could have been clearer). -Daniel I'd like to encourage you to add a few cases to summary_test.py which would either prove me wrong, or point out potential issues, and at least provide a place where you can encode your desired behaviour (about which we can then argue whether it's correct or not :) ) Having looked again at how NoChangeStatus works, it is probably not the correct class for timeout and instead it should use a normal Status class. If placed just above the crash status this would mean most status changes to timeout would be a regression. Lastly, you need to add TIMEOUT to ALL = ... at the very end of framework/status.py On Wed, Apr 23, 2014 at 12:29 PM, Thomas Wood thomas.w...@intel.com wrote: v2: use NoChangeStatus for the timeout class Signed-off-by: Thomas Wood thomas.w...@intel.com Cc: Daniel Vetter daniel.vet...@ffwll.ch --- framework/log.py| 3 ++- framework/status.py | 7 +-- framework/summary.py| 6 -- framework/tests/status_tests.py | 6 +++--- templates/index.css | 5 - 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/framework/log.py b/framework/log.py index d045847..e5154aa 100644 --- a/framework/log.py +++ b/framework/log.py @@ -39,7 +39,8 @@ class Log(object): self.__generator = (x for x in xrange(self.__total)) self.__pad = len(str(self.__total)) self.__summary_keys = set(['pass', 'fail', 'warn', 'crash', 'skip', - 'dmesg-warn', 'dmesg-fail', 'dry-run']) + 'dmesg-warn', 'dmesg-fail', 'dry-run', + 'timeout']) self.__summary = collections.defaultdict(lambda: 0) self.__lastlength = 0 diff --git a/framework/status.py b/framework/status.py index aa42487..7e16a2b 100644 --- a/framework/status.py +++ b/framework/status.py @@ -41,7 +41,6 @@ warn dmesg-fail fail crash -timeout SKIP and NOTRUN are not factored into regressions and fixes, they are counted seperately. They also derive from a sublcass of Status, which always returns @@ -63,6 +62,7 @@ __all__ = ['NOTRUN', 'DMESG_WARN', 'DMESG_FAIL', 'SKIP', + 'TIMEOUT', 'ALL'] @@ -81,7 +81,8 @@ def status_lookup(status): 'crash': CRASH, 'dmesg-warn': DMESG_WARN, 'dmesg-fail': DMESG_FAIL, - 'notrun': NOTRUN} + 'notrun': NOTRUN, + 'timeout': TIMEOUT} try: return status_dict[status] @@ -211,6 +212,8 @@ class NoChangeStatus(Status): NOTRUN = NoChangeStatus('Not Run') +TIMEOUT = NoChangeStatus('timeout') + SKIP = NoChangeStatus('skip') PASS = Status('pass', 0, (1, 1)) diff --git a/framework/summary.py b/framework/summary.py index 47138bf..9228330 100644 --- a/framework/summary.py +++ b/framework/summary.py @@ -342,8 +342,9 @@ class Summary: Private: Find the total number of pass, fail, crash, skip, and warn in the *last* set of results stored in self.results. -self.totals = {'pass': 0, 'fail': 0, 'crash': 0, 'skip': 0, 'warn': 0, - 'dmesg-warn': 0, 'dmesg-fail': 0} +self.totals = {'pass': 0, 'fail': 0, 'crash': 0, 'skip': 0, + 'timeout': 0, 'warn': 0, 'dmesg-warn': 0, + 'dmesg-fail': 0} for test in self.results[-1].tests.itervalues(): self.totals[str(test['result'])] += 1 @@ -472,6 +473,7 @@ class Summary: fail: {fail}\n crash: {crash}\n skip: {skip}\n + timeout: {timeout}\n warn: {warn}\n dmesg-warn: {dmesg-warn}\n dmesg-fail: {dmesg-fail}.format(**self.totals)) diff --git a/framework/tests/status_tests.py b/framework/tests/status_tests.py index c1d8c86..7b1b30a 100644 --- a/framework/tests/status_tests.py
Re: [Piglit] [PATCH 2/2] util: Create core profiles with GLUT when supported by freeglut.
Both patches look OK to me. Reviewed-by: Brian Paul bri...@vmware.com On 04/24/2014 03:03 AM, jfons...@vmware.com wrote: From: José Fonseca jfons...@vmware.com Handy until we have waffle everywhere. --- .../piglit-framework-gl/piglit_glut_framework.c| 30 +++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/tests/util/piglit-framework-gl/piglit_glut_framework.c b/tests/util/piglit-framework-gl/piglit_glut_framework.c index 716f314..b48fa58 100644 --- a/tests/util/piglit-framework-gl/piglit_glut_framework.c +++ b/tests/util/piglit-framework-gl/piglit_glut_framework.c @@ -119,6 +119,18 @@ init_glut(void) glutInitWindowSize(test_config-window_width, test_config-window_height); glutInitDisplayMode(flags); + +#ifdef GLUT_CORE_PROFILE + if (test_config-supports_gl_core_version) { + glutInitContextVersion(test_config-supports_gl_core_version / 10, + test_config-supports_gl_core_version % 10); + glutInitContextFlags(GLUT_CORE_PROFILE); + } else { + glutInitContextVersion(test_config-supports_gl_compat_version / 10, + test_config-supports_gl_compat_version % 10); + } +#endif + glut_fw.window = glutCreateWindow(Piglit); glutDisplayFunc(display); @@ -178,9 +190,19 @@ check_gl_version(const struct piglit_gl_test_config *test_config) { int actual_version = piglit_get_gl_version(); - /* GLUT only supports GL compatibility contexts, so we only -* have to check supports_gl_compat_version. -*/ + if (test_config-supports_gl_core_version) { + if (actual_version test_config-supports_gl_core_version) { + printf(Test requires GL version %d.%d, but actual version is + %d.%d\n, + test_config-supports_gl_core_version / 10, + test_config-supports_gl_core_version % 10, + actual_version / 10, + actual_version % 10); + return false; + } + return true; + } + if (actual_version test_config-supports_gl_compat_version) { printf(Test requires GL version %d.%d, but actual version is %d.%d\n, @@ -199,11 +221,13 @@ piglit_glut_framework_create(const struct piglit_gl_test_config *test_config) { bool ok = true; +#ifndef GLUT_CORE_PROFILE if (!test_config-supports_gl_compat_version) { printf(GLUT can create only GL compatibility contexts, which the test does not support running under.\n); piglit_report_result(PIGLIT_SKIP); } +#endif if (test_config-window_samples 1) { printf(GLUT doesn't support MSAA visuals.\n); ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] framework: add support for a timeout status
Signed-off-by: Thomas Wood thomas.w...@intel.com Cc: Daniel Vetter daniel.vet...@ffwll.ch --- framework/log.py | 3 ++- framework/status.py | 12 framework/summary.py | 6 -- framework/tests/status_tests.py | 3 ++- framework/tests/summary_tests.py | 5 - templates/index.css | 5 - 6 files changed, 24 insertions(+), 10 deletions(-) diff --git a/framework/log.py b/framework/log.py index d045847..e5154aa 100644 --- a/framework/log.py +++ b/framework/log.py @@ -39,7 +39,8 @@ class Log(object): self.__generator = (x for x in xrange(self.__total)) self.__pad = len(str(self.__total)) self.__summary_keys = set(['pass', 'fail', 'warn', 'crash', 'skip', - 'dmesg-warn', 'dmesg-fail', 'dry-run']) + 'dmesg-warn', 'dmesg-fail', 'dry-run', + 'timeout']) self.__summary = collections.defaultdict(lambda: 0) self.__lastlength = 0 diff --git a/framework/status.py b/framework/status.py index aa42487..8ab72f7 100644 --- a/framework/status.py +++ b/framework/status.py @@ -40,8 +40,8 @@ dmesg-warn warn dmesg-fail fail -crash timeout +crash SKIP and NOTRUN are not factored into regressions and fixes, they are counted seperately. They also derive from a sublcass of Status, which always returns @@ -63,6 +63,7 @@ __all__ = ['NOTRUN', 'DMESG_WARN', 'DMESG_FAIL', 'SKIP', + 'TIMEOUT', 'ALL'] @@ -81,7 +82,8 @@ def status_lookup(status): 'crash': CRASH, 'dmesg-warn': DMESG_WARN, 'dmesg-fail': DMESG_FAIL, - 'notrun': NOTRUN} + 'notrun': NOTRUN, + 'timeout': TIMEOUT} try: return status_dict[status] @@ -223,7 +225,9 @@ FAIL = Status('fail', 30) DMESG_FAIL = Status('dmesg-fail', 40) -CRASH = Status('crash', 50) +TIMEOUT = Status('timeout', 50) + +CRASH = Status('crash', 60) # A tuple (ordered, immutable) of all statuses in this module -ALL = (PASS, WARN, DMESG_WARN, FAIL, DMESG_FAIL, CRASH, SKIP, NOTRUN) +ALL = (PASS, WARN, DMESG_WARN, FAIL, DMESG_FAIL, TIMEOUT, CRASH, SKIP, NOTRUN) diff --git a/framework/summary.py b/framework/summary.py index 47138bf..9228330 100644 --- a/framework/summary.py +++ b/framework/summary.py @@ -342,8 +342,9 @@ class Summary: Private: Find the total number of pass, fail, crash, skip, and warn in the *last* set of results stored in self.results. -self.totals = {'pass': 0, 'fail': 0, 'crash': 0, 'skip': 0, 'warn': 0, - 'dmesg-warn': 0, 'dmesg-fail': 0} +self.totals = {'pass': 0, 'fail': 0, 'crash': 0, 'skip': 0, + 'timeout': 0, 'warn': 0, 'dmesg-warn': 0, + 'dmesg-fail': 0} for test in self.results[-1].tests.itervalues(): self.totals[str(test['result'])] += 1 @@ -472,6 +473,7 @@ class Summary: fail: {fail}\n crash: {crash}\n skip: {skip}\n + timeout: {timeout}\n warn: {warn}\n dmesg-warn: {dmesg-warn}\n dmesg-fail: {dmesg-fail}.format(**self.totals)) diff --git a/framework/tests/status_tests.py b/framework/tests/status_tests.py index c1d8c86..599225f 100644 --- a/framework/tests/status_tests.py +++ b/framework/tests/status_tests.py @@ -31,7 +31,8 @@ import framework.status as status # Statuses from worst to last. NotRun is intentionally not in this list and # tested separately because of upcoming features for it -STATUSES = [pass, warn, dmesg-warn, fail, dmesg-fail, crash] +STATUSES = [pass, warn, dmesg-warn, fail, dmesg-fail, timeout, +crash] # all statuses except pass are problems PROBLEMS = STATUSES[1:] diff --git a/framework/tests/summary_tests.py b/framework/tests/summary_tests.py index 1ad51b5..a573e39 100644 --- a/framework/tests/summary_tests.py +++ b/framework/tests/summary_tests.py @@ -51,7 +51,10 @@ def test_summary_add_to_set(): ('skip', 'skip', 'skipped'), ('notrun', 'fail', 'problems'), ('fail', 'notrun', 'problems'), - ('pass', 'fail', 'problems')]: + ('pass', 'fail', 'problems'), + ('timeout', 'pass', 'fixes'), + ('pass', 'timeout', 'regressions'), + ('pass', 'timeout', 'problems')]: check_sets.description = {0} - {1} should be added to {2}.format( ostat, nstat, set_) diff --git a/templates/index.css b/templates/index.css index 577370c..3389738 100644 --- a/templates/index.css +++ b/templates/index.css @@
Re: [Piglit] [PATCH 1/2] framework: add support for a timeout status
The following revised patch reverts to using a normal Status class for the timeout status and also adds a few tests to summary_tests.py, as suggested by Ilia Mirkin. Thomas Wood (1): framework: add support for a timeout status framework/log.py | 3 ++- framework/status.py | 12 framework/summary.py | 6 -- framework/tests/status_tests.py | 3 ++- framework/tests/summary_tests.py | 5 - templates/index.css | 5 - 6 files changed, 24 insertions(+), 10 deletions(-) -- 1.9.0 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH 2/2] EGL_CHROMIUM_get_sync_values: Add conformance test.
On Apr 23, 2014 1:36 PM, Chad Versace chad.vers...@linux.intel.com wrote: On Tue, Apr 22, 2014 at 12:22:12PM -0700, Sarah Sharp wrote: On Fri, Apr 18, 2014 at 06:21:31PM -0700, Jamey Sharp wrote: - I don't see that MSC has to change at all even after two eglSwapBuffers calls, if SwapBuffers doesn't sync to vertical retrace. I looked at the EGL 1.5 spec with Chad, and if you look at the definition of eglSwapInterval, you'll see that the minimum number of video frame periods per buffer swap is set to 1 by default. I think one frame period is the time between vertical retraces, but the spec isn't clear on that. The spec is sadly ambiguous on that. It's also ambiguous on whether eglSwapBuffers blocks or immediately returns false if too many outstanding swaps are pending. I think it's safe to assume that it blocks. because that's what all EGL implementations do that I've used: X11, Android, Wayland, and (vacuously) GBM. (More below on why this it's vacuously true that GBM implements the blocking behavior). I'd just feel more comfortable, in a conformance test, if there were specification text you could point to instead of a de facto standard. I note you only mention Linux based GL implementations, after all. Any day one can use a word like vacuously is a good day, though. As for eglSwapBuffers being synchronized to vertical retraces, again it is on all platforms I've used. Modulo bugs, presumably, since it certainly isn't reliably synchronized in X right now. :-) But I agree that it's intended to be, especially considering: Like Sarah said. If you set env vars that provide nonconformant behavior, then your conformance testsuite may fail. It wasn't obvious to me that that was non-conforming behavior. However, Theo has since pointed out this sentence in the OML_sync_control spec: If there are multiple outstanding swaps for the same window, at most one such swap can be satisfied per increment of MSC. So I retract my first concern. :-) (Technically this doesn't say the swap has to happen during vertical retrace, but for the purposes of Sarah's tests that doesn't matter.) I played with that test app on X11, Wayland, and GBM to discover exactly how the swap interval behaves on each platform. Wayland was the weirdest. Out of curiosity, how was Wayland weird? I think the test should do this: Create the EGLConfig as it currently does. That is, do not specify EGL_[MIN|MAX]_SWAP_INTERVAL. Then immediately query eglGetConfigAttrib(EGL_MIN_SWAP_INTERVAL) and eglGetConfigAttrib(EGL_MAX_SWAP_INTERVAL). If the max swap interval is 0, then eglSwapBuffers will not block. So report PIGLIT_RESULT_SKIP. Else, the EGL spec ensures that the surface's swap interval is EGL_MIN_SWAP_INTERVAL. Calculate the expected MSC and SBC from that. For bonus points, let the desired swap_interval be an input parameter to the test. The test will skip if and only if requested_swap_interval is outside of [EGL_MIN_SWAP_INTERVAL, EGL_MAX_SWAP_INTERVAL]. The test sets the surface's swap interval with eglSwapInterval(requested_swap_interval), calculates expected values of of MSC and SBC, and tests for them. Why is GBM a special case? Because EGLConfigs on GBM have EGL_MIN_SWAP_INTERVAL == EGL_MAX_SWAP_INTERVAL == 0. So eglSwapBuffers never throttles. This strikes me as a very satisfying way to handle it, my lingering concerns about unspecified throttling/blocking behavior notwithstanding. Ooh, and does Mesa set EGL_MAX_SWAP_INTERVAL == 0 if vblank_mode is 0? Jamey ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [Patch v2] profile: Fix mixed concurrency runs
Currently we call join after initializing both of the pools, which means that they run simultaneously. This patch fixes that by creating a helper function which sets off the pool, closes it, and then joins it. This fixes the problem by forcing each pool to run in series. v2: - Fix typo that put all tests in a multithreaded pool - split lines differently for improved readability Signed-off-by: Dylan Baker baker.dyla...@gmail.com --- framework/profile.py | 29 ++--- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/framework/profile.py b/framework/profile.py index 2e160e3..10b062b 100644 --- a/framework/profile.py +++ b/framework/profile.py @@ -116,6 +116,8 @@ class TestProfile(object): framework.exectest.Test.ENV = env +chunksize = 1 + self.prepare_test_list(env) log = Log(len(self.test_list), env.verbose) @@ -128,33 +130,30 @@ class TestProfile(object): name, test = pair test.execute(name, log, json_writer, self.dmesg) +def run_threads(pool, testlist): + Open a pool, close it, and join it +pool.imap(test, testlist, chunksize) +pool.close() +pool.join() + # Multiprocessing.dummy is a wrapper around Threading that provides a # multiprocessing compatible API # # The default value of pool is the number of virtual processor cores single = multiprocessing.dummy.Pool(1) multi = multiprocessing.dummy.Pool() -chunksize = 1 if env.concurrent == all: -multi.imap(test, self.test_list.iteritems(), chunksize) +run_threads(multi, self.test_list.iteritems()) elif env.concurrent == none: -single.imap(test, self.test_list.iteritems(), chunksize) +run_threads(single, self.test_list.iteritems()) else: # Filter and return only thread safe tests to the threaded pool -multi.imap(test, (x for x in self.test_list.iteritems() if - x[1].run_concurrent), chunksize) +run_threads(multi, (x for x in self.test_list.iteritems() +if x[1].run_concurrent)) # Filter and return the non thread safe tests to the single pool -single.imap(test, (x for x in self.test_list.iteritems() if not - x[1].run_concurrent), chunksize) - -# Close and join the pools -# If we don't close and the join the pools the script will exit before -# the pools finish running -multi.close() -single.close() -multi.join() -single.join() +run_threads(single, (x for x in self.test_list.iteritems() + if not x[1].run_concurrent)) log.summary() -- 1.9.2 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [Patch v2] profile: Fix mixed concurrency runs
On Thu, Apr 24, 2014 at 1:10 PM, Dylan Baker baker.dyla...@gmail.com wrote: Currently we call join after initializing both of the pools, which means that they run simultaneously. This patch fixes that by creating a helper function which sets off the pool, closes it, and then joins it. This fixes the problem by forcing each pool to run in series. v2: - Fix typo that put all tests in a multithreaded pool - split lines differently for improved readability Signed-off-by: Dylan Baker baker.dyla...@gmail.com Reviewed-by: Ilia Mirkin imir...@alum.mit.edu --- framework/profile.py | 29 ++--- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/framework/profile.py b/framework/profile.py index 2e160e3..10b062b 100644 --- a/framework/profile.py +++ b/framework/profile.py @@ -116,6 +116,8 @@ class TestProfile(object): framework.exectest.Test.ENV = env +chunksize = 1 + self.prepare_test_list(env) log = Log(len(self.test_list), env.verbose) @@ -128,33 +130,30 @@ class TestProfile(object): name, test = pair test.execute(name, log, json_writer, self.dmesg) +def run_threads(pool, testlist): + Open a pool, close it, and join it +pool.imap(test, testlist, chunksize) +pool.close() +pool.join() + # Multiprocessing.dummy is a wrapper around Threading that provides a # multiprocessing compatible API # # The default value of pool is the number of virtual processor cores single = multiprocessing.dummy.Pool(1) multi = multiprocessing.dummy.Pool() -chunksize = 1 if env.concurrent == all: -multi.imap(test, self.test_list.iteritems(), chunksize) +run_threads(multi, self.test_list.iteritems()) elif env.concurrent == none: -single.imap(test, self.test_list.iteritems(), chunksize) +run_threads(single, self.test_list.iteritems()) else: # Filter and return only thread safe tests to the threaded pool -multi.imap(test, (x for x in self.test_list.iteritems() if - x[1].run_concurrent), chunksize) +run_threads(multi, (x for x in self.test_list.iteritems() +if x[1].run_concurrent)) # Filter and return the non thread safe tests to the single pool -single.imap(test, (x for x in self.test_list.iteritems() if not - x[1].run_concurrent), chunksize) - -# Close and join the pools -# If we don't close and the join the pools the script will exit before -# the pools finish running -multi.close() -single.close() -multi.join() -single.join() +run_threads(single, (x for x in self.test_list.iteritems() + if not x[1].run_concurrent)) log.summary() -- 1.9.2 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH 2/2] EGL_CHROMIUM_get_sync_values: Add conformance test.
On Thu, Apr 24, 2014 at 09:17:50AM -0700, Jamey Sharp wrote: On Apr 23, 2014 1:36 PM, Chad Versace chad.vers...@linux.intel.com wrote: On Tue, Apr 22, 2014 at 12:22:12PM -0700, Sarah Sharp wrote: On Fri, Apr 18, 2014 at 06:21:31PM -0700, Jamey Sharp wrote: - I don't see that MSC has to change at all even after two eglSwapBuffers calls, if SwapBuffers doesn't sync to vertical retrace. I looked at the EGL 1.5 spec with Chad, and if you look at the definition of eglSwapInterval, you'll see that the minimum number of video frame periods per buffer swap is set to 1 by default. I think one frame period is the time between vertical retraces, but the spec isn't clear on that. The spec is sadly ambiguous on that. It's also ambiguous on whether eglSwapBuffers blocks or immediately returns false if too many outstanding swaps are pending. I think it's safe to assume that it blocks. because that's what all EGL implementations do that I've used: X11, Android, Wayland, and (vacuously) GBM. (More below on why this it's vacuously true that GBM implements the blocking behavior). I'd just feel more comfortable, in a conformance test, if there were specification text you could point to instead of a de facto standard. I note you only mention Linux based GL implementations, after all. All Linux, but not all Mesa. Android's eglSwapBuffers is supposed to block across all Android platforms. On the Khronos EGL Teleconference yesterday, several EGL vendors coincidentally had a lengthy conversation about bugs that arise in applications due to eglSwapBuffers undesirably blocking. (The conversation's motivation was not this Piglit test, though). An implicit axiom that underpinned the conversation was that eglSwapBuffers does block. That's just what implementations do. The blocking itself wasn't up for debate, but how applications should deal with it rare corner cases. So I stand by my claim. The de facto standard is the standard here. As for eglSwapBuffers being synchronized to vertical retraces, again it is on all platforms I've used. Modulo bugs, presumably, since it certainly isn't reliably synchronized in X right now. :-) But I agree that it's intended to be, especially considering: How is it not synchronized in X? And how unreliabe is its unreliability? Please tell. This storm cloud troubles my soul. Theo has since pointed out this sentence in the OML_sync_control spec: If there are multiple outstanding swaps for the same window, at most one such swap can be satisfied per increment of MSC. So I retract my first concern. :-) (Technically this doesn't say the swap has to happen during vertical retrace, but for the purposes of Sarah's tests that doesn't matter.) I found the EGL text that mandates synchronization to vertical retrace! From the EGL 1.5 spec: If interval is set to a value of 0, buffer swaps are not synchronized to a video frame, [...] Well sorta... Though not explicitly stated, I believe spec clearly intends to mandate the inverse also: If the invterval is non-zero, buffer swaps are synchronized to a video frame. I played with that test app on X11, Wayland, and GBM to discover exactly how the swap interval behaves on each platform. Wayland was the weirdest. Out of curiosity, how was Wayland weird? The swap interval range in Wayland is [EGL_MIN_SWAP_INTERVAL=0, EGL_MAX_SWAP_INTERVAL=1]. I was surprised that EGL_MAX_SWAP_INTERVAL 2. I think the test should do this: Create the EGLConfig as it currently does. That is, do not specify EGL_[MIN|MAX]_SWAP_INTERVAL. Then immediately query eglGetConfigAttrib(EGL_MIN_SWAP_INTERVAL) and eglGetConfigAttrib(EGL_MAX_SWAP_INTERVAL). If the max swap interval is 0, then eglSwapBuffers will not block. So report PIGLIT_RESULT_SKIP. Else, the EGL spec ensures that the surface's swap interval is EGL_MIN_SWAP_INTERVAL. Calculate the expected MSC and SBC from that. For bonus points, let the desired swap_interval be an input parameter to the test. The test will skip if and only if requested_swap_interval is outside of [EGL_MIN_SWAP_INTERVAL, EGL_MAX_SWAP_INTERVAL]. The test sets the surface's swap interval with eglSwapInterval(requested_swap_interval), calculates expected values of of MSC and SBC, and tests for them. Why is GBM a special case? Because EGLConfigs on GBM have EGL_MIN_SWAP_INTERVAL == EGL_MAX_SWAP_INTERVAL == 0. So eglSwapBuffers never throttles. This strikes me as a very satisfying way to handle it, my lingering concerns about unspecified throttling/blocking behavior notwithstanding. Ooh, and does Mesa set EGL_MAX_SWAP_INTERVAL == 0 if vblank_mode is 0? Yep. This code block, present in the X11 and Wayland code, does it. I verified it actually does it job with my wfl-swapinterval toy. switch (vblank_mode) { case DRI_CONF_VBLANK_NEVER:
Re: [Piglit] libepoxy conversion v2
Eric said: But then there's the broken configure caching that makes it so you have to git clean regularly, and the broken library directory handling. I mean, look at the workarounds in chad's [Piglit] [ANNOUNCE] waffle = 1.3 required, you may need to rerun CMake. This build system is totally broken. I discovered how to uncache CMake's pkg-config queries and force CMake to rerun pkg-config anytime the CMake files change. I don't know how trustworthy my approach is yet, so I'm letting it bake in a personal project until I feel it's safe. ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 1/4] implement new texture swizzle test
The original one didn't test the GL_ONE and GL_ZERO terms and was pretty compilicated. This tests all swizzle combinations and is much simpler. --- tests/all.py |1 + tests/spec/ext_texture_swizzle/CMakeLists.gl.txt |1 + tests/spec/ext_texture_swizzle/swizzle.c | 173 ++ 3 files changed, 175 insertions(+) create mode 100644 tests/spec/ext_texture_swizzle/swizzle.c diff --git a/tests/all.py b/tests/all.py index 080b432..0665567 100644 --- a/tests/all.py +++ b/tests/all.py @@ -2644,6 +2644,7 @@ for stage in ['vs', 'gs', 'fs']: ext_texture_swizzle = {} spec['EXT_texture_swizzle'] = ext_texture_swizzle add_plain_test(ext_texture_swizzle, 'tex-swizzle') +add_concurrent_test(ext_texture_swizzle, 'ext_texture_swizzle-swizzle') ext_texture_swizzle['depth_texture_mode_and_swizzle'] = concurrent_test('depth_texture_mode_and_swizzle') ext_texture_compression_latc = {} diff --git a/tests/spec/ext_texture_swizzle/CMakeLists.gl.txt b/tests/spec/ext_texture_swizzle/CMakeLists.gl.txt index 047a199..70ecb1c 100644 --- a/tests/spec/ext_texture_swizzle/CMakeLists.gl.txt +++ b/tests/spec/ext_texture_swizzle/CMakeLists.gl.txt @@ -10,5 +10,6 @@ link_libraries ( ) piglit_add_executable (depth_texture_mode_and_swizzle depth_texture_mode_and_swizzle.c) +piglit_add_executable (ext_texture_swizzle-swizzle swizzle.c) # vim: ft=cmake: diff --git a/tests/spec/ext_texture_swizzle/swizzle.c b/tests/spec/ext_texture_swizzle/swizzle.c new file mode 100644 index 000..ead6711 --- /dev/null +++ b/tests/spec/ext_texture_swizzle/swizzle.c @@ -0,0 +1,173 @@ +/* + * Copyright © 2014 VMware, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the Software), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/* + * Test GL_EXT_texture_swizzle (including the _ZERO and _ONE terms). + * Brian Paul + * 24 April 2014 + */ + + +#include piglit-util-gl-common.h + +PIGLIT_GL_TEST_CONFIG_BEGIN + config.supports_gl_compat_version = 12; + config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE; +PIGLIT_GL_TEST_CONFIG_END + + +#define RED 0.2f +#define GREEN 0.4f +#define BLUE 0.6f +#define ALPHA 0.8f + + +static float +get_component_color(GLenum swz) +{ + switch (swz) { + case GL_RED: + return RED; + case GL_GREEN: + return GREEN; + case GL_BLUE: + return BLUE; + case GL_ALPHA: + return ALPHA; + case GL_ZERO: + return 0.0f; + case GL_ONE: + return 1.0f; + default: + assert(!Invalid swizzle term); + return 0.0; + } +} + + +static void +get_expected_color(GLenum swz_r, GLenum swz_g, GLenum swz_b, GLenum swz_a, +float expected[4]) +{ + expected[0] = get_component_color(swz_r); + expected[1] = get_component_color(swz_g); + expected[2] = get_component_color(swz_b); + expected[3] = get_component_color(swz_a); +} + + +static bool +test_swizzle(GLenum swz_r, GLenum swz_g, GLenum swz_b, GLenum swz_a) +{ + float expected[4]; + bool p; + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R_EXT, swz_r); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_G_EXT, swz_g); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B_EXT, swz_b); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A_EXT, swz_a); + + if (!piglit_check_gl_error(GL_NO_ERROR)) + return false; + + get_expected_color(swz_r, swz_g, swz_b, swz_a, expected); + + piglit_draw_rect_tex(-1.0, -1.0, 2.0, 2.0, +0.0, 0.0, 1.0, 1.0); + + p = piglit_probe_pixel_rgba(piglit_width/2, piglit_height/2, expected); + + piglit_present_results(); + + return p; +} + + +enum piglit_result +piglit_display(void) +{ + static const GLenum
[Piglit] [PATCH 4/4] remove glean texSwizzle test
Replaced by spec/ext_texture_swizzle/api.c and swizzle.c tests. --- tests/all.py |1 - tests/glean/CMakeLists.gl.txt |1 - tests/glean/ttexswizzle.cpp | 435 - tests/glean/ttexswizzle.h | 88 - 4 files changed, 525 deletions(-) delete mode 100644 tests/glean/ttexswizzle.cpp delete mode 100644 tests/glean/ttexswizzle.h diff --git a/tests/all.py b/tests/all.py index 05e9a04..0fd9bd8 100644 --- a/tests/all.py +++ b/tests/all.py @@ -138,7 +138,6 @@ glean['texCube'] = GleanTest('texCube') glean['texEnv'] = GleanTest('texEnv') glean['texgen'] = GleanTest('texgen') glean['texCombine4'] = GleanTest('texCombine4') -glean['texSwizzle'] = GleanTest('texSwizzle') glean['texture_srgb'] = GleanTest('texture_srgb') glean['texUnits'] = GleanTest('texUnits') glean['vertArrayBGRA'] = GleanTest('vertArrayBGRA') diff --git a/tests/glean/CMakeLists.gl.txt b/tests/glean/CMakeLists.gl.txt index 9bb37fe..abdfd8e 100644 --- a/tests/glean/CMakeLists.gl.txt +++ b/tests/glean/CMakeLists.gl.txt @@ -56,7 +56,6 @@ piglit_add_executable (glean ttexcube.cpp ttexenv.cpp ttexgen.cpp - ttexswizzle.cpp ttexture_srgb.cpp ttexunits.cpp tvertarraybgra.cpp diff --git a/tests/glean/ttexswizzle.cpp b/tests/glean/ttexswizzle.cpp deleted file mode 100644 index a306b59..000 --- a/tests/glean/ttexswizzle.cpp +++ /dev/null @@ -1,435 +0,0 @@ -// BEGIN_COPYRIGHT -*- glean -*- -// -// Copyright (C) 2009 VMware, Inc. All Rights Reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the Software), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the -// Software. -// -// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY -// KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL VMWARE BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -// AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -// OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. -// -// END_COPYRIGHT - - -// Test GL_EXT_texture_swizzle for all possible swizzle combinations -// both with fixed function and a fragment program. -// Brian Paul -// 28 Jan 2009 - - -#define GL_GLEXT_PROTOTYPES - -#include cassert -#include cmath -#include cstring -#include stdlib.h -#include ttexswizzle.h -#include rand.h -#include image.h - - -namespace GLEAN { - -static const int TexSize = 16; - -static const GLfloat vertexData[4][4] = { - // x,y,s, t - { -1.0, -1.0, 0.0, 0.0 }, - { 1.0, -1.0, 1.0, 0.0 }, - { 1.0, 1.0, 1.0, 1.0 }, - { -1.0, 1.0, 0.0, 1.0 } -}; - - -TexSwizzleResult::TexSwizzleResult() -{ - pass = false; -} - - -void -TexSwizzleTest::RandomColor(GLubyte *color) -{ - color[0] = rand.next() 0xff; - color[1] = rand.next() 0xff; - color[2] = rand.next() 0xff; - color[3] = rand.next() 0xff; -} - - -void -TexSwizzleTest::SetTextureColor(const GLubyte *color) -{ - GLubyte texImage[TexSize][TexSize][4]; - int i, j; - - for (i = 0; i TexSize; i++) { - for (j = 0; j TexSize; j++) { - texImage[i][j][0] = color[0]; - texImage[i][j][1] = color[1]; - texImage[i][j][2] = color[2]; - texImage[i][j][3] = color[3]; - } - } - - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, TexSize, TexSize, 0, -GL_RGBA, GL_UNSIGNED_BYTE, texImage); -} - - -GLubyte -TexSwizzleTest::Swizzle(const GLubyte *texColor, GLenum swizzle) -{ - switch (swizzle) { - case GL_RED: - return texColor[0]; - case GL_GREEN: - return texColor[1]; - case GL_BLUE: - return texColor[2]; - case GL_ALPHA: - return texColor[3]; - case GL_ONE: - return 255; - case GL_ZERO: - return 0; - default: - assert(0); - return 0; - } -} - - -void -TexSwizzleTest::ComputeExpectedColor(const GLubyte *texColor, -GLenum swizzleR, -GLenum swizzleG, -
[Piglit] [PATCH 2/4] add new texture swizzle API test
Test for API errors and glGet for GL_EXT_texture_swizzle. --- tests/all.py |1 + tests/spec/ext_texture_swizzle/CMakeLists.gl.txt |1 + tests/spec/ext_texture_swizzle/api.c | 122 ++ 3 files changed, 124 insertions(+) create mode 100644 tests/spec/ext_texture_swizzle/api.c diff --git a/tests/all.py b/tests/all.py index 0665567..c613b00 100644 --- a/tests/all.py +++ b/tests/all.py @@ -2644,6 +2644,7 @@ for stage in ['vs', 'gs', 'fs']: ext_texture_swizzle = {} spec['EXT_texture_swizzle'] = ext_texture_swizzle add_plain_test(ext_texture_swizzle, 'tex-swizzle') +add_concurrent_test(ext_texture_swizzle, 'ext_texture_swizzle-api') add_concurrent_test(ext_texture_swizzle, 'ext_texture_swizzle-swizzle') ext_texture_swizzle['depth_texture_mode_and_swizzle'] = concurrent_test('depth_texture_mode_and_swizzle') diff --git a/tests/spec/ext_texture_swizzle/CMakeLists.gl.txt b/tests/spec/ext_texture_swizzle/CMakeLists.gl.txt index 70ecb1c..98533b2 100644 --- a/tests/spec/ext_texture_swizzle/CMakeLists.gl.txt +++ b/tests/spec/ext_texture_swizzle/CMakeLists.gl.txt @@ -10,6 +10,7 @@ link_libraries ( ) piglit_add_executable (depth_texture_mode_and_swizzle depth_texture_mode_and_swizzle.c) +piglit_add_executable (ext_texture_swizzle-api api.c) piglit_add_executable (ext_texture_swizzle-swizzle swizzle.c) # vim: ft=cmake: diff --git a/tests/spec/ext_texture_swizzle/api.c b/tests/spec/ext_texture_swizzle/api.c new file mode 100644 index 000..212ef08 --- /dev/null +++ b/tests/spec/ext_texture_swizzle/api.c @@ -0,0 +1,122 @@ +/* + * Copyright © 2014 VMware, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the Software), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/* + * Test GL_EXT_texture_swizzle API functions. + * Brian Paul + * 24 April 2014 + */ + + +#include piglit-util-gl-common.h + +PIGLIT_GL_TEST_CONFIG_BEGIN + config.supports_gl_compat_version = 12; + config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE; +PIGLIT_GL_TEST_CONFIG_END + + +static bool +test_get(GLenum pname, GLint expected) +{ + GLint val; + + glGetTexParameteriv(GL_TEXTURE_2D, pname, val); + + if (val != expected) { + printf(glGetTexParameteriv(%s) returned %s instead of %s\n, + piglit_get_gl_enum_name(pname), + piglit_get_gl_enum_name(val), + piglit_get_gl_enum_name(expected)); + return false; + } + + return true; +} + + +static bool +test_api(void) +{ + static const GLint swz[4] = { GL_BLUE, GL_GREEN, GL_ALPHA, GL_ZERO }; + GLint swzOut[4]; + + /* test bad param value */ + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R_EXT, GL_RGBA); + + if (!piglit_check_gl_error(GL_INVALID_ENUM)) + return false; + + /* test good param values */ + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R_EXT, GL_ONE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_G_EXT, GL_ZERO); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B_EXT, GL_RED); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A_EXT, GL_BLUE); + + if (!piglit_check_gl_error(GL_NO_ERROR)) + return false; + + if (!test_get(GL_TEXTURE_SWIZZLE_R_EXT, GL_ONE)) + return false; + + if (!test_get(GL_TEXTURE_SWIZZLE_G_EXT, GL_ZERO)) + return false; + + if (!test_get(GL_TEXTURE_SWIZZLE_B_EXT, GL_RED)) + return false; + + if (!test_get(GL_TEXTURE_SWIZZLE_A_EXT, GL_BLUE)) + return false; + + /* set all at once */ + glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA_EXT, swz); + + if (!piglit_check_gl_error(GL_NO_ERROR)) + return false; + + glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA_EXT, swzOut); + if (swzOut[0]
Re: [Piglit] [PATCH] profile: Fix mixed concurrency runs
I'm not sure I undertand this. I think the limitation for non-concurrent tests is that they cannot be concurrently, because they do front buffer rendering and other things. That doesn't mean all the off-screen tests cannot be run with the non-concurrent tests simultaneously. Marek On Thu, Apr 17, 2014 at 10:59 PM, Dylan Baker baker.dyla...@gmail.com wrote: Currently we call join after initializing both of the pools, which means that they run simultaneously. This patch fixes that by creating a helper function which sets off the pool, closes it, and then joins it. This fixes the problem by forcing each pool to run in series. Signed-off-by: Dylan Baker baker.dyla...@gmail.com --- framework/profile.py | 29 ++--- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/framework/profile.py b/framework/profile.py index 2e160e3..3def3e0 100644 --- a/framework/profile.py +++ b/framework/profile.py @@ -119,6 +119,8 @@ class TestProfile(object): self.prepare_test_list(env) log = Log(len(self.test_list), env.verbose) +chunksize = 1 + def test(pair): Function to call test.execute from .map @@ -128,33 +130,30 @@ class TestProfile(object): name, test = pair test.execute(name, log, json_writer, self.dmesg) +def run_threads(pool, testlist): + Open a pool, close it, and join it +pool.imap(test, testlist, chunksize) +pool.close() +pool.join() + # Multiprocessing.dummy is a wrapper around Threading that provides a # multiprocessing compatible API # # The default value of pool is the number of virtual processor cores single = multiprocessing.dummy.Pool(1) multi = multiprocessing.dummy.Pool() -chunksize = 1 if env.concurrent == all: -multi.imap(test, self.test_list.iteritems(), chunksize) +run_threads(multi, self.test_list.iteritems()) elif env.concurrent == none: -single.imap(test, self.test_list.iteritems(), chunksize) +run_threads(single, self.test_list.iteritems()) else: # Filter and return only thread safe tests to the threaded pool -multi.imap(test, (x for x in self.test_list.iteritems() if - x[1].run_concurrent), chunksize) +run_threads(multi, (x for x in self.test_list.iteritems() if +x[1].run_concurrent)) # Filter and return the non thread safe tests to the single pool -single.imap(test, (x for x in self.test_list.iteritems() if not - x[1].run_concurrent), chunksize) - -# Close and join the pools -# If we don't close and the join the pools the script will exit before -# the pools finish running -multi.close() -single.close() -multi.join() -single.join() +run_threads(multi, (x for x in self.test_list.iteritems() if not +x[1].run_concurrent)) log.summary() -- 1.9.2 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH] profile: Fix mixed concurrency runs
On Friday, April 25, 2014 00:24:47 Marek Olšák wrote: I'm not sure I undertand this. I think the limitation for non-concurrent tests is that they cannot be concurrently, because they do front buffer rendering and other things. That doesn't mean all the off-screen tests cannot be run with the non-concurrent tests simultaneously. Marek So the bug was that with no -c or -1 option both pools were executed simultaneously, so a normal run ended up being concurrent with n+1 threads. On Thu, Apr 17, 2014 at 10:59 PM, Dylan Baker baker.dyla...@gmail.com wrote: Currently we call join after initializing both of the pools, which means that they run simultaneously. This patch fixes that by creating a helper function which sets off the pool, closes it, and then joins it. This fixes the problem by forcing each pool to run in series. Signed-off-by: Dylan Baker baker.dyla...@gmail.com --- framework/profile.py | 29 ++--- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/framework/profile.py b/framework/profile.py index 2e160e3..3def3e0 100644 --- a/framework/profile.py +++ b/framework/profile.py @@ -119,6 +119,8 @@ class TestProfile(object): self.prepare_test_list(env) log = Log(len(self.test_list), env.verbose) +chunksize = 1 + def test(pair): Function to call test.execute from .map @@ -128,33 +130,30 @@ class TestProfile(object): name, test = pair test.execute(name, log, json_writer, self.dmesg) +def run_threads(pool, testlist): + Open a pool, close it, and join it +pool.imap(test, testlist, chunksize) +pool.close() +pool.join() + # Multiprocessing.dummy is a wrapper around Threading that provides a # multiprocessing compatible API # # The default value of pool is the number of virtual processor cores single = multiprocessing.dummy.Pool(1) multi = multiprocessing.dummy.Pool() -chunksize = 1 if env.concurrent == all: -multi.imap(test, self.test_list.iteritems(), chunksize) +run_threads(multi, self.test_list.iteritems()) elif env.concurrent == none: -single.imap(test, self.test_list.iteritems(), chunksize) +run_threads(single, self.test_list.iteritems()) else: # Filter and return only thread safe tests to the threaded pool -multi.imap(test, (x for x in self.test_list.iteritems() if - x[1].run_concurrent), chunksize) +run_threads(multi, (x for x in self.test_list.iteritems() if +x[1].run_concurrent)) # Filter and return the non thread safe tests to the single pool -single.imap(test, (x for x in self.test_list.iteritems() if not - x[1].run_concurrent), chunksize) - -# Close and join the pools -# If we don't close and the join the pools the script will exit before -# the pools finish running -multi.close() -single.close() -multi.join() -single.join() +run_threads(multi, (x for x in self.test_list.iteritems() if not +x[1].run_concurrent)) log.summary() -- 1.9.2 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit signature.asc Description: This is a digitally signed message part. ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH] profile: Fix mixed concurrency runs
On Thu, Apr 24, 2014 at 6:33 PM, Dylan Baker baker.dyla...@gmail.com wrote: On Friday, April 25, 2014 00:24:47 Marek Olšák wrote: I'm not sure I undertand this. I think the limitation for non-concurrent tests is that they cannot be concurrently, because they do front buffer rendering and other things. That doesn't mean all the off-screen tests cannot be run with the non-concurrent tests simultaneously. Marek So the bug was that with no -c or -1 option both pools were executed simultaneously, so a normal run ended up being concurrent with n+1 threads. I think Marek's point is that this is fine, since it's fine to run a test that is marked as non-concurrent concurrently with any number of tests that are marked concurrent. The only problem is multiple non-concurrent tests running at once. I don't know whether that's generically true, but if it is, then this change should be reverted. -ilia ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH] profile: Fix mixed concurrency runs
On Thursday, April 24, 2014 18:39:44 Ilia Mirkin wrote: On Thu, Apr 24, 2014 at 6:33 PM, Dylan Baker baker.dyla...@gmail.com wrote: On Friday, April 25, 2014 00:24:47 Marek Olšák wrote: I'm not sure I undertand this. I think the limitation for non-concurrent tests is that they cannot be concurrently, because they do front buffer rendering and other things. That doesn't mean all the off-screen tests cannot be run with the non-concurrent tests simultaneously. Marek So the bug was that with no -c or -1 option both pools were executed simultaneously, so a normal run ended up being concurrent with n+1 threads. I think Marek's point is that this is fine, since it's fine to run a test that is marked as non-concurrent concurrently with any number of tests that are marked concurrent. The only problem is multiple non-concurrent tests running at once. I don't know whether that's generically true, but if it is, then this change should be reverted. -ilia I'm not sure. I know there are front buffer tests that are not safe to run with other front buffer tests, but I thought there were other tests (like ARB_timer_query?) that needed to be the only thing running on the GPU. I was on a quest to try to find the rest of the test that were thread safe and not marked as such and mark them, but I've been sidetracked. signature.asc Description: This is a digitally signed message part. ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH] profile: Fix mixed concurrency runs
There are 3 categories of tests: - concurrent, these are off-screen and can be run anytime - non-concurrent, because they render to a window (usually a front buffer) and may take focus; any number of off-screen tests can be run simultaneously with these, because off-screen tests cannot affect front buffer rendering in other apps - non-concurrent, because they measure time and therefore should be run while all the other processes are idle (we really have like 2 or 3 of these) Marek On Fri, Apr 25, 2014 at 12:33 AM, Dylan Baker baker.dyla...@gmail.com wrote: On Friday, April 25, 2014 00:24:47 Marek Olšák wrote: I'm not sure I undertand this. I think the limitation for non-concurrent tests is that they cannot be concurrently, because they do front buffer rendering and other things. That doesn't mean all the off-screen tests cannot be run with the non-concurrent tests simultaneously. Marek So the bug was that with no -c or -1 option both pools were executed simultaneously, so a normal run ended up being concurrent with n+1 threads. On Thu, Apr 17, 2014 at 10:59 PM, Dylan Baker baker.dyla...@gmail.com wrote: Currently we call join after initializing both of the pools, which means that they run simultaneously. This patch fixes that by creating a helper function which sets off the pool, closes it, and then joins it. This fixes the problem by forcing each pool to run in series. Signed-off-by: Dylan Baker baker.dyla...@gmail.com --- framework/profile.py | 29 ++--- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/framework/profile.py b/framework/profile.py index 2e160e3..3def3e0 100644 --- a/framework/profile.py +++ b/framework/profile.py @@ -119,6 +119,8 @@ class TestProfile(object): self.prepare_test_list(env) log = Log(len(self.test_list), env.verbose) + chunksize = 1 + def test(pair): Function to call test.execute from .map @@ -128,33 +130,30 @@ class TestProfile(object): name, test = pair test.execute(name, log, json_writer, self.dmesg) + def run_threads(pool, testlist): + Open a pool, close it, and join it + pool.imap(test, testlist, chunksize) + pool.close() + pool.join() + # Multiprocessing.dummy is a wrapper around Threading that provides a # multiprocessing compatible API # # The default value of pool is the number of virtual processor cores single = multiprocessing.dummy.Pool(1) multi = multiprocessing.dummy.Pool() - chunksize = 1 if env.concurrent == all: - multi.imap(test, self.test_list.iteritems(), chunksize) + run_threads(multi, self.test_list.iteritems()) elif env.concurrent == none: - single.imap(test, self.test_list.iteritems(), chunksize) + run_threads(single, self.test_list.iteritems()) else: # Filter and return only thread safe tests to the threaded pool - multi.imap(test, (x for x in self.test_list.iteritems() if - x[1].run_concurrent), chunksize) + run_threads(multi, (x for x in self.test_list.iteritems() if + x[1].run_concurrent)) # Filter and return the non thread safe tests to the single pool - single.imap(test, (x for x in self.test_list.iteritems() if not - x[1].run_concurrent), chunksize) - - # Close and join the pools - # If we don't close and the join the pools the script will exit before - # the pools finish running - multi.close() - single.close() - multi.join() - single.join() + run_threads(multi, (x for x in self.test_list.iteritems() if not + x[1].run_concurrent)) log.summary() -- 1.9.2 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH v2 2/2] EGL_CHROMIUM_sync_control: Add initial tests.
Test the EGL_CHROMIUM_sync_control extension, which is similar to the GLX_OML_sync_control extension: http://www.opengl.org/registry/specs/OML/glx_sync_control.txt The extension only defines one new function, EGL_CHROMIUM_get_sync_values, which is equivalent to the glXGetSyncValuesOML function. It's difficult to test the Media Stream Counter (MSC) without the equivalent function to get the MSC rate (glXGetMscRateOML). The test at least makes sure MSC and SBC increment after two SwapBuffers() calls. UST is system-dependent, so it may behave differently on Windows, Linux, and Apple. The test just makes sure it increments monotonically. The test uses Chad's new subtest infrastructure and the EGL convenience functions from egl-util.c. Signed-off-by: Sarah Sharp sarah.a.sh...@linux.intel.com Cc: Chad Versace chad.vers...@linux.intel.com Cc: Rob Bradford r...@linux.intel.com --- v2: - The extension *name* should be EGL_CHROMIUM_sync_control, and the new *function* is called EGL_CHROMIUM_get_sync_values. tests/all.py | 4 + tests/egl/egl-create-surface.c | 4 +- tests/egl/egl-nok-swap-region.c| 4 +- tests/egl/egl-nok-texture-from-pixmap.c| 4 +- tests/egl/egl-query-surface.c | 4 +- tests/egl/egl-util.c | 56 ++--- tests/egl/egl-util.h | 3 +- tests/egl/spec/CMakeLists.txt | 1 + .../CMakeLists.gles2.txt | 7 + .../egl_chromium_get_sync_values/CMakeLists.txt| 1 + .../egl_chromium_get_sync_values.c | 277 + 11 files changed, 331 insertions(+), 34 deletions(-) create mode 100644 tests/egl/spec/egl_chromium_get_sync_values/CMakeLists.gles2.txt create mode 100644 tests/egl/spec/egl_chromium_get_sync_values/CMakeLists.txt create mode 100644 tests/egl/spec/egl_chromium_get_sync_values/egl_chromium_get_sync_values.c diff --git a/tests/all.py b/tests/all.py index 49c801a..439cd02 100644 --- a/tests/all.py +++ b/tests/all.py @@ -3835,6 +3835,10 @@ egl_khr_fence_sync = {} spec['EGL_KHR_fence_sync'] = egl_khr_fence_sync egl_khr_fence_sync['conformance'] = concurrent_test('egl_khr_fence_sync') +egl_chromium_get_sync_values = {} +spec['EGL_CHROMIUM_get_sync_values'] = egl_chromium_get_sync_values +egl_chromium_get_sync_values['conformance'] = concurrent_test('egl_chromium_get_sync_values') + gles20 = {} spec['!OpenGL ES 2.0'] = gles20 gles20['glsl-fs-pointcoord'] = concurrent_test('glsl-fs-pointcoord_gles2') diff --git a/tests/egl/egl-create-surface.c b/tests/egl/egl-create-surface.c index 2c7224e..1fd819a 100644 --- a/tests/egl/egl-create-surface.c +++ b/tests/egl/egl-create-surface.c @@ -75,5 +75,7 @@ main(int argc, char *argv[]) egl_init_test(test); test.draw = draw; - return egl_util_run(test, argc, argv); + if (egl_util_run(test, argc, argv) != PIGLIT_PASS) + return EXIT_FAILURE; + return EXIT_SUCCESS; } diff --git a/tests/egl/egl-nok-swap-region.c b/tests/egl/egl-nok-swap-region.c index b32bec9..e7b8ceb 100644 --- a/tests/egl/egl-nok-swap-region.c +++ b/tests/egl/egl-nok-swap-region.c @@ -106,7 +106,9 @@ main(int argc, char *argv[]) test.extensions = extensions; test.draw = draw; - return egl_util_run(test, argc, argv); + if (egl_util_run(test, argc, argv) != PIGLIT_PASS) + return EXIT_FAILURE; + return EXIT_SUCCESS; } #else diff --git a/tests/egl/egl-nok-texture-from-pixmap.c b/tests/egl/egl-nok-texture-from-pixmap.c index 026e17b..2e96a4a 100644 --- a/tests/egl/egl-nok-texture-from-pixmap.c +++ b/tests/egl/egl-nok-texture-from-pixmap.c @@ -109,7 +109,9 @@ main(int argc, char *argv[]) test.extensions = extensions; test.draw = draw; - return egl_util_run(test, argc, argv); + if (egl_util_run(test, argc, argv) != PIGLIT_PASS) + return EXIT_FAILURE; + return EXIT_SUCCESS; } #else diff --git a/tests/egl/egl-query-surface.c b/tests/egl/egl-query-surface.c index d6424e4..cf71c3d 100644 --- a/tests/egl/egl-query-surface.c +++ b/tests/egl/egl-query-surface.c @@ -204,5 +204,7 @@ main(int argc, char *argv[]) test.window_width = window_width; test.window_height = window_height; - return egl_util_run(test, argc, argv); + if (egl_util_run(test, argc, argv) != PIGLIT_PASS) + return EXIT_FAILURE; + return EXIT_SUCCESS; } diff --git a/tests/egl/egl-util.c b/tests/egl/egl-util.c index a578d85..9bd1751 100644 --- a/tests/egl/egl-util.c +++ b/tests/egl/egl-util.c @@ -80,7 +80,6 @@ egl_init_test(struct egl_test *test) test-window_width = egl_default_window_width; test-window_height = egl_default_window_height; test-stop_on_failure = true; - test-result = PIGLIT_FAIL; } EGLSurface @@ -120,6 +119,8
[Piglit] [PATCH v2 1/2] egl/utils: Prepare egl_util_run to be called from piglit subtests.
For future EGL tests, I want to be able to use Chad's new piglit EGL subtest infrastructure, and use the EGL utilities convenience functions to set up a window, surface, and context. Currently, egl_util_run calls piglit_report_result() after calling test.draw. This means no other subtests get run. Add a new field in egl_test to specify whether piglit_report_result() should be called, and another field to store the result returned from test.draw. Make sure that egl_util_run() tears down the window, surface, and context. Previously it was relying on cleanup being done when the process died, which won't work if we want to run a second subtest in the same thread. TODO: There's still some work that could be done here to ensure the initialization steps in egl_util_run aren't done twice (e.g. calling XOpenDisplay, eglInitialize, etc.) However, the tests pass in their current state, so there's no reason they shouldn't be merged. Thanks a bunch to Chad Versace and Rob Bradford, who helped me debug this code! Signed-off-by: Sarah Sharp sarah.a.sh...@linux.intel.com Cc: Chad Versace chad.vers...@linux.intel.com Cc: Rob Bradford r...@linux.intel.com --- v2: - Remove glFinish in egl_util_run. Tests still pass without it. - Fix memory leak of vinfo in create_window. - Make error handling code in egl_util_run more readable/verifiable. - Make sure test is const in egl_util_run. tests/egl/egl-util.c | 56 +++- tests/egl/egl-util.h | 4 +++- 2 files changed, 41 insertions(+), 19 deletions(-) diff --git a/tests/egl/egl-util.c b/tests/egl/egl-util.c index 226ba0e..a578d85 100644 --- a/tests/egl/egl-util.c +++ b/tests/egl/egl-util.c @@ -79,6 +79,8 @@ egl_init_test(struct egl_test *test) test-extensions = no_extensions; test-window_width = egl_default_window_width; test-window_height = egl_default_window_height; + test-stop_on_failure = true; + test-result = PIGLIT_FAIL; } EGLSurface @@ -97,7 +99,7 @@ egl_util_create_pixmap(struct egl_state *state, return surf; } -static void +static enum piglit_result create_window(struct egl_state *state) { XSetWindowAttributes window_attr; @@ -111,14 +113,14 @@ create_window(struct egl_state *state) if (!eglGetConfigAttrib(state-egl_dpy, state-cfg, EGL_NATIVE_VISUAL_ID, id)) { fprintf(stderr, eglGetConfigAttrib() failed\n); - piglit_report_result(PIGLIT_FAIL); + return PIGLIT_FAIL; } template.visualid = id; vinfo = XGetVisualInfo(state-dpy, VisualIDMask, template, count); if (count != 1) { fprintf(stderr, XGetVisualInfo() failed\n); - piglit_report_result(PIGLIT_FAIL); + return PIGLIT_FAIL; } state-depth = vinfo-depth; @@ -137,6 +139,7 @@ create_window(struct egl_state *state) XMapWindow(state-dpy, state-win); XFree(vinfo); + return PIGLIT_PASS; } static enum piglit_result @@ -184,11 +187,10 @@ check_extensions(struct egl_state *state, const struct egl_test *test) } int -egl_util_run(const struct egl_test *test, int argc, char *argv[]) +egl_util_run(struct egl_test *test, int argc, char *argv[]) { struct egl_state state; EGLint count; - enum piglit_result result; int i, dispatch_api, api_bit = EGL_OPENGL_BIT; EGLint ctxAttribsES[] = { @@ -207,7 +209,8 @@ egl_util_run(const struct egl_test *test, int argc, char *argv[]) state.dpy = XOpenDisplay(NULL); if (state.dpy == NULL) { fprintf(stderr, couldn't open display\n); - piglit_report_result(PIGLIT_FAIL); + test-result = PIGLIT_FAIL; + goto fail; } /* read api_bit if EGL_RENDERABLE_TYPE set in the attribs */ @@ -243,12 +246,14 @@ egl_util_run(const struct egl_test *test, int argc, char *argv[]) state.egl_dpy = eglGetDisplay(state.dpy); if (state.egl_dpy == EGL_NO_DISPLAY) { fprintf(stderr, eglGetDisplay() failed\n); - piglit_report_result(PIGLIT_FAIL); + test-result = PIGLIT_FAIL; + goto fail; } if (!eglInitialize(state.egl_dpy, state.major, state.minor)) { fprintf(stderr, eglInitialize() failed\n); - piglit_report_result(PIGLIT_FAIL); + test-result = PIGLIT_FAIL; + goto fail; } check_extensions(state, test); @@ -256,40 +261,55 @@ egl_util_run(const struct egl_test *test, int argc, char *argv[]) if (!eglChooseConfig(state.egl_dpy, test-config_attribs, state.cfg, 1, count) || count == 0) { fprintf(stderr, eglChooseConfig() failed\n); - piglit_report_result(PIGLIT_FAIL); + test-result = PIGLIT_FAIL; + goto fail; }
[Piglit] [PATCH 2/3] summary.py: Treat subtests as groups, again
With this patch tests with subtests are treated as groups, their status is thrown away, and they inherit the 'worst' status from their children just like a group. This reverts commit de4b13de226e140313c3571e59a57438626da183. --- framework/summary.py | 86 ++-- templates/index.mako | 2 +- 2 files changed, 71 insertions(+), 17 deletions(-) diff --git a/framework/summary.py b/framework/summary.py index 47138bf..4436cea 100644 --- a/framework/summary.py +++ b/framework/summary.py @@ -163,8 +163,17 @@ class HTMLIndex(list): # is a KeyError (a result doesn't contain a particular test), # return Not Run, with clas skip for highlighting for each in summary.results: +# If the group at the top of the key heirachy contains +# 'subtest' then it is really not a group, link to that page try: -self._testResult(each.name, key, each.tests[key]['result']) +if each.tests[path.dirname(key)]['subtest']: +href = path.dirname(key) +except KeyError: +href = key + +try: +self._testResult(each.name, href, + summary.status[each.name][key]) except KeyError: self.append({'type': 'other', 'text': 'td class=skipNot Run/td'}) @@ -223,9 +232,17 @@ class HTMLIndex(list): displaying pass/fail/crash/etc and formatting the cell to the correct color. +# Not Run is not a valid class, if it apears set the class to skip +if text == so.NOTRUN: +css = 'skip' +href = None +else: +css = text +href = path.join(group, href + .html) + self.append({'type': 'testResult', - 'class': text, - 'href': path.join(group, href + .html), + 'class': css, + 'href': href, 'text': text}) @@ -265,7 +282,12 @@ class Summary: Helper for updating the fractions and status lists fraction[test] = tuple( [sum(i) for i in zip(fraction[test], result.fraction)]) -if result != so.SKIP and status[test] result: + +# If the new status is worse update it, or if the new status is +# SKIP (which is equivalent to notrun) and the current is NOTRUN +# update it +if (status[test] result or +(result == so.SKIP and status[test] == so.NOTRUN)): status[test] = result for results in self.results: @@ -282,6 +304,10 @@ class Summary: fraction = self.fractions[results.name] status = self.status[results.name] +# store the results to be appeneded to results. Adding them in the +# loop will cause a RuntimeError +temp_results = {} + for key, value in results.tests.iteritems(): # if the first character of key is a / then our while loop will # become an infinite loop. Beyond that / should never be the @@ -289,18 +315,46 @@ class Summary: # test profiles. assert key[0] != '/' -#FIXME: Add subtest support - -# Walk the test name as if it was a path, at each level update -# the tests passed over the total number of tests (fractions), -# and update the status of the current level if the status of -# the previous level was worse, but is not skip -while key != '': -fgh(key, value['result']) -key = path.dirname(key) - -# when we hit the root update the 'all' group and stop -fgh('all', value['result']) +# Treat a test with subtests as if it is a group, assign the +# subtests' statuses and fractions down to the test, and then +# proceed like normal. +if 'subtest' in value: +for (subt, subv) in value['subtest'].iteritems(): +subt = path.join(key, subt) +subv = so.status_lookup(subv) + +# Add the subtest to the fractions and status lists +fraction[subt] = subv.fraction +status[subt] = subv +temp_results.update({subt: {'result': subv}}) + +self.tests['all'].add(subt) +while subt != '': +fgh(subt, subv) +subt = path.dirname(subt) +fgh('all', subv) + +# remove the test from the 'all' list, this
[Piglit] [PATCH 1/3] summary_tests.py: Add tests for subtest handling
These tests are meant to show that subtest handling actually works. --- framework/tests/summary_tests.py | 77 +++- 1 file changed, 76 insertions(+), 1 deletion(-) diff --git a/framework/tests/summary_tests.py b/framework/tests/summary_tests.py index 1ad51b5..bad1ba7 100644 --- a/framework/tests/summary_tests.py +++ b/framework/tests/summary_tests.py @@ -21,6 +21,7 @@ Module providing tests for the summary module +from __future__ import print_function import json import copy import nose.tools as nt @@ -67,6 +68,80 @@ def check_sets(old, ostat, new, nstat, set_): with utils.with_tempfile(json.dumps(new)) as nfile: summ = summary.Summary([ofile, nfile]) -print summ.tests +print(summ.tests) nt.assert_equal(1, len(summ.tests[set_]), msg={0} was not appended.format(set_)) + + +def test_subtest_handling(): +data = copy.deepcopy(utils.JSON_DATA) +data['tests']['with_subtests'] = {} +data['tests']['with_subtests']['result'] = 'pass' + +data['tests']['with_subtests']['subtest'] = {} +data['tests']['with_subtests']['subtest']['subtest1'] = 'fail' +data['tests']['with_subtests']['subtest']['subtest2'] = 'warn' +data['tests']['with_subtests']['subtest']['subtest3'] = 'crash' +data['tests']['is_skip'] = {} +data['tests']['is_skip']['result'] = 'skip' + +with utils.with_tempfile(json.dumps(data)) as sumfile: +summ = summary.Summary([sumfile]) + +check_subtests_are_tests.description = \ +Subtests should be treated as full tests +yield check_subtests_are_tests, summ + +check_tests_w_subtests_are_groups.description = \ +Tests with subtests should be a group +yield check_tests_w_subtests_are_groups, summ + +test_removed_from_all.description = \ +Tests with subtests should not be in the tests['all'] name +yield test_removed_from_all, summ + +subtest_not_skip_notrun.description = \ +Skip's should not become NotRun +yield subtest_not_skip_notrun, summ + + +@nt.nottest +def check_subtests_are_tests(summary_): + Subtests should be treated as full tests +print(summary_.fractions) +nt.assert_equal(summary_.fractions['fake-tests']['with_subtests'], (0, 3), +msg=Summary.fraction['fake-tests']['with_subtests'] should +be (0, 3), but isn't) + + +@nt.nottest +def check_tests_w_subtests_are_groups(summary_): + Tests with subtests should be a group + +We know that the status will be 'pass' if it's not being overwritten, and +will be 'crash' if it has. (since we set the data that way) + + +print(summary_.status) +nt.assert_equal( +str(summary_.status['fake-tests']['with_subtests']), 'crash', +msg=Summary.status['fake-tests']['with_subtests'] should +be crash, but isn't) + + +@nt.nottest +def test_removed_from_all(summary_): + Tests with subtests should not be in the all results +print(summary_.tests['all']) +nt.assert_not_in('with_subtests', summary_.tests['all'], +msg=Test with subtests should have been removed from +self.tests['all'], but wasn't) + + +@nt.nottest +def subtest_not_skip_notrun(summary_): + Ensure that skips are not changed to notruns +print(summary_.status['fake-tests']['is_skip']) +print(summary_.results[0].tests['is_skip']) +nt.eq_(summary_.status['fake-tests']['is_skip'], 'skip', +msg=Status should be skip but was changed) -- 2.0.0.rc0 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 3/3] framework/exectest.py: Only record one instance of subtests
Since subtests are better handled in the summary module there is no need to record these multiple times. This significantly reduces the size of the results file, (from 45M to 10M) --- framework/exectest.py | 8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/framework/exectest.py b/framework/exectest.py index 3056a78..abd10f1 100644 --- a/framework/exectest.py +++ b/framework/exectest.py @@ -96,13 +96,7 @@ class Test(object): log.log(path, self.result['result']) log.post_log(log_current, self.result['result']) -if 'subtest' in self.result and len(self.result['subtest']) 1: -for test in self.result['subtest']: -self.result['result'] = self.result['subtest'][test] -json_writer.write_dict_item(os.path.join(path, test), -self.result) -else: -json_writer.write_dict_item(path, self.result) +json_writer.write_dict_item(path, self.result) else: log.log(path, 'dry-run') log.post_log(log_current, 'dry-run') -- 2.0.0.rc0 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit