|
@@ -30,41 +30,41 @@ std::string SQLITE_DBFILE_EXAMPLE_ORG = TEST_DATA_DIR "/example.org.sqlite3";
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
+// note this helper only checks the error that is received up to the length
|
|
|
+// of the expected string. It will always pass if you give it an empty
|
|
|
+// expected_error
|
|
|
void
|
|
|
-pathtest_helper(const std::string& file, const std::string& expected_error) {
|
|
|
+pathtestHelper(const std::string& file, const std::string& expected_error) {
|
|
|
std::string error;
|
|
|
try {
|
|
|
DataSourceClientContainer(file, ElementPtr());
|
|
|
} catch (const DataSourceLibraryError& dsle) {
|
|
|
error = dsle.what();
|
|
|
}
|
|
|
- EXPECT_EQ(expected_error, error);
|
|
|
+ EXPECT_EQ(expected_error, error.substr(0, expected_error.size()));
|
|
|
}
|
|
|
|
|
|
TEST(FactoryTest, paths) {
|
|
|
// Test whether the paths are made absolute if they are not,
|
|
|
// by inspecting the error that is raised when they are wrong
|
|
|
- const std::string error(": cannot open shared object file: "
|
|
|
- "No such file or directory");
|
|
|
+ const std::string error("dlopen failed for ");
|
|
|
// With the current implementation, we can safely assume this has
|
|
|
// been set for this test (as the loader would otherwise also fail
|
|
|
- // unless the module happens to be installed)
|
|
|
+ // unless the loadable backend library happens to be installed)
|
|
|
const std::string builddir(getenv("B10_FROM_BUILD"));
|
|
|
|
|
|
// Absolute and ending with .so should have no change
|
|
|
- pathtest_helper("/no_such_file.so", "/no_such_file.so" + error);
|
|
|
+ pathtestHelper("/no_such_file.so", error + "/no_such_file.so");
|
|
|
|
|
|
// If no ending in .so, it should get _ds.so
|
|
|
- pathtest_helper("/no_such_file", "/no_such_file_ds.so" + error);
|
|
|
+ pathtestHelper("/no_such_file", error + "/no_such_file_ds.so");
|
|
|
|
|
|
// If not starting with /, path should be added. For this test that
|
|
|
// means the build directory as set in B10_FROM_BUILD
|
|
|
- pathtest_helper("no_such_file.so",
|
|
|
- builddir + "/src/lib/datasrc/.libs/no_such_file.so" +
|
|
|
- error);
|
|
|
- pathtest_helper("no_such_file",
|
|
|
- builddir + "/src/lib/datasrc/.libs/no_such_file_ds.so" +
|
|
|
- error);
|
|
|
+ pathtestHelper("no_such_file.so", error + builddir +
|
|
|
+ "/src/lib/datasrc/.libs/no_such_file.so");
|
|
|
+ pathtestHelper("no_such_file", error + builddir +
|
|
|
+ "/src/lib/datasrc/.libs/no_such_file_ds.so");
|
|
|
}
|
|
|
|
|
|
TEST(FactoryTest, sqlite3ClientBadConfig) {
|