You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2012/05/24 13:53:58 UTC

svn commit: r1342208 - /subversion/trunk/subversion/tests/libsvn_wc/wc-queries-test.c

Author: rhuijben
Date: Thu May 24 11:53:57 2012
New Revision: 1342208

URL: http://svn.apache.org/viewvc?rev=1342208&view=rev
Log:
Provide the Sqlite query plan as part of the error message, to avoid having
to install all kinds of Sqlite versions when problems are reported.

* subversion/tests/libsvn_wc/wc-queries-test.c
  (test_query_expectations): Store the already copied rows in an array and
    add them to created warnings.

Modified:
    subversion/trunk/subversion/tests/libsvn_wc/wc-queries-test.c

Modified: subversion/trunk/subversion/tests/libsvn_wc/wc-queries-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/wc-queries-test.c?rev=1342208&r1=1342207&r2=1342208&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/wc-queries-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/wc-queries-test.c Thu May 24 11:53:57 2012
@@ -563,6 +563,7 @@ test_query_expectations(apr_pool_t *scra
       const char *tail;
       int r;
       svn_boolean_t warned = FALSE;
+      apr_array_header_t *rows = NULL;
 
       if (is_schema_statement(i))
         continue;
@@ -611,8 +612,13 @@ test_query_expectations(apr_pool_t *scra
           if (! zDetail)
             continue;
 
+		  if (!rows)
+			rows = apr_array_make(iterpool, 10, sizeof(const char*));
+
           detail = apr_pstrdup(iterpool, (const char*)zDetail);
 
+		  APR_ARRAY_PUSH(rows, const char *) = detail;
+
           SVN_ERR(parse_explanation_item(&item, detail, iterpool));
 
           if (!item)
@@ -671,7 +677,7 @@ test_query_expectations(apr_pool_t *scra
               warned = TRUE;
               if (!is_slow_statement(i))
                 warnings = svn_error_createf(SVN_ERR_TEST_FAILED, warnings,
-                                "Query %s: Creates a temporary B-TREE:\n",
+                                "Query %s: Creates a temporary B-TREE:\n%s",
                                 wc_query_info[i][0], wc_queries[i]);
             }
         }
@@ -679,8 +685,23 @@ test_query_expectations(apr_pool_t *scra
       SQLITE_ERR(sqlite3_finalize(stmt));
 
       if (!warned && is_slow_statement(i))
-        printf("DBG: Expected %s to be reported as slow, but it wasn't\n",
-               wc_query_info[i][0]);
+        {
+          printf("DBG: Expected %s to be reported as slow, but it wasn't\n",
+                 wc_query_info[i][0]);
+        }
+
+      if (rows && warned != is_slow_statement(i))
+        {
+          int w;
+          svn_error_t *info = NULL;
+          for (w = rows->nelts-1; w >= 0; w--)
+            {
+              info = svn_error_createf(SVN_ERR_SQLITE_CONSTRAINT, info,
+                                       "|%s", APR_ARRAY_IDX(rows, w, const char*));
+            }
+
+          warnings = svn_error_compose_create(warnings, info);
+        }
     }
   SQLITE_ERR(sqlite3_close(sdb)); /* Close the DB if ok; otherwise leaked */