This looks good to me:<div><br></div><div>Reviewed-by: Robert Bragg <<a href="mailto:robert@linux.intel.com">robert@linux.intel.com</a>></div><div><br></div><div>thanks,</div><div>- Robert</div><br><div class="gmail_quote">
On Fri, Nov 9, 2012 at 4:56 PM, Neil Roberts <span dir="ltr"><<a href="mailto:neil@linux.intel.com" target="_blank">neil@linux.intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Previously when make test is run it would say ‘fail’ in lower case<br>
letters for both tests that are known bugs we need to fix and for<br>
drivers that can't run the test. This makes it too easy to lose track<br>
of bugs.<br>
<br>
To fix this, the ADD_TEST macro has now been changed to take two sets<br>
of flags instead of just one. The first specifies the requirements for<br>
the test to run at all. The second specifies the set of flags required<br>
to run without any known failures. The table in the test report now<br>
says ‘n/a’ instead of ‘fail’ for tests that don't match the feature<br>
requirements.<br>
---<br>
tests/conform/run-tests.sh | 16 +++++-<br>
tests/conform/test-conform-main.c | 93 ++++++++++++++++----------------<br>
tests/conform/test-utils.c | 108 +++++++++++++++++++++-----------------<br>
tests/conform/test-utils.h | 3 +-<br>
4 files changed, 126 insertions(+), 94 deletions(-)<br>
<br>
diff --git a/tests/conform/run-tests.sh b/tests/conform/run-tests.sh<br>
index 266f1c6..11e740a 100755<br>
--- a/tests/conform/run-tests.sh<br>
+++ b/tests/conform/run-tests.sh<br>
@@ -10,7 +10,8 @@ trap "" SIGFPE<br>
trap "" SIGSEGV<br>
<br>
EXIT=0<br>
-WARNING="WARNING: Missing required feature";<br>
+MISSING_FEATURE="WARNING: Missing required feature";<br>
+KNOWN_FAILURE="WARNING: Test is known to fail";<br>
<br>
if test -f ./test-conformance; then<br>
TEST_CONFORMANCE=./test-conformance<br>
@@ -20,6 +21,7 @@ fi<br>
<br>
echo "Key:"<br>
echo "ok = Test passed"<br>
+echo "n/a = Driver is missing a feature required for the test"<br>
echo "FAIL = Unexpected failure"<br>
echo "fail = Test failed, but it was an expected failure"<br>
echo "PASS! = Unexpected pass"<br>
@@ -38,6 +40,10 @@ get_status()<br>
400)<br>
echo -n 'PASS!';;<br>
<br>
+ # Special value to indicate the test is missing a required feature<br>
+ 500)<br>
+ echo -n "n/a";;<br>
+<br>
0)<br>
echo -n "ok";;<br>
<br>
@@ -52,7 +58,13 @@ run_test()<br>
TMP=$?<br>
var_name=$2_result<br>
eval $var_name=$TMP<br>
- if grep -q "$WARNING" .log; then<br>
+ if grep -q "$MISSING_FEATURE" .log; then<br>
+ if test $TMP -ne 0; then<br>
+ eval $var_name=500<br>
+ else<br>
+ eval $var_name=400<br>
+ fi<br>
+ elif grep -q "$KNOWN_FAILURE" .log; then<br>
if test $TMP -ne 0; then<br>
eval $var_name=300<br>
else<br>
diff --git a/tests/conform/test-conform-main.c b/tests/conform/test-conform-main.c<br>
index 4e2c8bb..b510543 100644<br>
--- a/tests/conform/test-conform-main.c<br>
+++ b/tests/conform/test-conform-main.c<br>
@@ -10,16 +10,17 @@<br>
#include "test-utils.h"<br>
<br>
/* A bit of sugar for adding new conformance tests */<br>
-#define ADD_TEST(FUNC, REQUIREMENTS) G_STMT_START { \<br>
- extern void FUNC (void); \<br>
- if (strcmp (#FUNC, argv[1]) == 0) \<br>
- { \<br>
- test_utils_init (REQUIREMENTS); \<br>
- FUNC (); \<br>
- test_utils_fini (); \<br>
- exit (0); \<br>
- } \<br>
-} G_STMT_END<br>
+#define ADD_TEST(FUNC, REQUIREMENTS, KNOWN_FAIL_REQUIREMENTS) \<br>
+ G_STMT_START { \<br>
+ extern void FUNC (void); \<br>
+ if (strcmp (#FUNC, argv[1]) == 0) \<br>
+ { \<br>
+ test_utils_init (REQUIREMENTS, KNOWN_FAIL_REQUIREMENTS); \<br>
+ FUNC (); \<br>
+ test_utils_fini (); \<br>
+ exit (0); \<br>
+ } \<br>
+ } G_STMT_END<br>
<br>
#define UNPORTED_TEST(FUNC)<br>
<br>
@@ -51,66 +52,70 @@ main (int argc, char **argv)<br>
UNPORTED_TEST (test_object);<br>
UNPORTED_TEST (test_fixed);<br>
UNPORTED_TEST (test_materials);<br>
- ADD_TEST (test_pipeline_user_matrix, 0);<br>
- ADD_TEST (test_blend_strings, 0);<br>
- ADD_TEST (test_premult, 0);<br>
+ ADD_TEST (test_pipeline_user_matrix, 0, 0);<br>
+ ADD_TEST (test_blend_strings, 0, 0);<br>
+ ADD_TEST (test_premult, 0, 0);<br>
UNPORTED_TEST (test_readpixels);<br>
- ADD_TEST (test_path, 0);<br>
- ADD_TEST (test_depth_test, 0);<br>
- ADD_TEST (test_color_mask, 0);<br>
- ADD_TEST (test_backface_culling, TEST_REQUIREMENT_NPOT);<br>
- ADD_TEST (test_layer_remove, 0);<br>
+ ADD_TEST (test_path, 0, 0);<br>
+ ADD_TEST (test_depth_test, 0, 0);<br>
+ ADD_TEST (test_color_mask, 0, 0);<br>
+ ADD_TEST (test_backface_culling, 0, TEST_REQUIREMENT_NPOT);<br>
+ ADD_TEST (test_layer_remove, 0, 0);<br>
<br>
- ADD_TEST (test_sparse_pipeline, 0);<br>
+ ADD_TEST (test_sparse_pipeline, 0, 0);<br>
<br>
- ADD_TEST (test_npot_texture, TEST_REQUIREMENT_NPOT);<br>
+ ADD_TEST (test_npot_texture, 0, TEST_REQUIREMENT_NPOT);<br>
UNPORTED_TEST (test_multitexture);<br>
UNPORTED_TEST (test_texture_mipmaps);<br>
- ADD_TEST (test_sub_texture, 0);<br>
- ADD_TEST (test_pixel_buffer, 0);<br>
+ ADD_TEST (test_sub_texture, 0, 0);<br>
+ ADD_TEST (test_pixel_buffer, 0, 0);<br>
UNPORTED_TEST (test_texture_rectangle);<br>
- ADD_TEST (test_texture_3d, TEST_REQUIREMENT_TEXTURE_3D);<br>
- ADD_TEST (test_wrap_modes, 0);<br>
+ ADD_TEST (test_texture_3d, TEST_REQUIREMENT_TEXTURE_3D, 0);<br>
+ ADD_TEST (test_wrap_modes, 0, 0);<br>
UNPORTED_TEST (test_texture_pixmap_x11);<br>
UNPORTED_TEST (test_texture_get_set_data);<br>
- ADD_TEST (test_atlas_migration, 0);<br>
- ADD_TEST (test_read_texture_formats, 0);<br>
- ADD_TEST (test_write_texture_formats, 0);<br>
+ ADD_TEST (test_atlas_migration, 0, 0);<br>
+ ADD_TEST (test_read_texture_formats, 0, 0);<br>
+ ADD_TEST (test_write_texture_formats, 0, 0);<br>
<br>
UNPORTED_TEST (test_vertex_buffer_contiguous);<br>
UNPORTED_TEST (test_vertex_buffer_interleved);<br>
UNPORTED_TEST (test_vertex_buffer_mutability);<br>
<br>
- ADD_TEST (test_primitive, 0);<br>
+ ADD_TEST (test_primitive, 0, 0);<br>
<br>
- ADD_TEST (test_just_vertex_shader, TEST_REQUIREMENT_GLSL);<br>
- ADD_TEST (test_pipeline_uniforms, TEST_REQUIREMENT_GLSL);<br>
- ADD_TEST (test_snippets, TEST_REQUIREMENT_GLSL);<br>
- ADD_TEST (test_custom_attributes, TEST_REQUIREMENT_GLSL);<br>
+ ADD_TEST (test_just_vertex_shader, TEST_REQUIREMENT_GLSL, 0);<br>
+ ADD_TEST (test_pipeline_uniforms, TEST_REQUIREMENT_GLSL, 0);<br>
+ ADD_TEST (test_snippets, TEST_REQUIREMENT_GLSL, 0);<br>
+ ADD_TEST (test_custom_attributes, TEST_REQUIREMENT_GLSL, 0);<br>
<br>
- ADD_TEST (test_bitmask, 0);<br>
+ ADD_TEST (test_bitmask, 0, 0);<br>
<br>
- ADD_TEST (test_offscreen, 0);<br>
+ ADD_TEST (test_offscreen, 0, 0);<br>
<br>
- ADD_TEST (test_point_size, 0);<br>
+ ADD_TEST (test_point_size, 0, 0);<br>
ADD_TEST (test_point_sprite,<br>
- TEST_REQUIREMENT_POINT_SPRITE);<br>
+ TEST_REQUIREMENT_POINT_SPRITE,<br>
+ 0);<br>
ADD_TEST (test_point_sprite_orientation,<br>
- TEST_KNOWN_FAILURE | TEST_REQUIREMENT_POINT_SPRITE);<br>
+ TEST_REQUIREMENT_POINT_SPRITE,<br>
+ TEST_KNOWN_FAILURE);<br>
<br>
- ADD_TEST (test_version, 0);<br>
+ ADD_TEST (test_version, 0, 0);<br>
<br>
- ADD_TEST (test_alpha_test, 0);<br>
+ ADD_TEST (test_alpha_test, 0, 0);<br>
<br>
- ADD_TEST (test_map_buffer_range, TEST_REQUIREMENT_MAP_WRITE);<br>
+ ADD_TEST (test_map_buffer_range, TEST_REQUIREMENT_MAP_WRITE, 0);<br>
<br>
UNPORTED_TEST (test_viewport);<br>
<br>
- ADD_TEST (test_gles2_context, TEST_REQUIREMENT_GLES2_CONTEXT);<br>
- ADD_TEST (test_gles2_context_fbo, TEST_REQUIREMENT_GLES2_CONTEXT);<br>
- ADD_TEST (test_gles2_context_copy_tex_image, TEST_REQUIREMENT_GLES2_CONTEXT);<br>
+ ADD_TEST (test_gles2_context, TEST_REQUIREMENT_GLES2_CONTEXT, 0);<br>
+ ADD_TEST (test_gles2_context_fbo, TEST_REQUIREMENT_GLES2_CONTEXT, 0);<br>
+ ADD_TEST (test_gles2_context_copy_tex_image,<br>
+ TEST_REQUIREMENT_GLES2_CONTEXT,<br>
+ 0);<br>
<br>
- ADD_TEST (test_euler_quaternion, 0);<br>
+ ADD_TEST (test_euler_quaternion, 0, 0);<br>
<br>
g_printerr ("Unknown test name \"%s\"\n", argv[1]);<br>
<br>
diff --git a/tests/conform/test-utils.c b/tests/conform/test-utils.c<br>
index 4ee0856..2173cd0 100644<br>
--- a/tests/conform/test-utils.c<br>
+++ b/tests/conform/test-utils.c<br>
@@ -11,94 +11,106 @@ static CoglBool cogl_test_is_verbose;<br>
CoglContext *test_ctx;<br>
CoglFramebuffer *test_fb;<br>
<br>
-void<br>
-test_utils_init (TestFlags flags)<br>
+static CoglBool<br>
+check_flags (TestFlags flags,<br>
+ CoglRenderer *renderer)<br>
{<br>
- static int counter = 0;<br>
- CoglError *error = NULL;<br>
- CoglOnscreen *onscreen = NULL;<br>
- CoglDisplay *display;<br>
- CoglRenderer *renderer;<br>
- CoglBool missing_requirement = FALSE;<br>
-<br>
- if (counter != 0)<br>
- g_critical ("We don't support running more than one test at a time\n"<br>
- "in a single test run due to the state leakage that can\n"<br>
- "cause subsequent tests to fail.\n"<br>
- "\n"<br>
- "If you want to run all the tests you should run\n"<br>
- "$ make test-report");<br>
- counter++;<br>
-<br>
- if (g_getenv ("COGL_TEST_VERBOSE") || g_getenv ("V"))<br>
- cogl_test_is_verbose = TRUE;<br>
-<br>
- if (g_getenv ("G_DEBUG"))<br>
- {<br>
- char *debug = g_strconcat (g_getenv ("G_DEBUG"), ",fatal-warnings", NULL);<br>
- g_setenv ("G_DEBUG", debug, TRUE);<br>
- g_free (debug);<br>
- }<br>
- else<br>
- g_setenv ("G_DEBUG", "fatal-warnings", TRUE);<br>
-<br>
- g_setenv ("COGL_X11_SYNC", "1", 0);<br>
-<br>
- test_ctx = cogl_context_new (NULL, &error);<br>
- if (!test_ctx)<br>
- g_critical ("Failed to create a CoglContext: %s", error->message);<br>
-<br>
- display = cogl_context_get_display (test_ctx);<br>
- renderer = cogl_display_get_renderer (display);<br>
-<br>
if (flags & TEST_REQUIREMENT_GL &&<br>
cogl_renderer_get_driver (renderer) != COGL_DRIVER_GL &&<br>
cogl_renderer_get_driver (renderer) != COGL_DRIVER_GL3)<br>
{<br>
- missing_requirement = TRUE;<br>
+ return FALSE;<br>
}<br>
<br>
if (flags & TEST_REQUIREMENT_NPOT &&<br>
!cogl_has_feature (test_ctx, COGL_FEATURE_ID_TEXTURE_NPOT))<br>
{<br>
- missing_requirement = TRUE;<br>
+ return FALSE;<br>
}<br>
<br>
if (flags & TEST_REQUIREMENT_TEXTURE_3D &&<br>
!cogl_has_feature (test_ctx, COGL_FEATURE_ID_TEXTURE_3D))<br>
{<br>
- missing_requirement = TRUE;<br>
+ return FALSE;<br>
}<br>
<br>
if (flags & TEST_REQUIREMENT_POINT_SPRITE &&<br>
!cogl_has_feature (test_ctx, COGL_FEATURE_ID_POINT_SPRITE))<br>
{<br>
- missing_requirement = TRUE;<br>
+ return FALSE;<br>
}<br>
<br>
if (flags & TEST_REQUIREMENT_GLES2_CONTEXT &&<br>
!cogl_has_feature (test_ctx, COGL_FEATURE_ID_GLES2_CONTEXT))<br>
{<br>
- missing_requirement = TRUE;<br>
+ return FALSE;<br>
}<br>
<br>
if (flags & TEST_REQUIREMENT_MAP_WRITE &&<br>
!cogl_has_feature (test_ctx, COGL_FEATURE_ID_MAP_BUFFER_FOR_WRITE))<br>
{<br>
- missing_requirement = TRUE;<br>
+ return FALSE;<br>
}<br>
<br>
if (flags & TEST_REQUIREMENT_GLSL &&<br>
!cogl_has_feature (test_ctx, COGL_FEATURE_ID_GLSL))<br>
{<br>
- missing_requirement = TRUE;<br>
+ return FALSE;<br>
}<br>
<br>
if (flags & TEST_KNOWN_FAILURE)<br>
{<br>
- missing_requirement = TRUE;<br>
+ return FALSE;<br>
}<br>
<br>
+ return TRUE;<br>
+}<br>
+<br>
+void<br>
+test_utils_init (TestFlags requirement_flags,<br>
+ TestFlags known_failure_flags)<br>
+{<br>
+ static int counter = 0;<br>
+ CoglError *error = NULL;<br>
+ CoglOnscreen *onscreen = NULL;<br>
+ CoglDisplay *display;<br>
+ CoglRenderer *renderer;<br>
+ CoglBool missing_requirement;<br>
+ CoglBool known_failure;<br>
+<br>
+ if (counter != 0)<br>
+ g_critical ("We don't support running more than one test at a time\n"<br>
+ "in a single test run due to the state leakage that can\n"<br>
+ "cause subsequent tests to fail.\n"<br>
+ "\n"<br>
+ "If you want to run all the tests you should run\n"<br>
+ "$ make test-report");<br>
+ counter++;<br>
+<br>
+ if (g_getenv ("COGL_TEST_VERBOSE") || g_getenv ("V"))<br>
+ cogl_test_is_verbose = TRUE;<br>
+<br>
+ if (g_getenv ("G_DEBUG"))<br>
+ {<br>
+ char *debug = g_strconcat (g_getenv ("G_DEBUG"), ",fatal-warnings", NULL);<br>
+ g_setenv ("G_DEBUG", debug, TRUE);<br>
+ g_free (debug);<br>
+ }<br>
+ else<br>
+ g_setenv ("G_DEBUG", "fatal-warnings", TRUE);<br>
+<br>
+ g_setenv ("COGL_X11_SYNC", "1", 0);<br>
+<br>
+ test_ctx = cogl_context_new (NULL, &error);<br>
+ if (!test_ctx)<br>
+ g_critical ("Failed to create a CoglContext: %s", error->message);<br>
+<br>
+ display = cogl_context_get_display (test_ctx);<br>
+ renderer = cogl_display_get_renderer (display);<br>
+<br>
+ missing_requirement = !check_flags (requirement_flags, renderer);<br>
+ known_failure = !check_flags (known_failure_flags, renderer);<br>
+<br>
if (getenv ("COGL_TEST_ONSCREEN"))<br>
{<br>
onscreen = cogl_onscreen_new (test_ctx, 640, 480);<br>
@@ -132,6 +144,8 @@ test_utils_init (TestFlags flags)<br>
<br>
if (missing_requirement)<br>
g_print ("WARNING: Missing required feature[s] for this test\n");<br>
+ else if (known_failure)<br>
+ g_print ("WARNING: Test is known to fail\n");<br>
}<br>
<br>
void<br>
diff --git a/tests/conform/test-utils.h b/tests/conform/test-utils.h<br>
index acd4fad..265dc32 100644<br>
--- a/tests/conform/test-utils.h<br>
+++ b/tests/conform/test-utils.h<br>
@@ -23,7 +23,8 @@ extern CoglContext *test_ctx;<br>
extern CoglFramebuffer *test_fb;<br>
<br>
void<br>
-test_utils_init (TestFlags flags);<br>
+test_utils_init (TestFlags requirement_flags,<br>
+ TestFlags known_failure_flags);<br>
<br>
void<br>
test_utils_fini (void);<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.7.11.3.g3c3efa5<br>
<br>
_______________________________________________<br>
Cogl mailing list<br>
<a href="mailto:Cogl@lists.freedesktop.org">Cogl@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/cogl" target="_blank">http://lists.freedesktop.org/mailman/listinfo/cogl</a><br>
</font></span></blockquote></div><br>