[cairo-commit] cairo/test cairo-test.c, 1.39, 1.40 cairo-test.h, 1.10, 1.11

Carl Worth commit at pdx.freedesktop.org
Thu Jul 14 12:20:47 PDT 2005


Committed by: cworth

Update of /cvs/cairo/cairo/test
In directory gabe:/tmp/cvs-serv15336/test

Modified Files:
	cairo-test.c cairo-test.h 
Log Message:

        * test/cairo-test.c: (cairo_test_for_target), (cairo_test_real):
        * test/cairo-test.h: Don't consider a test to fail if it can't
        create a surface at all (eg. no X server is available). Instead
        mark this backend as untested and only consider the overall test a
        success if all tested backend are successful.


Index: cairo-test.c
===================================================================
RCS file: /cvs/cairo/cairo/test/cairo-test.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- cairo-test.c	14 Jul 2005 18:11:15 -0000	1.39
+++ cairo-test.c	14 Jul 2005 19:20:42 -0000	1.40
@@ -421,7 +421,7 @@
 					       &target->closure);
     if (surface == NULL) {
 	cairo_test_log ("Error: Failed to set %s target\n", target->name);
-	ret = CAIRO_TEST_FAILURE;
+	ret = CAIRO_TEST_UNTESTED;
 	goto UNWIND_STRINGS;
     }
 
@@ -517,19 +517,40 @@
     }
     free (log_name);
 
-    ret = CAIRO_TEST_SUCCESS;
+    /* The intended logic here is that we return overall SUCCESS
+     * iff. all tested backends return SUCCESS. In other words:
+     *
+     *	if      any backend FAILURE
+     *		-> FAILURE
+     *	else if all backends UNTESTED
+     *		-> FAILURE
+     *	else    (== some backend SUCCESS)
+     *		-> SUCCESS
+     */
+    ret = CAIRO_TEST_UNTESTED;
     for (i=0; i < sizeof(targets)/sizeof(targets[0]); i++) {
 	cairo_test_target_t *target = &targets[i];
 	cairo_test_log ("Testing %s with %s target\n", test->name, target->name);
 	printf ("%s-%s:\t", test->name, target->name);
 	status = cairo_test_for_target (test, draw, target);
-	if (status) {
+	switch (status) {
+	case CAIRO_TEST_SUCCESS:
+	    printf ("PASS\n");
+	    if (ret == CAIRO_TEST_UNTESTED)
+		ret = CAIRO_TEST_SUCCESS;
+	    break;
+	case CAIRO_TEST_UNTESTED:
+	    printf ("UNTESTED\n");
+	    break;
+	default:
+	case CAIRO_TEST_FAILURE:
 	    printf ("FAIL\n");
 	    ret = status;
-	} else {
-	    printf ("PASS\n");
+	    break;
 	}
     }
+    if (ret == CAIRO_TEST_UNTESTED)
+	ret = CAIRO_TEST_FAILURE;
 
     fclose (cairo_test_log_file);
 

Index: cairo-test.h
===================================================================
RCS file: /cvs/cairo/cairo/test/cairo-test.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- cairo-test.h	14 May 2005 21:01:46 -0000	1.10
+++ cairo-test.h	14 Jul 2005 19:20:42 -0000	1.11
@@ -31,7 +31,8 @@
 
 typedef enum cairo_test_status {
     CAIRO_TEST_SUCCESS = 0,
-    CAIRO_TEST_FAILURE
+    CAIRO_TEST_FAILURE,
+    CAIRO_TEST_UNTESTED
 } cairo_test_status_t;
 
 typedef struct cairo_test {




More information about the cairo-commit mailing list