[Piglit] [PATCH] util: fix Windows stdout/stderr buffering
Windows doesn't immediately flush stdout/stderr after printf(). Use setbuf() to disable buffering on Windows. Refactor the init code a bit to avoid calling setbuf() from some arbitrary place otherwise. --- tests/util/piglit-framework-gl.h | 2 +- tests/util/piglit-util.c | 24 +++- tests/util/piglit-util.h | 2 +- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/tests/util/piglit-framework-gl.h b/tests/util/piglit-framework-gl.h index 992f28a..970fd55 100644 --- a/tests/util/piglit-framework-gl.h +++ b/tests/util/piglit-framework-gl.h @@ -271,7 +271,7 @@ piglit_gl_test_run(int argc, char *argv[], {\ struct piglit_gl_test_config config; \ \ -piglit_disable_error_message_boxes();\ +piglit_general_init(); \ \ piglit_gl_test_config_init(); \ \ diff --git a/tests/util/piglit-util.c b/tests/util/piglit-util.c index 6b34c46..15a178b 100644 --- a/tests/util/piglit-util.c +++ b/tests/util/piglit-util.c @@ -317,7 +317,7 @@ piglit_report_subtest_result(enum piglit_result result, const char *format, ...) } -void +static void piglit_disable_error_message_boxes(void) { /* When Windows' error message boxes are disabled for this process (as @@ -354,6 +354,28 @@ piglit_disable_error_message_boxes(void) } +static void +piglit_set_line_buffering(void) +{ + /* Windows doesn't immediately flush stdout/stderr after printf +* calls as we see on Linux. To get immediate flushing, we disable +* buffering here. +*/ +#ifdef _WIN32 + setbuf(stdout, NULL); + setbuf(stderr, NULL); +#endif +} + + +void +piglit_general_init(void) +{ + piglit_disable_error_message_boxes(); + piglit_set_line_buffering(); +} + + void piglit_set_rlimit(unsigned long lim) { diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h index b30ae07..ad00817 100644 --- a/tests/util/piglit-util.h +++ b/tests/util/piglit-util.h @@ -414,7 +414,7 @@ void piglit_set_timeout(double seconds, enum piglit_result timeout_result); void piglit_report_subtest_result(enum piglit_result result, const char *format, ...) PRINTFLIKE(2, 3); -void piglit_disable_error_message_boxes(void); +void piglit_general_init(void); extern void piglit_set_rlimit(unsigned long lim); -- 1.9.1 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH] util: call fflush() after printf() calls
On 06/07/2017 12:03 PM, Eric Anholt wrote: Brian Paulwrites: Otherwise, on Windows, we don't see the printf() output until the program exits. That's fine with the -auto option, but a problem w/out -auto. That's pretty broken. Actually, I think it's allowed behavior. Could we just wrap printf/fprintf on windows to call down and then fflush(), instead of doing it in all the callers? You've hit the most commonly-called printf callers, but I don't want to have to do this in all the tests, too. I think I can work around this with setvbuf() to disable buffering. New patch coming. -Brian ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH] util: call fflush() after printf() calls
Reviewed-by: Charmaine LeeFrom: Brian Paul Sent: Wednesday, June 7, 2017 8:51:52 AM To: piglit@lists.freedesktop.org Cc: Charmaine Lee; Neha Bhende; Brian Paul Subject: [PATCH] util: call fflush() after printf() calls Otherwise, on Windows, we don't see the printf() output until the program exits. That's fine with the -auto option, but a problem w/out -auto. --- tests/util/piglit-util-gl.c | 21 + 1 file changed, 21 insertions(+) diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c index 5ff13fe..f5734d9 100644 --- a/tests/util/piglit-util-gl.c +++ b/tests/util/piglit-util-gl.c @@ -1169,6 +1169,7 @@ piglit_probe_pixel_rgb(int x, int y, const float* expected) printf("Probe color at (%i,%i)\n", x, y); printf(" Expected: %f %f %f\n", expected[0], expected[1], expected[2]); printf(" Observed: %f %f %f\n", probe[0], probe[1], probe[2]); + fflush(stdout); return 0; } @@ -1199,6 +1200,7 @@ piglit_probe_pixel_rgba(int x, int y, const float* expected) printf("Probe color at (%i,%i)\n", x, y); printf(" Expected: %f %f %f %f\n", expected[0], expected[1], expected[2], expected[3]); printf(" Observed: %f %f %f %f\n", probe[0], probe[1], probe[2], probe[3]); + fflush(stdout); return 0; } @@ -1259,6 +1261,7 @@ piglit_probe_rect_ubyte(int x, int y, int w, int h, int num_components, printf(" Observed: %u %u %u\n", probe[0], probe[1], probe[2]); } + fflush(stdout); } free(pixels); return false; @@ -1321,6 +1324,7 @@ piglit_probe_rect_r_ubyte(int x, int y, int w, int h, GLubyte expected) printf("Probe color at (%i,%i)\n", x+i, y+j); printf(" Expected: %u\n", expected); printf(" Observed: %u\n", probe); + fflush(stdout); free(pixels); return 0; @@ -1355,6 +1359,7 @@ piglit_probe_rect_rgb(int x, int y, int w, int h, const float *expected) expected[0], expected[1], expected[2]); printf(" Observed: %f %f %f\n", probe[0], probe[1], probe[2]); + fflush(stdout); free(pixels); return 0; @@ -1425,6 +1430,7 @@ piglit_probe_rect_rgba(int x, int y, int w, int h, const float *expected) expected[0], expected[1], expected[2], expected[3]); printf(" Observed: %f %f %f %f\n", probe[0], probe[1], probe[2], probe[3]); + fflush(stdout); free(pixels); return 0; @@ -1457,6 +1463,7 @@ piglit_probe_rect_rgba_int(int x, int y, int w, int h, const int *expected) expected[0], expected[1], expected[2], expected[3]); printf(" Observed: %d %d %d %d\n", probe[0], probe[1], probe[2], probe[3]); + fflush(stdout); free(pixels); return 0; @@ -1490,6 +1497,7 @@ piglit_probe_rect_rgba_uint(int x, int y, int w, int h, expected[0], expected[1], expected[2], expected[3]); printf(" Observed: %u %u %u %u\n", probe[0], probe[1], probe[2], probe[3]); + fflush(stdout); free(pixels); return 0; @@ -1685,6 +1693,7 @@ piglit_compare_images_ubyte(int x, int y, int w, int h, printf("Probe at (%i,%i)\n", x+i, y+j); printf(" Expected: %d\n", expected); printf(" Observed: %d\n", probe); + fflush(stdout); return 0; } @@ -1858,6 +1867,7 @@ int piglit_probe_texel_rect_rgb(int target, int level, int x, int y,
Re: [Piglit] [PATCH] util: call fflush() after printf() calls
Looks good. Reviewed-by: Neha BhendeRegards, Neha From: Brian Paul Sent: Wednesday, June 7, 2017 8:51:52 AM To: piglit@lists.freedesktop.org Cc: Charmaine Lee; Neha Bhende; Brian Paul Subject: [PATCH] util: call fflush() after printf() calls Otherwise, on Windows, we don't see the printf() output until the program exits. That's fine with the -auto option, but a problem w/out -auto. --- tests/util/piglit-util-gl.c | 21 + 1 file changed, 21 insertions(+) diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c index 5ff13fe..f5734d9 100644 --- a/tests/util/piglit-util-gl.c +++ b/tests/util/piglit-util-gl.c @@ -1169,6 +1169,7 @@ piglit_probe_pixel_rgb(int x, int y, const float* expected) printf("Probe color at (%i,%i)\n", x, y); printf(" Expected: %f %f %f\n", expected[0], expected[1], expected[2]); printf(" Observed: %f %f %f\n", probe[0], probe[1], probe[2]); + fflush(stdout); return 0; } @@ -1199,6 +1200,7 @@ piglit_probe_pixel_rgba(int x, int y, const float* expected) printf("Probe color at (%i,%i)\n", x, y); printf(" Expected: %f %f %f %f\n", expected[0], expected[1], expected[2], expected[3]); printf(" Observed: %f %f %f %f\n", probe[0], probe[1], probe[2], probe[3]); + fflush(stdout); return 0; } @@ -1259,6 +1261,7 @@ piglit_probe_rect_ubyte(int x, int y, int w, int h, int num_components, printf(" Observed: %u %u %u\n", probe[0], probe[1], probe[2]); } + fflush(stdout); } free(pixels); return false; @@ -1321,6 +1324,7 @@ piglit_probe_rect_r_ubyte(int x, int y, int w, int h, GLubyte expected) printf("Probe color at (%i,%i)\n", x+i, y+j); printf(" Expected: %u\n", expected); printf(" Observed: %u\n", probe); + fflush(stdout); free(pixels); return 0; @@ -1355,6 +1359,7 @@ piglit_probe_rect_rgb(int x, int y, int w, int h, const float *expected) expected[0], expected[1], expected[2]); printf(" Observed: %f %f %f\n", probe[0], probe[1], probe[2]); + fflush(stdout); free(pixels); return 0; @@ -1425,6 +1430,7 @@ piglit_probe_rect_rgba(int x, int y, int w, int h, const float *expected) expected[0], expected[1], expected[2], expected[3]); printf(" Observed: %f %f %f %f\n", probe[0], probe[1], probe[2], probe[3]); + fflush(stdout); free(pixels); return 0; @@ -1457,6 +1463,7 @@ piglit_probe_rect_rgba_int(int x, int y, int w, int h, const int *expected) expected[0], expected[1], expected[2], expected[3]); printf(" Observed: %d %d %d %d\n", probe[0], probe[1], probe[2], probe[3]); + fflush(stdout); free(pixels); return 0; @@ -1490,6 +1497,7 @@ piglit_probe_rect_rgba_uint(int x, int y, int w, int h, expected[0], expected[1], expected[2], expected[3]); printf(" Observed: %u %u %u %u\n", probe[0], probe[1], probe[2], probe[3]); + fflush(stdout); free(pixels); return 0; @@ -1685,6 +1693,7 @@ piglit_compare_images_ubyte(int x, int y, int w, int h, printf("Probe at (%i,%i)\n", x+i, y+j); printf(" Expected: %d\n", expected); printf(" Observed: %d\n", probe); + fflush(stdout); return 0; } @@ -1858,6 +1867,7 @@ int piglit_probe_texel_rect_rgb(int target, int level,
Re: [Piglit] [PATCH] util: call fflush() after printf() calls
Brian Paulwrites: > Otherwise, on Windows, we don't see the printf() output until the program > exits. That's fine with the -auto option, but a problem w/out -auto. That's pretty broken. Could we just wrap printf/fprintf on windows to call down and then fflush(), instead of doing it in all the callers? You've hit the most commonly-called printf callers, but I don't want to have to do this in all the tests, too. signature.asc Description: PGP signature ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH v5] CMake: define GBM_BO_MAP only when symbol is found
Pushed. Quoting Daniel Díaz Rodríguez (2017-06-07 07:14:22) > Ping. > > -- > ddiaz > > > On 30 May 2017 at 12:52, Dylan Bakerwrote: > > Quoting Daniel Díaz (2017-05-16 17:06:40) > >> gbm_bo_map() and _unmap() have been added recently to Mesa, > >> and this update may not have reached all implementations of > >> GBM, such as the one provided by Mali r6, where said > >> definitions can be found in the header file but not in the > >> library itself. This leads to errors like the following when > >> linking: > >> ../../../../lib/libpiglitutil_gl.so.0: undefined reference to > >> `gbm_bo_unmap' > >> ../../../../lib/libpiglitutil_gl.so.0: undefined reference to > >> `gbm_bo_map' > >> collect2: error: ld returned 1 exit status > >> make[2]: *** [bin/point-sprite] Error 1 > >> > >> Instead of relying on the header file, actually try to link > >> using that symbol to determine if PIGLIT_HAS_GBM_BO_MAP > >> should be defined. > >> > >> Signed-off-by: Daniel Díaz > >> Reviewed-by: Jan Vesely > >> --- > >> v2: Use CHECK_SYMBOL_EXISTS as suggested by Jan Vesely. > >> v3: Back to CHECK_FUNCTION_EXISTS. > >> v4: Use ${GBM_LIBRARIES} instead of 'gbm'. > >> v5: Add reviewed-by; hopefully final version. > >> > >> CMakeLists.txt | 5 +++-- > >> 1 file changed, 3 insertions(+), 2 deletions(-) > >> > >> diff --git a/CMakeLists.txt b/CMakeLists.txt > >> index a4ff99e..cc26fa8 100644 > >> --- a/CMakeLists.txt > >> +++ b/CMakeLists.txt > >> @@ -141,8 +141,9 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux") > >> if(GBM_FOUND) > >> set(PIGLIT_HAS_GBM True) > >> add_definitions(-DPIGLIT_HAS_GBM) > >> - if (GBM_VERSION VERSION_EQUAL "12.1" OR GBM_VERSION > >> VERSION_GREATER "12.1") > >> - set(PIGLIT_HAS_GBM_BO_MAP True) > >> + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} > >> ${GBM_LIBRARIES}) > >> + CHECK_FUNCTION_EXISTS(gbm_bo_map PIGLIT_HAS_GBM_BO_MAP) > >> + if (PIGLIT_HAS_GBM_BO_MAP) > >> add_definitions(-DPIGLIT_HAS_GBM_BO_MAP) > >> endif() > >> endif(GBM_FOUND) > >> -- > >> 1.9.1 > >> > > > > Sorry, I've been on vacation. I checked that this does still find > > GBM_BO_MAP on > > my system, and that it still compiles, > > > > Reviewed-by: Dylan Baker > ___ > Piglit mailing list > Piglit@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/piglit signature.asc Description: signature ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH] arb_bindless_texture: add new compiler tests for struct with image arrays
Reviewed-by: Nicolai HähnleOn 05.06.2017 16:34, Samuel Pitoiset wrote: ping? On 05/25/2017 08:02 PM, Samuel Pitoiset wrote: Signed-off-by: Samuel Pitoiset --- .../nested-struct-arrays-mismatch-format.frag | 27 .../nested-struct-with-arrays-no-qualifiers.frag | 29 ++ .../images/struct-with-arrays-mismatch-format.frag | 22 .../images/struct-with-arrays-no-qualifiers.frag | 24 ++ 4 files changed, 102 insertions(+) create mode 100644 tests/spec/arb_bindless_texture/compiler/images/nested-struct-arrays-mismatch-format.frag create mode 100644 tests/spec/arb_bindless_texture/compiler/images/nested-struct-with-arrays-no-qualifiers.frag create mode 100644 tests/spec/arb_bindless_texture/compiler/images/struct-with-arrays-mismatch-format.frag create mode 100644 tests/spec/arb_bindless_texture/compiler/images/struct-with-arrays-no-qualifiers.frag diff --git a/tests/spec/arb_bindless_texture/compiler/images/nested-struct-arrays-mismatch-format.frag b/tests/spec/arb_bindless_texture/compiler/images/nested-struct-arrays-mismatch-format.frag new file mode 100644 index 0..dfb518f80 --- /dev/null +++ b/tests/spec/arb_bindless_texture/compiler/images/nested-struct-arrays-mismatch-format.frag @@ -0,0 +1,27 @@ +// [config] +// expect_result: fail +// glsl_version: 3.30 +// require_extensions: GL_ARB_bindless_texture GL_ARB_shader_image_load_store +// [end config] + +#version 330 +#extension GL_ARB_bindless_texture: require +#extension GL_ARB_shader_image_load_store: enable +#extension GL_ARB_arrays_of_arrays: enable + +// From Section 4.4.6.2 (Format Layout Qualifiers) of the GLSL 4.50 spec: +// +// "It is a compile-time error to declare an image variable where the format +// qualifier does not match the image variable type." + +struct S_inner { +layout (r32i) image2D img; +}; + +struct { +S_inner si[2][2]; +} s; + +void main() +{ +} diff --git a/tests/spec/arb_bindless_texture/compiler/images/nested-struct-with-arrays-no-qualifiers.frag b/tests/spec/arb_bindless_texture/compiler/images/nested-struct-with-arrays-no-qualifiers.frag new file mode 100644 index 0..5fbec1386 --- /dev/null +++ b/tests/spec/arb_bindless_texture/compiler/images/nested-struct-with-arrays-no-qualifiers.frag @@ -0,0 +1,29 @@ +// [config] +// expect_result: fail +// glsl_version: 3.30 +// require_extensions: GL_ARB_bindless_texture GL_ARB_shader_image_load_store +// [end config] + +#version 330 +#extension GL_ARB_bindless_texture: require +#extension GL_ARB_shader_image_load_store: enable +#extension GL_ARB_arrays_of_arrays: enable + +// From Section 4.4.6.2 (Format Layout Qualifiers) of the GLSL 4.50 spec: +// +// "Uniforms not qualified with writeonly must have a format layout qualifier." +// +// Because GL_ARB_bindless_texture allows to declare images insides structures, +// this rule applies and this test should fail. + +struct S_inner { +image2D img; +}; + +struct { +S_inner si[2][2]; +} s; + +void main() +{ +} diff --git a/tests/spec/arb_bindless_texture/compiler/images/struct-with-arrays-mismatch-format.frag b/tests/spec/arb_bindless_texture/compiler/images/struct-with-arrays-mismatch-format.frag new file mode 100644 index 0..b9981de77 --- /dev/null +++ b/tests/spec/arb_bindless_texture/compiler/images/struct-with-arrays-mismatch-format.frag @@ -0,0 +1,22 @@ +// [config] +// expect_result: fail +// glsl_version: 3.30 +// require_extensions: GL_ARB_bindless_texture GL_ARB_shader_image_load_store +// [end config] + +#version 330 +#extension GL_ARB_bindless_texture: require +#extension GL_ARB_shader_image_load_store: enable + +// From Section 4.4.6.2 (Format Layout Qualifiers) of the GLSL 4.50 spec: +// +// "It is a compile-time error to declare an image variable where the format +// qualifier does not match the image variable type." + +struct { +layout (r32i) image2D imgs[6]; +} s; + +void main() +{ +} diff --git a/tests/spec/arb_bindless_texture/compiler/images/struct-with-arrays-no-qualifiers.frag b/tests/spec/arb_bindless_texture/compiler/images/struct-with-arrays-no-qualifiers.frag new file mode 100644 index 0..bb29340fb --- /dev/null +++ b/tests/spec/arb_bindless_texture/compiler/images/struct-with-arrays-no-qualifiers.frag @@ -0,0 +1,24 @@ +// [config] +// expect_result: fail +// glsl_version: 3.30 +// require_extensions: GL_ARB_bindless_texture GL_ARB_shader_image_load_store +// [end config] + +#version 330 +#extension GL_ARB_bindless_texture: require +#extension GL_ARB_shader_image_load_store: enable + +// From Section 4.4.6.2 (Format Layout Qualifiers) of the GLSL 4.50 spec: +// +// "Uniforms not qualified with writeonly must have a format layout qualifier." +// +// Because GL_ARB_bindless_texture allows to declare images insides structures, +//
[Piglit] [PATCH] util: call fflush() after printf() calls
Otherwise, on Windows, we don't see the printf() output until the program exits. That's fine with the -auto option, but a problem w/out -auto. --- tests/util/piglit-util-gl.c | 21 + 1 file changed, 21 insertions(+) diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c index 5ff13fe..f5734d9 100644 --- a/tests/util/piglit-util-gl.c +++ b/tests/util/piglit-util-gl.c @@ -1169,6 +1169,7 @@ piglit_probe_pixel_rgb(int x, int y, const float* expected) printf("Probe color at (%i,%i)\n", x, y); printf(" Expected: %f %f %f\n", expected[0], expected[1], expected[2]); printf(" Observed: %f %f %f\n", probe[0], probe[1], probe[2]); + fflush(stdout); return 0; } @@ -1199,6 +1200,7 @@ piglit_probe_pixel_rgba(int x, int y, const float* expected) printf("Probe color at (%i,%i)\n", x, y); printf(" Expected: %f %f %f %f\n", expected[0], expected[1], expected[2], expected[3]); printf(" Observed: %f %f %f %f\n", probe[0], probe[1], probe[2], probe[3]); + fflush(stdout); return 0; } @@ -1259,6 +1261,7 @@ piglit_probe_rect_ubyte(int x, int y, int w, int h, int num_components, printf(" Observed: %u %u %u\n", probe[0], probe[1], probe[2]); } + fflush(stdout); } free(pixels); return false; @@ -1321,6 +1324,7 @@ piglit_probe_rect_r_ubyte(int x, int y, int w, int h, GLubyte expected) printf("Probe color at (%i,%i)\n", x+i, y+j); printf(" Expected: %u\n", expected); printf(" Observed: %u\n", probe); + fflush(stdout); free(pixels); return 0; @@ -1355,6 +1359,7 @@ piglit_probe_rect_rgb(int x, int y, int w, int h, const float *expected) expected[0], expected[1], expected[2]); printf(" Observed: %f %f %f\n", probe[0], probe[1], probe[2]); + fflush(stdout); free(pixels); return 0; @@ -1425,6 +1430,7 @@ piglit_probe_rect_rgba(int x, int y, int w, int h, const float *expected) expected[0], expected[1], expected[2], expected[3]); printf(" Observed: %f %f %f %f\n", probe[0], probe[1], probe[2], probe[3]); + fflush(stdout); free(pixels); return 0; @@ -1457,6 +1463,7 @@ piglit_probe_rect_rgba_int(int x, int y, int w, int h, const int *expected) expected[0], expected[1], expected[2], expected[3]); printf(" Observed: %d %d %d %d\n", probe[0], probe[1], probe[2], probe[3]); + fflush(stdout); free(pixels); return 0; @@ -1490,6 +1497,7 @@ piglit_probe_rect_rgba_uint(int x, int y, int w, int h, expected[0], expected[1], expected[2], expected[3]); printf(" Observed: %u %u %u %u\n", probe[0], probe[1], probe[2], probe[3]); + fflush(stdout); free(pixels); return 0; @@ -1685,6 +1693,7 @@ piglit_compare_images_ubyte(int x, int y, int w, int h, printf("Probe at (%i,%i)\n", x+i, y+j); printf(" Expected: %d\n", expected); printf(" Observed: %d\n", probe); + fflush(stdout); return 0; } @@ -1858,6 +1867,7 @@ int piglit_probe_texel_rect_rgb(int target, int level, int x, int y, expected[0], expected[1], expected[2]); printf(" Observed: %f %f %f\n", probe[0], probe[1], probe[2]); + fflush(stdout);