Author: rhuijben
Date: Wed Feb 18 10:46:51 2015
New Revision: 1660587

URL: http://svn.apache.org/r1660587
Log:
Fix more cases where the direct db operations in the C tests create nonstandard
db instances.

* subversion/libsvn_wc/wc-checks.sql
  (STMT_STATIC_VERIFY): Extend tests.

* subversion/tests/libsvn_wc/db-test.c
  (TESTING_DATA): Give present directories a depth and remove pristine data
    from local additions that aren't copies.

* subversion/tests/libsvn_wc/entries-compat.c
  (TESTING_DATA): Give present directories a depth; files a checksum and
    remove pristine data from local additions.

* subversion/tests/libsvn_wc/op-depth-test.c
  (insert_actual): When turning a directory in a file, really make it a file.

* subversion/tests/libsvn_wc/wc-queries-test.c
  (test_verify_parsable): New function, verifying the check statements.
  (test_funcs): Add test_verify_parsable.

* subversion/tests/libsvn_wc/wc-test-queries.sql
  (STMT_ENSURE_EMPTY_PRISTINE): New statement.
  (STMT_NODES_SET_FILE): Set checksum, remove depth.

Modified:
    subversion/trunk/subversion/libsvn_wc/wc-checks.sql
    subversion/trunk/subversion/tests/libsvn_wc/db-test.c
    subversion/trunk/subversion/tests/libsvn_wc/entries-compat.c
    subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c
    subversion/trunk/subversion/tests/libsvn_wc/wc-queries-test.c
    subversion/trunk/subversion/tests/libsvn_wc/wc-test-queries.sql

Modified: subversion/trunk/subversion/libsvn_wc/wc-checks.sql
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-checks.sql?rev=1660587&r1=1660586&r2=1660587&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-checks.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-checks.sql Wed Feb 18 10:46:51 2015
@@ -134,4 +134,24 @@ FROM nodes
 WHERE presence IN (MAP_BASE_DELETED)
 AND (repos_id IS NOT NULL
      OR repos_path IS NOT NULL
-     OR revision IS NOT NULL)
\ No newline at end of file
+     OR revision IS NOT NULL)
+
+UNION ALL
+
+SELECT local_relpath, op_depth, 'SV006: Kind specific data invalid on normal'
+FROM nodes
+WHERE presence IN (MAP_NORMAL, MAP_INCOMPLETE)
+AND (kind IS NULL
+     OR (repos_path IS NULL
+         AND (properties IS NOT NULL
+              OR changed_revision IS NOT NULL
+              OR changed_author IS NOT NULL
+              OR (changed_date IS NOT NULL AND changed_date != 0)))
+     OR (CASE WHEN kind = MAP_FILE AND repos_path IS NOT NULL
+                                   THEN checksum IS NULL
+                                   ELSE checksum IS NOT NULL END)
+     OR (CASE WHEN kind = MAP_DIR THEN depth IS NULL
+                                  ELSE depth IS NOT NULL END)
+     OR (CASE WHEN kind = MAP_SYMLINK THEN symlink_target IS NULL
+                                      ELSE symlink_target IS NOT NULL END))
+

Modified: subversion/trunk/subversion/tests/libsvn_wc/db-test.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/db-test.c?rev=1660587&r1=1660586&r2=1660587&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/db-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/db-test.c Wed Feb 18 10:46:51 
2015
@@ -132,15 +132,15 @@ static const char * const TESTING_DATA =
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'I', 0, '', 1, 'I', 1, 'normal',"
-  "  null, null, 'dir', '()', null, null, null, 1, " TIME_1s ", '" AUTHOR_1 
"',"
+  "  null, null, 'dir', '()', 'infinity', null, null, 1, " TIME_1s ", '" 
AUTHOR_1 "',"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'J', 0, '', 1, 'J', 1, 'normal',"
-  "  null, null, 'dir', '()', null, null, null, 1, " TIME_1s ", '" AUTHOR_1 
"',"
+  "  null, null, 'dir', '()', 'infinity', null, null, 1, " TIME_1s ", '" 
AUTHOR_1 "',"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'J/J-e', 0, 'J', 1, 'J/J-e', 1, 'normal',"
-  "  null, 'other/place', 'dir', '()', null, null, null, 1, " TIME_1s ", '" 
AUTHOR_1 "',"
+  "  null, 'other/place', 'dir', null, 'infinity', null, null, null, null, 
null,"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'J/J-e/J-e-a', 0, 'J/J-e', 1, 'J/J-e/J-e-a', 1, 'normal',"
@@ -148,7 +148,7 @@ static const char * const TESTING_DATA =
   "  15, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'J/J-e/J-e-b', 0, 'J/J-e', 1, 'J/J-e/J-e-b', 1, 'normal',"
