summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2014-07-20 18:25:52 -0700
committerBen Murdoch <benm@google.com>2014-07-20 18:25:52 -0700
commit116680a4aac90f2aa7413d9095a592090648e557 (patch)
treef7c6fed0e63d6a2804243d4a31a752dca39fb076 /sql
parent1f14a4515e04c9ffc9bac4dd1e2f68611626b800 (diff)
downloadchromium_org-116680a4aac90f2aa7413d9095a592090648e557.tar.gz
Merge from Chromium at DEPS revision 284076
This commit was generated by merge_to_master.py. Change-Id: I9a279485b02fe7ceddcd32d992a714ff132e99ae
Diffstat (limited to 'sql')
-rw-r--r--sql/BUILD.gn7
-rw-r--r--sql/recovery.cc4
-rw-r--r--sql/recovery_unittest.cc32
-rw-r--r--sql/sql.gyp24
-rw-r--r--sql/sql.target.darwin-arm.mk10
-rw-r--r--sql/sql.target.darwin-arm64.mk10
-rw-r--r--sql/sql.target.darwin-mips.mk10
-rw-r--r--sql/sql.target.darwin-x86.mk10
-rw-r--r--sql/sql.target.darwin-x86_64.mk10
-rw-r--r--sql/sql.target.linux-arm.mk10
-rw-r--r--sql/sql.target.linux-arm64.mk10
-rw-r--r--sql/sql.target.linux-mips.mk10
-rw-r--r--sql/sql.target.linux-x86.mk10
-rw-r--r--sql/sql.target.linux-x86_64.mk10
-rw-r--r--sql/sql_unittests.isolate17
-rw-r--r--sql/test/data/recovery_387868bin0 -> 4096 bytes
-rw-r--r--sql/test/paths.cc48
-rw-r--r--sql/test/paths.h25
-rw-r--r--sql/test/run_all_unittests.cc16
-rw-r--r--sql/test/sql_test_suite.cc25
-rw-r--r--sql/test/sql_test_suite.h29
21 files changed, 311 insertions, 16 deletions
diff --git a/sql/BUILD.gn b/sql/BUILD.gn
index d67284141b..2029dc374e 100644
--- a/sql/BUILD.gn
+++ b/sql/BUILD.gn
@@ -56,6 +56,11 @@ test("sql_unittests") {
"recovery_unittest.cc",
"sqlite_features_unittest.cc",
"statement_unittest.cc",
+ "test/paths.cc",
+ "test/paths.h",
+ "test/run_all_unittests.cc",
+ "test/sql_test_suite.cc",
+ "test/sql_test_suite.h",
"transaction_unittest.cc",
]
@@ -67,7 +72,7 @@ test("sql_unittests") {
":sql",
":test_support",
"//base/allocator",
- "//base/test:run_all_unittests",
+ "//base/test:test_support",
"//testing/gtest",
"//third_party/sqlite",
]
diff --git a/sql/recovery.cc b/sql/recovery.cc
index 42f1a9af6e..f9da40762b 100644
--- a/sql/recovery.cc
+++ b/sql/recovery.cc
@@ -355,7 +355,7 @@ bool Recovery::AutoRecoverTable(const char* table_name,
// |rowid_decl| stores the ROWID version of the last INTEGER column
// seen, which is at |rowid_ofs| in |create_column_decls|.
size_t pk_column_count = 0;
- size_t rowid_ofs; // Only valid if rowid_decl is set.
+ size_t rowid_ofs = 0; // Only valid if rowid_decl is set.
std::string rowid_decl; // ROWID version of column |rowid_ofs|.
while (s.Step()) {
@@ -372,7 +372,7 @@ bool Recovery::AutoRecoverTable(const char* table_name,
// (zero for not in primary key). I find that it is always 1 for
// columns in the primary key. Since this code is very dependent on
// that pragma, review if the implementation changes.
- DCHECK_EQ(pk_column, 1);
+ DCHECK_EQ(1, pk_column);
++pk_column_count;
}
diff --git a/sql/recovery_unittest.cc b/sql/recovery_unittest.cc
index ce3884bbc0..201966d081 100644
--- a/sql/recovery_unittest.cc
+++ b/sql/recovery_unittest.cc
@@ -5,13 +5,16 @@
#include <string>
#include "base/bind.h"
+#include "base/file_util.h"
#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
+#include "base/path_service.h"
#include "base/strings/string_number_conversions.h"
#include "sql/connection.h"
#include "sql/meta_table.h"
#include "sql/recovery.h"
#include "sql/statement.h"
+#include "sql/test/paths.h"
#include "sql/test/scoped_error_ignorer.h"
#include "sql/test/test_helpers.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -683,6 +686,35 @@ TEST_F(SQLRecoveryTest, AutoRecoverTableExtendColumns) {
ASSERT_EQ(orig_schema, GetSchema(&db()));
ASSERT_EQ(orig_data, ExecuteWithResults(&db(), kXSql, "|", "\n"));
}
+
+// Recover a golden file where an interior page has been manually modified so
+// that the number of cells is greater than will fit on a single page. This
+// case happened in <http://crbug.com/387868>.
+TEST_F(SQLRecoveryTest, Bug387868) {
+ base::FilePath golden_path;
+ ASSERT_TRUE(PathService::Get(sql::test::DIR_TEST_DATA, &golden_path));
+ golden_path = golden_path.AppendASCII("recovery_387868");
+ db().Close();
+ ASSERT_TRUE(base::CopyFile(golden_path, db_path()));
+ ASSERT_TRUE(Reopen());
+
+ {
+ scoped_ptr<sql::Recovery> recovery = sql::Recovery::Begin(&db(), db_path());
+ ASSERT_TRUE(recovery.get());
+
+ // Create the new version of the table.
+ const char kCreateSql[] =
+ "CREATE TABLE x (id INTEGER PRIMARY KEY, t0 TEXT)";
+ ASSERT_TRUE(recovery->db()->Execute(kCreateSql));
+
+ size_t rows = 0;
+ EXPECT_TRUE(recovery->AutoRecoverTable("x", 0, &rows));
+ EXPECT_EQ(43u, rows);
+
+ // Successfully recovered.
+ EXPECT_TRUE(sql::Recovery::Recovered(recovery.Pass()));
+ }
+}
#endif // !defined(USE_SYSTEM_SQLITE)
} // namespace
diff --git a/sql/sql.gyp b/sql/sql.gyp
index 37c6ae7109..975cd122af 100644
--- a/sql/sql.gyp
+++ b/sql/sql.gyp
@@ -80,7 +80,6 @@
'dependencies': [
'sql',
'test_support_sql',
- '../base/base.gyp:run_all_unittests',
'../base/base.gyp:test_support_base',
'../testing/gtest.gyp:gtest',
'../third_party/sqlite/sqlite.gyp:sqlite',
@@ -91,6 +90,11 @@
'recovery_unittest.cc',
'sqlite_features_unittest.cc',
'statement_unittest.cc',
+ 'test/paths.cc',
+ 'test/paths.h',
+ 'test/run_all_unittests.cc',
+ 'test/sql_test_suite.cc',
+ 'test/sql_test_suite.h',
'transaction_unittest.cc',
],
'include_dirs': [
@@ -132,5 +136,23 @@
},
],
}],
+ ['test_isolation_mode != "noop"', {
+ 'targets': [
+ {
+ 'target_name': 'sql_unittests_run',
+ 'type': 'none',
+ 'dependencies': [
+ 'sql_unittests',
+ ],
+ 'includes': [
+ '../build/isolate.gypi',
+ 'sql_unittests.isolate',
+ ],
+ 'sources': [
+ 'sql_unittests.isolate',
+ ],
+ },
+ ],
+ }],
],
}
diff --git a/sql/sql.target.darwin-arm.mk b/sql/sql.target.darwin-arm.mk
index 556c15ea56..2bf94a731b 100644
--- a/sql/sql.target.darwin-arm.mk
+++ b/sql/sql.target.darwin-arm.mk
@@ -68,9 +68,9 @@ MY_CFLAGS_Debug := \
-Wno-unused-but-set-variable \
-Os \
-g \
- -fomit-frame-pointer \
-fdata-sections \
-ffunction-sections \
+ -fomit-frame-pointer \
-funwind-tables
MY_DEFS_Debug := \
@@ -89,6 +89,7 @@ MY_DEFS_Debug := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -132,6 +133,9 @@ LOCAL_CPPFLAGS_Debug := \
-fvisibility-inlines-hidden \
-Wsign-compare \
-Wno-abi \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
@@ -193,6 +197,7 @@ MY_DEFS_Release := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -237,6 +242,9 @@ LOCAL_CPPFLAGS_Release := \
-fvisibility-inlines-hidden \
-Wsign-compare \
-Wno-abi \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
diff --git a/sql/sql.target.darwin-arm64.mk b/sql/sql.target.darwin-arm64.mk
index efdc71009e..7fdf21611d 100644
--- a/sql/sql.target.darwin-arm64.mk
+++ b/sql/sql.target.darwin-arm64.mk
@@ -58,7 +58,6 @@ MY_CFLAGS_Debug := \
-Wno-unused-but-set-variable \
-Os \
-g \
- -fomit-frame-pointer \
-fdata-sections \
-ffunction-sections \
-funwind-tables
@@ -79,6 +78,7 @@ MY_DEFS_Debug := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -121,6 +121,9 @@ LOCAL_CPPFLAGS_Debug := \
-fno-threadsafe-statics \
-fvisibility-inlines-hidden \
-Wsign-compare \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
@@ -153,7 +156,6 @@ MY_CFLAGS_Release := \
-fno-ident \
-fdata-sections \
-ffunction-sections \
- -fomit-frame-pointer \
-funwind-tables
MY_DEFS_Release := \
@@ -172,6 +174,7 @@ MY_DEFS_Release := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -215,6 +218,9 @@ LOCAL_CPPFLAGS_Release := \
-fno-threadsafe-statics \
-fvisibility-inlines-hidden \
-Wsign-compare \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
diff --git a/sql/sql.target.darwin-mips.mk b/sql/sql.target.darwin-mips.mk
index 9eb5ce7bba..8fff525dc3 100644
--- a/sql/sql.target.darwin-mips.mk
+++ b/sql/sql.target.darwin-mips.mk
@@ -62,9 +62,9 @@ MY_CFLAGS_Debug := \
-Wno-unused-but-set-variable \
-Os \
-g \
- -fomit-frame-pointer \
-fdata-sections \
-ffunction-sections \
+ -fomit-frame-pointer \
-funwind-tables
MY_DEFS_Debug := \
@@ -83,6 +83,7 @@ MY_DEFS_Debug := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -126,6 +127,9 @@ LOCAL_CPPFLAGS_Debug := \
-fvisibility-inlines-hidden \
-Wsign-compare \
-Wno-uninitialized \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
@@ -181,6 +185,7 @@ MY_DEFS_Release := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -225,6 +230,9 @@ LOCAL_CPPFLAGS_Release := \
-fvisibility-inlines-hidden \
-Wsign-compare \
-Wno-uninitialized \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
diff --git a/sql/sql.target.darwin-x86.mk b/sql/sql.target.darwin-x86.mk
index af0adec6f4..b053e6eb6b 100644
--- a/sql/sql.target.darwin-x86.mk
+++ b/sql/sql.target.darwin-x86.mk
@@ -63,9 +63,9 @@ MY_CFLAGS_Debug := \
-fno-stack-protector \
-Os \
-g \
- -fomit-frame-pointer \
-fdata-sections \
-ffunction-sections \
+ -fomit-frame-pointer \
-funwind-tables
MY_DEFS_Debug := \
@@ -84,6 +84,7 @@ MY_DEFS_Debug := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -126,6 +127,9 @@ LOCAL_CPPFLAGS_Debug := \
-fno-threadsafe-statics \
-fvisibility-inlines-hidden \
-Wsign-compare \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
@@ -182,6 +186,7 @@ MY_DEFS_Release := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -225,6 +230,9 @@ LOCAL_CPPFLAGS_Release := \
-fno-threadsafe-statics \
-fvisibility-inlines-hidden \
-Wsign-compare \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
diff --git a/sql/sql.target.darwin-x86_64.mk b/sql/sql.target.darwin-x86_64.mk
index 41682d51b1..4cda67efac 100644
--- a/sql/sql.target.darwin-x86_64.mk
+++ b/sql/sql.target.darwin-x86_64.mk
@@ -62,9 +62,9 @@ MY_CFLAGS_Debug := \
-Wno-unused-but-set-variable \
-Os \
-g \
- -fomit-frame-pointer \
-fdata-sections \
-ffunction-sections \
+ -fomit-frame-pointer \
-funwind-tables
MY_DEFS_Debug := \
@@ -83,6 +83,7 @@ MY_DEFS_Debug := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -125,6 +126,9 @@ LOCAL_CPPFLAGS_Debug := \
-fno-threadsafe-statics \
-fvisibility-inlines-hidden \
-Wsign-compare \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
@@ -180,6 +184,7 @@ MY_DEFS_Release := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -223,6 +228,9 @@ LOCAL_CPPFLAGS_Release := \
-fno-threadsafe-statics \
-fvisibility-inlines-hidden \
-Wsign-compare \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
diff --git a/sql/sql.target.linux-arm.mk b/sql/sql.target.linux-arm.mk
index 556c15ea56..2bf94a731b 100644
--- a/sql/sql.target.linux-arm.mk
+++ b/sql/sql.target.linux-arm.mk
@@ -68,9 +68,9 @@ MY_CFLAGS_Debug := \
-Wno-unused-but-set-variable \
-Os \
-g \
- -fomit-frame-pointer \
-fdata-sections \
-ffunction-sections \
+ -fomit-frame-pointer \
-funwind-tables
MY_DEFS_Debug := \
@@ -89,6 +89,7 @@ MY_DEFS_Debug := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -132,6 +133,9 @@ LOCAL_CPPFLAGS_Debug := \
-fvisibility-inlines-hidden \
-Wsign-compare \
-Wno-abi \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
@@ -193,6 +197,7 @@ MY_DEFS_Release := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -237,6 +242,9 @@ LOCAL_CPPFLAGS_Release := \
-fvisibility-inlines-hidden \
-Wsign-compare \
-Wno-abi \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
diff --git a/sql/sql.target.linux-arm64.mk b/sql/sql.target.linux-arm64.mk
index efdc71009e..7fdf21611d 100644
--- a/sql/sql.target.linux-arm64.mk
+++ b/sql/sql.target.linux-arm64.mk
@@ -58,7 +58,6 @@ MY_CFLAGS_Debug := \
-Wno-unused-but-set-variable \
-Os \
-g \
- -fomit-frame-pointer \
-fdata-sections \
-ffunction-sections \
-funwind-tables
@@ -79,6 +78,7 @@ MY_DEFS_Debug := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -121,6 +121,9 @@ LOCAL_CPPFLAGS_Debug := \
-fno-threadsafe-statics \
-fvisibility-inlines-hidden \
-Wsign-compare \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
@@ -153,7 +156,6 @@ MY_CFLAGS_Release := \
-fno-ident \
-fdata-sections \
-ffunction-sections \
- -fomit-frame-pointer \
-funwind-tables
MY_DEFS_Release := \
@@ -172,6 +174,7 @@ MY_DEFS_Release := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -215,6 +218,9 @@ LOCAL_CPPFLAGS_Release := \
-fno-threadsafe-statics \
-fvisibility-inlines-hidden \
-Wsign-compare \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
diff --git a/sql/sql.target.linux-mips.mk b/sql/sql.target.linux-mips.mk
index 9eb5ce7bba..8fff525dc3 100644
--- a/sql/sql.target.linux-mips.mk
+++ b/sql/sql.target.linux-mips.mk
@@ -62,9 +62,9 @@ MY_CFLAGS_Debug := \
-Wno-unused-but-set-variable \
-Os \
-g \
- -fomit-frame-pointer \
-fdata-sections \
-ffunction-sections \
+ -fomit-frame-pointer \
-funwind-tables
MY_DEFS_Debug := \
@@ -83,6 +83,7 @@ MY_DEFS_Debug := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -126,6 +127,9 @@ LOCAL_CPPFLAGS_Debug := \
-fvisibility-inlines-hidden \
-Wsign-compare \
-Wno-uninitialized \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
@@ -181,6 +185,7 @@ MY_DEFS_Release := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -225,6 +230,9 @@ LOCAL_CPPFLAGS_Release := \
-fvisibility-inlines-hidden \
-Wsign-compare \
-Wno-uninitialized \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
diff --git a/sql/sql.target.linux-x86.mk b/sql/sql.target.linux-x86.mk
index af0adec6f4..b053e6eb6b 100644
--- a/sql/sql.target.linux-x86.mk
+++ b/sql/sql.target.linux-x86.mk
@@ -63,9 +63,9 @@ MY_CFLAGS_Debug := \
-fno-stack-protector \
-Os \
-g \
- -fomit-frame-pointer \
-fdata-sections \
-ffunction-sections \
+ -fomit-frame-pointer \
-funwind-tables
MY_DEFS_Debug := \
@@ -84,6 +84,7 @@ MY_DEFS_Debug := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -126,6 +127,9 @@ LOCAL_CPPFLAGS_Debug := \
-fno-threadsafe-statics \
-fvisibility-inlines-hidden \
-Wsign-compare \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
@@ -182,6 +186,7 @@ MY_DEFS_Release := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -225,6 +230,9 @@ LOCAL_CPPFLAGS_Release := \
-fno-threadsafe-statics \
-fvisibility-inlines-hidden \
-Wsign-compare \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
diff --git a/sql/sql.target.linux-x86_64.mk b/sql/sql.target.linux-x86_64.mk
index 41682d51b1..4cda67efac 100644
--- a/sql/sql.target.linux-x86_64.mk
+++ b/sql/sql.target.linux-x86_64.mk
@@ -62,9 +62,9 @@ MY_CFLAGS_Debug := \
-Wno-unused-but-set-variable \
-Os \
-g \
- -fomit-frame-pointer \
-fdata-sections \
-ffunction-sections \
+ -fomit-frame-pointer \
-funwind-tables
MY_DEFS_Debug := \
@@ -83,6 +83,7 @@ MY_DEFS_Debug := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -125,6 +126,9 @@ LOCAL_CPPFLAGS_Debug := \
-fno-threadsafe-statics \
-fvisibility-inlines-hidden \
-Wsign-compare \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
@@ -180,6 +184,7 @@ MY_DEFS_Release := \
'-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \
'-DENABLE_EGLIMAGE=1' \
'-DCLD_VERSION=1' \
+ '-DCLD_DATA_FROM_STATIC' \
'-DENABLE_PRINTING=1' \
'-DENABLE_MANAGED_USERS=1' \
'-DDATA_REDUCTION_FALLBACK_HOST="http://compress.googlezip.net:80/"' \
@@ -223,6 +228,9 @@ LOCAL_CPPFLAGS_Release := \
-fno-threadsafe-statics \
-fvisibility-inlines-hidden \
-Wsign-compare \
+ -std=gnu++11 \
+ -Wno-narrowing \
+ -Wno-literal-suffix \
-Wno-non-virtual-dtor \
-Wno-sign-promo
diff --git a/sql/sql_unittests.isolate b/sql/sql_unittests.isolate
new file mode 100644
index 0000000000..75e776d0cf
--- /dev/null
+++ b/sql/sql_unittests.isolate
@@ -0,0 +1,17 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+{
+ 'conditions': [
+ ['OS=="android" or OS=="linux" or OS=="mac" or OS=="win"', {
+ 'variables': {
+ 'isolate_dependency_untracked': [
+ 'test/data/',
+ ],
+ },
+ }],
+ ],
+ 'includes': [
+ '../base/base.isolate',
+ ],
+}
diff --git a/sql/test/data/recovery_387868 b/sql/test/data/recovery_387868
new file mode 100644
index 0000000000..7bfd051ba2
--- /dev/null
+++ b/sql/test/data/recovery_387868
Binary files differ
diff --git a/sql/test/paths.cc b/sql/test/paths.cc
new file mode 100644
index 0000000000..df57934111
--- /dev/null
+++ b/sql/test/paths.cc
@@ -0,0 +1,48 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "sql/test/paths.h"
+
+#include "base/file_util.h"
+#include "base/files/file_path.h"
+#include "base/path_service.h"
+
+namespace sql {
+namespace test {
+
+namespace {
+
+bool PathProvider(int key, base::FilePath* result) {
+ base::FilePath cur;
+ switch (key) {
+ // The following are only valid in the development environment, and
+ // will fail if executed from an installed executable (because the
+ // generated path won't exist).
+ case DIR_TEST_DATA:
+ if (!PathService::Get(base::DIR_SOURCE_ROOT, &cur))
+ return false;
+ cur = cur.Append(FILE_PATH_LITERAL("sql"));
+ cur = cur.Append(FILE_PATH_LITERAL("test"));
+ cur = cur.Append(FILE_PATH_LITERAL("data"));
+ if (!base::PathExists(cur)) // we don't want to create this
+ return false;
+ break;
+ default:
+ return false;
+ }
+
+ *result = cur;
+ return true;
+}
+
+} // namespace
+
+// This cannot be done as a static initializer sadly since Visual Studio will
+// eliminate this object file if there is no direct entry point into it.
+void RegisterPathProvider() {
+ PathService::RegisterProvider(PathProvider, PATH_START, PATH_END);
+}
+
+} // namespace test
+} // namespace sql
diff --git a/sql/test/paths.h b/sql/test/paths.h
new file mode 100644
index 0000000000..d932106ce0
--- /dev/null
+++ b/sql/test/paths.h
@@ -0,0 +1,25 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SQL_TEST_PATHS_H_
+#define SQL_TEST_PATHS_H_
+
+namespace sql {
+namespace test {
+
+enum {
+ PATH_START = 10000,
+
+ // Valid only in testing environments.
+ DIR_TEST_DATA,
+ PATH_END
+};
+
+// Call once to register the provider for the path keys defined above.
+void RegisterPathProvider();
+
+} // namespace test
+} // namespace sql
+
+#endif // SQL_TEST_PATHS_H_
diff --git a/sql/test/run_all_unittests.cc b/sql/test/run_all_unittests.cc
new file mode 100644
index 0000000000..85ceac0770
--- /dev/null
+++ b/sql/test/run_all_unittests.cc
@@ -0,0 +1,16 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/bind.h"
+#include "base/test/launcher/unit_test_launcher.h"
+#include "sql/test/sql_test_suite.h"
+
+int main(int argc, char** argv) {
+ sql::SQLTestSuite test_suite(argc, argv);
+
+ return base::LaunchUnitTests(
+ argc,
+ argv,
+ base::Bind(&sql::SQLTestSuite::Run, base::Unretained(&test_suite)));
+}
diff --git a/sql/test/sql_test_suite.cc b/sql/test/sql_test_suite.cc
new file mode 100644
index 0000000000..bfda3a0c44
--- /dev/null
+++ b/sql/test/sql_test_suite.cc
@@ -0,0 +1,25 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "sql/test/sql_test_suite.h"
+
+#include "sql/test/paths.h"
+
+namespace sql {
+
+SQLTestSuite::SQLTestSuite(int argc, char** argv)
+ : base::TestSuite(argc, argv) {}
+
+SQLTestSuite::~SQLTestSuite() {}
+
+void SQLTestSuite::Initialize() {
+ base::TestSuite::Initialize();
+ sql::test::RegisterPathProvider();
+}
+
+void SQLTestSuite::Shutdown() {
+ base::TestSuite::Shutdown();
+}
+
+} // namespace sql
diff --git a/sql/test/sql_test_suite.h b/sql/test/sql_test_suite.h
new file mode 100644
index 0000000000..3c15373779
--- /dev/null
+++ b/sql/test/sql_test_suite.h
@@ -0,0 +1,29 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SQL_TEST_SQL_TEST_SUITE_H_
+#define SQL_TEST_SQL_TEST_SUITE_H_
+
+#include "base/macros.h"
+#include "base/test/test_suite.h"
+
+namespace sql {
+
+class SQLTestSuite : public base::TestSuite {
+ public:
+ SQLTestSuite(int argc, char** argv);
+ virtual ~SQLTestSuite();
+
+ protected:
+ // Overridden from base::TestSuite:
+ virtual void Initialize() OVERRIDE;
+ virtual void Shutdown() OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SQLTestSuite);
+};
+
+} // namespace sql
+
+#endif // SQL_TEST_SQL_TEST_SUITE_H_