File subversion-1.8.13-fix-sqlite-3.8.9-tests.patch of Package subversion

From: rhuijben@apache.org
Date: http://mail-archives.apache.org/mod_mbox/subversion-dev/201504.mbox/%3Ctrinity-c54d324c-04f0-4689-a0c4-010951b9484a-1428566673633%403capp-gmx-bs19%3E
Subject: Fix tests with SQLite 3.8.9
Upstream: committed
References: http://svn.apache.org/viewvc?view=revision&revision=r1672295 http://mail-archives.apache.org/mod_mbox/subversion-dev/201504.mbox/%3Ctrinity-c54d324c-04f0-4689-a0c4-010951b9484a-1428566673633%403capp-gmx-bs19%3E

Fixes test failures with SQLite 3.8.9:

[  875s] [050/110] wc-queries-test................................................FAILURE
[...]
[ 4950s] At least one test FAILED, checking /home/abuild/rpmbuild/BUILD/subversion-1.9.0-beta1/tests.log
[ 4950s] FAIL:  wc-queries-test 3: test query expectations
[ 4950s] Summary of test results:
[ 4950s]   2180 tests PASSED
[ 4950s]   71 tests SKIPPED
[ 4950s]   45 tests XFAILED (1 WORK-IN-PROGRESS)
[ 4950s]   1 test FAILED
[ 4950s] SUMMARY: Some tests failed.
[ 4950s] 
[ 4950s] Makefile:521: recipe for target 'check' failed
[ 4950s] make: *** [check] Error 1
[ 4950s] + cat fails.log
[ 4950s] [[[
[ 4950s] svn_tests: E200006: STMT_SELECT_EXTERNALS_DEFINED: Uses externals with only 1 index
component: (wc_id=? )
[ 4950s] SELECT local_relpath, def_local_relpath FROM externals WHERE (wc_id = ?1 AND def_local_relpath
= ?2)    OR (wc_id = ?1 AND (((def_local_relpath) > (CASE (?2) WHEN '' THEN '' ELSE (?2)
|| '/' END)) AND ((def_local_relpath) < CASE (?2) WHEN '' THEN X'FFFF' ELSE (?2) || '0'
END))) 
[ 4950s] svn_tests: E200042: Additional errors:
[ 4950s] svn_tests: E200035: |SEARCH TABLE externals USING COVERING INDEX I_EXTERNALS_DEFINED
(wc_id=?)
[ 4950s] FAIL:  wc-queries-test 3: test query expectations
[ 4950s] ]]]
[ 4950s] 
[ 4950s] + exit 1
[ 4950s] error: Bad exit status from /var/tmp/rpm-tmp.oHqq5V (%check)

------------------------------------------------------------------------
r1672295 | rhuijben | 2015-04-09 13:31:12 +0200 (Thu, 09 Apr 2015) | 15 lines
Changed paths:
   M /subversion/trunk/subversion/libsvn_wc/wc-metadata.sql
   M /subversion/trunk/subversion/tests/libsvn_wc/wc-queries-test.c

Optimize STMT_SELECT_EXTERNALS_DEFINED when using Sqlite 3.8.9, by
adding two more rows to the sqlite_stat1 table.

This fixes a test failure in wc-queries-test.c, but actual users most
likely don't notice a difference as a tablescan on an EXTERNALS tables
index is not that expensive, given that most working copies don't have
many externals.

* subversion/libsvn_wc/wc-metadata.sql
  (STMT_INSTALL_SCHEMA_STATISTICS): Add two rows.

* subversion/tests/libsvn_wc/wc-queries-test.c
  (test_schema_statistics): Add a dummy externals row to allow
    verifying schema.

------------------------------------------------------------------------
Index: trunk/subversion/tests/libsvn_wc/wc-queries-test.c
===================================================================
--- trunk/subversion/tests/libsvn_wc/wc-queries-test.c	(revision 1672294)
+++ trunk/subversion/tests/libsvn_wc/wc-queries-test.c	(revision 1672295)
@@ -927,6 +927,15 @@
                    "VALUES (1, '', '')",
                    NULL, NULL, NULL));
 
+  SQLITE_ERR(
+      sqlite3_exec(sdb,
+                   "INSERT INTO EXTERNALS (wc_id, local_relpath,"
+                   "                       parent_relpath, repos_id,"
+                   "                       presence, kind, def_local_relpath,"
+                   "                       def_repos_relpath) "
+                   "VALUES (1, 'subdir', '', 1, 'normal', 'dir', '', '')",
+                   NULL, NULL, NULL));
+
   /* These are currently not necessary for query optimization, but it's better
      to tell Sqlite how we intend to use this table anyway */
   SQLITE_ERR(
Index: trunk/subversion/libsvn_wc/wc-metadata.sql
===================================================================
--- trunk/subversion/libsvn_wc/wc-metadata.sql	(revision 1672294)
+++ trunk/subversion/libsvn_wc/wc-metadata.sql	(revision 1672295)
@@ -619,6 +619,11 @@
 INSERT OR REPLACE INTO sqlite_stat1(tbl, idx, stat) VALUES
     ('WC_LOCK', 'sqlite_autoindex_WC_LOCK_1',           '100 100 1');
 
+INSERT OR REPLACE INTO sqlite_stat1(tbl, idx, stat) VALUES
+    ('EXTERNALS','sqlite_autoindex_EXTERNALS_1',        '100 100 1');
+INSERT OR REPLACE INTO sqlite_stat1(tbl, idx, stat) VALUES
+    ('EXTERNALS','I_EXTERNALS_DEFINED',                 '100 100 3 1');
+
 /* sqlite_autoindex_WORK_QUEUE_1 doesn't exist because WORK_QUEUE is
    a INTEGER PRIMARY KEY AUTOINCREMENT table */
 
openSUSE Build Service is sponsored by