-  "  null, null, 'dir', '()', null, null, null, 1, " TIME_1s ", '" AUTHOR_1 
"',"
+  "  null, null, 'dir', '()', 'infinity', null, null, 1, " TIME_1s ", '" 
AUTHOR_1 "',"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'J/J-e/J-e-b/Jeba', 0, 'J/J-e/J-e-b', 1, 'J/J-e/J-e-b/Jeba', 1, 
'normal',"
@@ -156,15 +156,15 @@ static const char * const TESTING_DATA =
   "  15, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'J/J-f', 0, 'J', 1, 'J/J-f', 1, 'normal',"
-  "  null, null, 'dir', '()', null, null, null, 1, " TIME_1s ", '" AUTHOR_1 
"',"
+  "  null, null, 'dir', '()', 'infinity', null, null, 1, " TIME_1s ", '" 
AUTHOR_1 "',"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'J/J-f/J-f-a', 0, 'J/J-f', 1, 'J/J-f/J-f-a', 1, 'normal',"
-  "  null, null, 'dir', '()', null, null, null, 1, " TIME_1s ", '" AUTHOR_1 
"',"
+  "  null, null, 'dir', '()', 'infinity', null, null, 1, " TIME_1s ", '" 
AUTHOR_1 "',"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'K', 0, '', 1, 'K', 1, 'normal',"
-  "  null, null, 'dir', '()', null, null, null, 1, " TIME_1s ", '" AUTHOR_1 
"',"
+  "  null, null, 'dir', '()', 'infinity', null, null, 1, " TIME_1s ", '" 
AUTHOR_1 "',"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'K/K-a', 0, 'K', 1, 'K/K-a', 1, 'normal',"
@@ -189,15 +189,15 @@ static const char * const TESTING_DATA =
       implies they are children of a copied J. */
   "insert into nodes values ("
   "  1, 'J', 1, '', null, null, null, 'normal',"
-  "  null, null, 'dir', '()', 'immediates', null, null, null, null, null,"
+  "  null, null, 'dir', null, 'immediates', null, null, null, null, null,"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'J/J-a', 1, 'J', null, null, null, 'normal',"
-  "  null, null, 'file', '()', null, null, null, null, null, null,"
+  "  null, null, 'file', null, null, null, null, null, null, null,"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'J/J-b', 2, 'J', 2, 'some/dir', 2, 'normal',"
-  "  null, null, 'dir', '()', 'infinity', null, null, 2, " TIME_2s ", '" 
AUTHOR_2 "',"
+  "  null, null, 'dir', null, 'infinity', null, null, 2, " TIME_2s ", '" 
AUTHOR_2 "',"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'J/J-b/J-b-a', 3, 'J/J-b', 2, 'another/dir', 2, 'normal',"
@@ -205,15 +205,15 @@ static const char * const TESTING_DATA =
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'J/J-b/J-b-b', 2, 'J/J-b', null, null, 2, 'normal',"
-  "  null, null, 'file', '()', null, null, null, null, null, null,"
+  "  null, null, 'file', null, null, null, null, null, null, null,"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'J/J-c', 1, 'J', null, null, null, 'normal',"
-  "  null, null, 'dir', '()', null, null, null, null, null, null,"
+  "  null, null, 'dir', null, 'infinity', null, null, null, null, null,"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'J/J-c/J-c-a', 1, 'J/J-c', null, null, null, 'normal',"
-  "  null, null, 'dir', '()', null, null, null, null, null, null,"
+  "  null, null, 'dir', null, 'infinity', null, null, null, null, null,"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'J/J-c', 2, 'J', null, null, null, 'base-deleted',"
@@ -229,7 +229,7 @@ static const char * const TESTING_DATA =
   "  10, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'moved', 0, '', 2, 'moved', 2, 'normal',"
-  "  null, null, 'dir', '()', null, null, null, null, null, null,"
+  "  null, null, 'dir', '()', 'infinity', null, null, null, null, null,"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'moved/file', 0, 'moved', 2, 'moved/file', 2, 'normal',"
@@ -241,15 +241,15 @@ static const char * const TESTING_DATA =
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'J/J-e', 1, 'J', null, null, null, 'normal',"
-  "  null, null, 'dir', '()', null, null, null, null, null, null,"
+  "  null, null, 'dir', null, 'infinity', null, null, null, null, null,"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'J/J-e/J-e-a', 1, 'J/J-e', null, null, null, 'normal',"
-  "  null, null, 'file', '()', null, null, null, null, null, null,"
+  "  null, null, 'file', null, null, null, null, null, null, null,"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'J/J-e/J-e-b', 1, 'J/J-e', null, null, null, 'normal',"
-  "  null, null, 'dir', '()', null, null, null, null, null, null,"
+  "  null, null, 'dir', null, 'infinity', null, null, null, null, null,"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'J/J-e', 2, 'J', null, null, null, 'base-deleted',"
@@ -269,7 +269,7 @@ static const char * const TESTING_DATA =
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'J/J-f', 1, 'J', null, null, null, 'normal',"
-  "  null, null, 'dir', '()', 'immediates', null, null, null, null, null,"
+  "  null, null, 'dir', null, 'immediates', null, null, null, null, null,"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'J/J-f/J-f-a', 1, 'J/J-f', null, null, null, 'base-deleted',"
@@ -289,15 +289,15 @@ static const char * const TESTING_DATA =
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'L', 1, '', null, null, null, 'normal',"
-  "  null, null, 'dir', '()', 'immediates', null, null, null, null, null,"
+  "  null, null, 'dir', null, 'immediates', null, null, null, null, null,"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'L/L-a', 1, 'L', null, null, null, 'normal',"
-  "  null, null, 'dir', '()', 'immediates', null, null, null, null, null,"
+  "  null, null, 'dir', null, 'immediates', null, null, null, null, null,"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'L/L-a/L-a-a', 1, 'L/L-a', null, null, null, 'normal',"
-  "  null, null, 'dir', '()', 'immediates', null, null, null, null, null,"
+  "  null, null, 'dir', null, 'immediates', null, null, null, null, null,"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'L/L-a', 2, 'L', null, null, null, 'base-deleted',"
@@ -309,24 +309,24 @@ static const char * const TESTING_DATA =
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'other', 0, '', 2, 'other', 2, 'normal',"
-  "  null, null, 'dir', '()', null, null, null, null, null, null,"
+  "  null, null, 'dir', '()', 'infinity', null, null, null, null, null,"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'other/place', 2, 'other', null, null, null, 'normal',"
-  "  1, null, 'dir', '()', 'immediates', null, null, null, null, null,"
+  "  1, null, 'dir', null, 'immediates', null, null, null, null, null,"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'other/place/J-e-a', 2, 'other/place', null, null, null, 'normal',"
-  "  null, null, 'dir', '()', 'immediates', null, null, null, null, null,"
+  "  null, null, 'dir', null, 'immediates', null, null, null, null, null,"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'other/place/J-e-b', 2, 'other/place', null, null, null, 'normal',"
-  "  null, null, 'dir', '()', null, null, null, 1, " TIME_1s ", '" AUTHOR_1 
"',"
+  "  null, null, 'dir', null, 'infinity', null, null, null, null, null,"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'other/place/J-e-b/Jeba', 0, 'other/place/J-e-b', null, null, null, 
'normal',"
-  "  null, null, 'file', '()', null, '$sha1$" SHA1_1 "', null, 1, " TIME_1s ", 
'" AUTHOR_1 "',"
-  "  15, null, null, null, null);"
+  "  null, null, 'file', null, null, null, null, null, null, null,"
+  "  null, null, null, null, null);"
    "insert into actual_node values ("
    "  1, 'A', '', null, null, null, null, null, 'changelist', null, "
    "  null, null, null, null, null);"

Modified: subversion/trunk/subversion/tests/libsvn_wc/entries-compat.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/entries-compat.c?rev=1660587&r1=1660586&r2=1660587&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/entries-compat.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/entries-compat.c Wed Feb 18 
10:46:51 2015
@@ -131,15 +131,15 @@ static const char * const TESTING_DATA =
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'I', 0, '', 1, 'I', 1, 'normal',"
-  "  null, null, 'file', '()', null, null, null, 1, " TIME_1s ", '" AUTHOR_1 
"',"
+  "  null, null, 'file', '()', null, '$sha1$" SHA1_1 "', null, 1, " TIME_1s ", 
'" AUTHOR_1 "',"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'J', 0, '', 1, 'J', 1, 'normal',"
-  "  null, null, 'dir', '()', null, null, null, 1, " TIME_1s ", '" AUTHOR_1 
"',"
+  "  null, null, 'dir', '()', 'infinity', null, null, 1, " TIME_1s ", '" 
AUTHOR_1 "',"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'J/J-e', 0, 'J', 1, 'J/J-e', 1, 'normal',"
-  "  null, null, 'dir', '()', null, null, null, 1, " TIME_1s ", '" AUTHOR_1 
"',"
+  "  null, null, 'dir', '()', 'infinity', null, null, 1, " TIME_1s ", '" 
AUTHOR_1 "',"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'J/J-e/J-e-a', 0, 'J/J-e', 1, 'J/J-e/J-e-a', 1, 'normal',"
@@ -147,7 +147,7 @@ static const char * const TESTING_DATA =
   "  15, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'J/J-e/J-e-b', 0, 'J/J-e', 1, 'J/J-e/J-e-b', 1, 'normal',"
-  "  null, null, 'dir', '()', null, null, null, 1, " TIME_1s ", '" AUTHOR_1 
"',"
+  "  null, null, 'dir', '()', 'infinity', null, null, 1, " TIME_1s ", '" 
AUTHOR_1 "',"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'J/J-e/J-e-b/Jeba', 0, 'J/J-e/J-e-b', 1, 'J/J-e/J-e-b/Jeba', 1, 
'normal',"
@@ -155,15 +155,15 @@ static const char * const TESTING_DATA =
   "  15, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'J/J-f', 0, 'J', 1, 'J/J-f', 1, 'normal',"
-  "  null, null, 'dir', '()', null, null, null, 1, " TIME_1s ", '" AUTHOR_1 
"',"
+  "  null, null, 'dir', '()', 'infinity', null, null, 1, " TIME_1s ", '" 
AUTHOR_1 "',"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'J/J-f/J-f-a', 0, 'J/J-f', 1, 'J/J-f/J-f-a', 1, 'normal',"
-  "  null, null, 'dir', '()', null, null, null, 1, " TIME_1s ", '" AUTHOR_1 
"',"
+  "  null, null, 'dir', '()', 'infinity', null, null, 1, " TIME_1s ", '" 
AUTHOR_1 "',"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'K', 0, '', 1, 'K', 1, 'normal',"
-  "  null, null, 'dir', '()', null, null, null, 1, " TIME_1s ", '" AUTHOR_1 
"',"
+  "  null, null, 'dir', '()', 'infinity', null, null, 1, " TIME_1s ", '" 
AUTHOR_1 "',"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'K/K-a', 0, 'K', 1, 'K/K-a', 1, 'normal',"
@@ -179,15 +179,15 @@ static const char * const TESTING_DATA =
       the value 1 is just 'good enough' to make the nodes WORKING nodes. */
   "insert into nodes values ("
   "  1, 'I', 1, '', 2, 'some/dir', 2, 'normal',"
-  "  null, null, 'file', '()', 'immediates', null, null, 2, " TIME_2s ", '" 
AUTHOR_2 "',"
+  "  null, null, 'file', '()', null, '$sha1$" SHA1_1 "', null, 2, " TIME_2s ", 
'" AUTHOR_2 "',"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'J', 1, '', null, null, null, 'normal',"
-  "  null, null, 'dir', '()', 'immediates', null, null, null, null, null,"
+  "  null, null, 'dir', null, 'immediates', null, null, null, null, null,"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'J/J-a', 1, 'J', null, null, null, 'normal',"
-  "  null, null, 'file', '()', null, null, null, null, null, null,"
+  "  null, null, 'file', null, null, null, null, null, null, null,"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'J/J-b', 1, 'J', 2, 'some/dir', 2, 'normal',"
@@ -199,7 +199,7 @@ static const char * const TESTING_DATA =
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'J/J-b/J-b-b', 1, 'J/J-b', null, null, null, 'normal',"
-  "  null, null, 'file', '()', null, null, null, null, null, null,"
+  "  null, null, 'file', null, null, null, null, null, null, null,"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'J/J-c', 1, 'J', null, null, null, 'not-present',"
@@ -231,7 +231,7 @@ static const char * const TESTING_DATA =
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'J/J-f', 1, 'J', null, null, null, 'normal',"
-  "  null, null, 'dir', '()', 'immediates', null, null, null, null, null,"
+  "  null, null, 'dir', null, 'immediates', null, null, null, null, null,"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'J/J-f/J-f-a', 1, 'J/J-f', null, null, null, 'base-deleted',"
@@ -251,7 +251,7 @@ static const char * const TESTING_DATA =
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'L', 1, '', null, null, null, 'normal',"
-  "  null, null, 'dir', '()', 'immediates', null, null, null, null, null,"
+  "  null, null, 'dir', null, 'immediates', null, null, null, null, null,"
   "  null, null, null, null, null);"
   "insert into nodes values ("
   "  1, 'L/L-a', 1, 'L', null, null, null, 'not-present',"
@@ -273,7 +273,7 @@ static const char * const TESTING_DATA =
    "  "
    "insert into nodes values ("
    "  1, 'M', 0, '', 1, 'M', 1, 'normal', "
-   "  null, null, 'dir', '()', null, null, null, 1, " TIME_1s ", '" AUTHOR_1 
"', "
+   "  null, null, 'dir', '()', 'infinity', null, null, 1, " TIME_1s ", '" 
AUTHOR_1 "', "
    "  null, null, null, null, null);"
    "insert into nodes values ("
    "  1, 'M/M-a', 0, 'M', 1, 'M/M-a', 1, 'not-present', "

Modified: subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c?rev=1660587&r1=1660586&r2=1660587&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c Wed Feb 18 
10:46:51 2015
@@ -2031,6 +2031,9 @@ insert_actual(svn_test__sandbox_t *b,
       SVN_ERR(svn_sqlite__step_done(stmt));
       if (actual->changelist)
         {
+          SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
+                                            STMT_ENSURE_EMPTY_PRISTINE));
+          SVN_ERR(svn_sqlite__step_done(stmt));
           SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_NODES_SET_FILE));
           SVN_ERR(svn_sqlite__bindf(stmt, "s", actual->local_relpath));
           SVN_ERR(svn_sqlite__step_done(stmt));

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=1660587&r1=1660586&r2=1660587&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/wc-queries-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/wc-queries-test.c Wed Feb 18 
10:46:51 2015
@@ -984,6 +984,47 @@ test_schema_statistics(apr_pool_t *scrat
   return SVN_NO_ERROR;
 }
 
+/* Parse all verify/check queries */
+static svn_error_t *
+test_verify_parsable(apr_pool_t *scratch_pool)
+{
+  sqlite3 *sdb;
+  int i;
+
+  SVN_ERR(create_memory_db(&sdb, scratch_pool));
+
+  for (i=STMT_VERIFICATION_TRIGGERS; wc_queries[i]; i++)
+    {
+      sqlite3_stmt *stmt;
+      const char *text = wc_queries[i];
+
+      /* Some of our statement texts contain multiple queries. We prepare
+         them all. */
+      while (*text != '\0')
+        {
+          const char *tail;
+          int r = sqlite3_prepare_v2(sdb, text, -1, &stmt, &tail);
+
+          if (r != SQLITE_OK)
+            return svn_error_createf(SVN_ERR_SQLITE_ERROR, NULL,
+                                     "Preparing %s failed: %s\n%s",
+                                     wc_query_info[i][0],
+                                     sqlite3_errmsg(sdb),
+                                     text);
+
+          SQLITE_ERR(sqlite3_finalize(stmt));
+
+          /* Continue after the current statement */
+          text = tail;
+        }
+    }
+
+  SQLITE_ERR(sqlite3_close(sdb)); /* Close the DB if ok; otherwise leaked */
+
+  return SVN_NO_ERROR;
+}
+
+
 static int max_threads = 1;
 
 static struct svn_test_descriptor_t test_funcs[] =
@@ -999,6 +1040,8 @@ static struct svn_test_descriptor_t test
                    "test query duplicates"),
     SVN_TEST_PASS2(test_schema_statistics,
                    "test schema statistics"),
+    SVN_TEST_PASS2(test_verify_parsable,
+                   "verify queries are parsable"),
     SVN_TEST_NULL
   };
 

Modified: subversion/trunk/subversion/tests/libsvn_wc/wc-test-queries.sql
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/wc-test-queries.sql?rev=1660587&r1=1660586&r2=1660587&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/wc-test-queries.sql (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/wc-test-queries.sql Wed Feb 18 
10:46:51 2015
@@ -58,8 +58,18 @@ DELETE FROM actual_node;
 INSERT INTO actual_node (local_relpath, parent_relpath, changelist, wc_id)
                 VALUES (?1, ?2, ?3, 1)
 
+-- STMT_ENSURE_EMPTY_PRISTINE
+INSERT OR IGNORE INTO pristine (checksum, md5_checksum, size, refcount)
+  VALUES ('$sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709',
+          '$md5 $d41d8cd98f00b204e9800998ecf8427e',
+          0, 0)
+
 -- STMT_NODES_SET_FILE
-UPDATE nodes SET kind = 'file' WHERE wc_id = 1 and local_relpath = ?1
+UPDATE nodes
+   SET kind = 'file',
+       checksum = '$sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709',
+       depth = NULL
+WHERE wc_id = 1 and local_relpath = ?1
 
 -- STMT_SELECT_ALL_ACTUAL
 SELECT local_relpath FROM actual_node WHERE wc_id = 1


Reply via email to