summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRene Engelhard <rene@debian.org>2018-09-28 23:02:17 +0200
committerCaolán McNamara <caolanm@redhat.com>2018-10-16 12:30:44 +0200
commitd5d09bb733842252b3e2d6e7480b211e67136a75 (patch)
tree057a2e8177b4267f1472da41c08f6ea2921a1892
parentdbba4c85e13ecd226f17550ca458738b9be24872 (diff)
tdf#72987 split firebird test into a regression test and a "new" test
former with endianness and latter with the new fbk format. Add new endianness-independent firebird test odbs This squashes tdf#72987 run firebird test for little endian only for now since those old(er) files still use the endianness-depending format. And remove x64 from the filename... Change-Id: I24e56cd8561c2ec6a1f77a66907c14cdea8248b6 Reviewed-on: https://gerrit.libreoffice.org/60916 Tested-by: Jenkins Reviewed-by: Rene Engelhard <rene@debian.org> and tdf#72987 split firebird test into a regression test and a "new" testHEADmaster former with endianness and latter with the new fbk format. Add new endianness-independent firebird test odbs Change-Id: I29be2e6916fcca74744211dba04463376fb6b8d5 Reviewed-on: https://gerrit.libreoffice.org/60917 Reviewed-by: Rene Engelhard <rene@debian.org> Tested-by: Rene Engelhard <rene@debian.org> Change-Id: I29be2e6916fcca74744211dba04463376fb6b8d5 Reviewed-on: https://gerrit.libreoffice.org/61285 Tested-by: Rene Engelhard <rene@debian.org> Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--config_host.mk.in1
-rw-r--r--configure.ac7
-rw-r--r--dbaccess/CppunitTest_dbaccess_firebird_regression_test.mk70
-rw-r--r--dbaccess/CppunitTest_dbaccess_firebird_test.mk18
-rw-r--r--dbaccess/Module_dbaccess.mk6
-rw-r--r--dbaccess/qa/unit/data/firebird_empty.odbbin1733 -> 2148 bytes
-rw-r--r--dbaccess/qa/unit/data/firebird_empty_le.odbbin0 -> 1733 bytes
-rw-r--r--dbaccess/qa/unit/data/firebird_integer_le.odb (renamed from dbaccess/qa/unit/data/firebird_integer_x64le.odb)bin43990 -> 43990 bytes
-rw-r--r--dbaccess/qa/unit/data/firebird_integer_le_ods12.odb (renamed from dbaccess/qa/unit/data/firebird_integer_x64le_ods12.odb)bin75701 -> 75701 bytes
-rw-r--r--dbaccess/qa/unit/data/firebird_integer_ods12.odbbin0 -> 77617 bytes
-rw-r--r--dbaccess/qa/unit/firebird-regression.cxx108
-rw-r--r--dbaccess/qa/unit/firebird.cxx2
-rw-r--r--solenv/clang-format/blacklist1
13 files changed, 203 insertions, 10 deletions
diff --git a/config_host.mk.in b/config_host.mk.in
index 5d08d21e9b8a..683abbff2e05 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -175,6 +175,7 @@ export ENABLE_SYMBOLS=@ENABLE_SYMBOLS@
export ENABLE_VALGRIND=@ENABLE_VALGRIND@
export ENABLE_VLC=@ENABLE_VLC@
export ENABLE_WERROR=@ENABLE_WERROR@
+export ENDIANNESS=@ENDIANNESS@
export EPM=@EPM@
export EPM_FLAGS=@EPM_FLAGS@
export EPUBGEN_CFLAGS=$(gb_SPACE)@EPUBGEN_CFLAGS@
diff --git a/configure.ac b/configure.ac
index 4176ef077b0a..38a39a35ebbb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -812,6 +812,13 @@ haiku*)
;;
esac
+if test "$_os" != "WINNT"; then
+AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
+else
+ENDIANNESS=little
+fi
+AC_SUBST(ENDIANNESS)
+
if test "$_os" = "Android" ; then
# Verify that the NDK and SDK options are proper
if test -z "$with_android_ndk"; then
diff --git a/dbaccess/CppunitTest_dbaccess_firebird_regression_test.mk b/dbaccess/CppunitTest_dbaccess_firebird_regression_test.mk
new file mode 100644
index 000000000000..654d2f6168cc
--- /dev/null
+++ b/dbaccess/CppunitTest_dbaccess_firebird_regression_test.mk
@@ -0,0 +1,70 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_CppunitTest_CppunitTest,dbaccess_firebird_regression))
+
+$(eval $(call gb_CppunitTest_use_external,dbaccess_firebird_regression,boost_headers))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,dbaccess_firebird_regression, \
+ dbaccess/qa/unit/firebird-regression \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,dbaccess_firebird_regression, \
+ comphelper \
+ cppu \
+ dbaxml \
+ firebird_sdbc \
+ sal \
+ subsequenttest \
+ svt \
+ test \
+ unotest \
+ utl \
+ xo \
+))
+
+$(eval $(call gb_CppunitTest_use_api,dbaccess_firebird_regression,\
+ offapi \
+ oovbaapi \
+ udkapi \
+))
+
+$(eval $(call gb_CppunitTest_use_ure,dbaccess_firebird_regression))
+$(eval $(call gb_CppunitTest_use_vcl,dbaccess_firebird_regression))
+
+$(eval $(call gb_CppunitTest_use_components,dbaccess_firebird_regression,\
+ basic/util/sb \
+ comphelper/util/comphelp \
+ configmgr/source/configmgr \
+ connectivity/source/drivers/firebird/firebird_sdbc \
+ connectivity/source/manager/sdbc2 \
+ dbaccess/util/dba \
+ dbaccess/source/filter/xml/dbaxml \
+ dbaccess/util/dbu \
+ filter/source/config/cache/filterconfig1 \
+ framework/util/fwk \
+ i18npool/util/i18npool \
+ linguistic/source/lng \
+ package/source/xstor/xstor \
+ package/util/package2 \
+ sax/source/expatwrap/expwrap \
+ sfx2/util/sfx \
+ svl/source/fsstor/fsstorage \
+ svl/util/svl \
+ toolkit/util/tk \
+ ucb/source/core/ucb1 \
+ ucb/source/ucp/file/ucpfile1 \
+ unotools/util/utl \
+ uui/util/uui \
+ xmloff/util/xo \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,dbaccess_firebird_regression))
+
+# vim: set noet sw=4 ts=4:
diff --git a/dbaccess/CppunitTest_dbaccess_firebird_test.mk b/dbaccess/CppunitTest_dbaccess_firebird_test.mk
index 5065520993e2..88592d922cbd 100644
--- a/dbaccess/CppunitTest_dbaccess_firebird_test.mk
+++ b/dbaccess/CppunitTest_dbaccess_firebird_test.mk
@@ -7,15 +7,15 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
-$(eval $(call gb_CppunitTest_CppunitTest,dbaccess_firebird_test))
+$(eval $(call gb_CppunitTest_CppunitTest,dbaccess_firebird))
-$(eval $(call gb_CppunitTest_use_external,dbaccess_firebird_test,boost_headers))
+$(eval $(call gb_CppunitTest_use_external,dbaccess_firebird,boost_headers))
-$(eval $(call gb_CppunitTest_add_exception_objects,dbaccess_firebird_test, \
+$(eval $(call gb_CppunitTest_add_exception_objects,dbaccess_firebird, \
dbaccess/qa/unit/firebird \
))
-$(eval $(call gb_CppunitTest_use_libraries,dbaccess_firebird_test, \
+$(eval $(call gb_CppunitTest_use_libraries,dbaccess_firebird, \
comphelper \
cppu \
dbaxml \
@@ -29,16 +29,16 @@ $(eval $(call gb_CppunitTest_use_libraries,dbaccess_firebird_test, \
xo \
))
-$(eval $(call gb_CppunitTest_use_api,dbaccess_firebird_test,\
+$(eval $(call gb_CppunitTest_use_api,dbaccess_firebird,\
offapi \
oovbaapi \
udkapi \
))
-$(eval $(call gb_CppunitTest_use_ure,dbaccess_firebird_test))
-$(eval $(call gb_CppunitTest_use_vcl,dbaccess_firebird_test))
+$(eval $(call gb_CppunitTest_use_ure,dbaccess_firebird))
+$(eval $(call gb_CppunitTest_use_vcl,dbaccess_firebird))
-$(eval $(call gb_CppunitTest_use_components,dbaccess_firebird_test,\
+$(eval $(call gb_CppunitTest_use_components,dbaccess_firebird,\
basic/util/sb \
comphelper/util/comphelp \
configmgr/source/configmgr \
@@ -65,6 +65,6 @@ $(eval $(call gb_CppunitTest_use_components,dbaccess_firebird_test,\
xmloff/util/xo \
))
-$(eval $(call gb_CppunitTest_use_configuration,dbaccess_firebird_test))
+$(eval $(call gb_CppunitTest_use_configuration,dbaccess_firebird))
# vim: set noet sw=4 ts=4:
diff --git a/dbaccess/Module_dbaccess.mk b/dbaccess/Module_dbaccess.mk
index 9bc2253f7465..ddcda98eda9d 100644
--- a/dbaccess/Module_dbaccess.mk
+++ b/dbaccess/Module_dbaccess.mk
@@ -34,6 +34,12 @@ $(eval $(call gb_Module_add_l10n_targets,dbaccess,\
ifneq ($(OS),IOS)
ifeq ($(ENABLE_FIREBIRD_SDBC),TRUE)
+# remove if we have a be file for this
+ifeq ($(ENDIANNESS),little)
+$(eval $(call gb_Module_add_check_targets,dbaccess,\
+ CppunitTest_dbaccess_firebird_regression_test \
+))
+endif
$(eval $(call gb_Module_add_check_targets,dbaccess,\
CppunitTest_dbaccess_firebird_test \
))
diff --git a/dbaccess/qa/unit/data/firebird_empty.odb b/dbaccess/qa/unit/data/firebird_empty.odb
index 766c17db2ec9..9aabfd47b059 100644
--- a/dbaccess/qa/unit/data/firebird_empty.odb
+++ b/dbaccess/qa/unit/data/firebird_empty.odb
Binary files differ
diff --git a/dbaccess/qa/unit/data/firebird_empty_le.odb b/dbaccess/qa/unit/data/firebird_empty_le.odb
new file mode 100644
index 000000000000..766c17db2ec9
--- /dev/null
+++ b/dbaccess/qa/unit/data/firebird_empty_le.odb
Binary files differ
diff --git a/dbaccess/qa/unit/data/firebird_integer_x64le.odb b/dbaccess/qa/unit/data/firebird_integer_le.odb
index da2ec1499198..da2ec1499198 100644
--- a/dbaccess/qa/unit/data/firebird_integer_x64le.odb
+++ b/dbaccess/qa/unit/data/firebird_integer_le.odb
Binary files differ
diff --git a/dbaccess/qa/unit/data/firebird_integer_x64le_ods12.odb b/dbaccess/qa/unit/data/firebird_integer_le_ods12.odb
index 95691ed20585..95691ed20585 100644
--- a/dbaccess/qa/unit/data/firebird_integer_x64le_ods12.odb
+++ b/dbaccess/qa/unit/data/firebird_integer_le_ods12.odb
Binary files differ
diff --git a/dbaccess/qa/unit/data/firebird_integer_ods12.odb b/dbaccess/qa/unit/data/firebird_integer_ods12.odb
new file mode 100644
index 000000000000..642b038dd78b
--- /dev/null
+++ b/dbaccess/qa/unit/data/firebird_integer_ods12.odb
Binary files differ
diff --git a/dbaccess/qa/unit/firebird-regression.cxx b/dbaccess/qa/unit/firebird-regression.cxx
new file mode 100644
index 000000000000..5474f48405d0
--- /dev/null
+++ b/dbaccess/qa/unit/firebird-regression.cxx
@@ -0,0 +1,108 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "dbtest_base.cxx"
+
+#include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp>
+#include <com/sun/star/sdbc/XColumnLocate.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/sdbc/XResultSet.hpp>
+#include <com/sun/star/sdbc/XRow.hpp>
+#include <com/sun/star/sdbc/XStatement.hpp>
+#include <svtools/miscopt.hxx>
+#include <config_firebird.h>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::sdb;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::uno;
+
+class FirebirdTest
+ : public DBTestBase
+{
+public:
+ void testEmptyDBConnection();
+ void testIntegerDatabase();
+
+ CPPUNIT_TEST_SUITE(FirebirdTest);
+ CPPUNIT_TEST(testEmptyDBConnection);
+ CPPUNIT_TEST(testIntegerDatabase);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+/**
+ * Test the loading of an "empty" file, i.e. the embedded database has not yet
+ * been initialised (as occurs when a new .odb is created and opened by base).
+ */
+void FirebirdTest::testEmptyDBConnection()
+{
+#ifdef OSL_BIGENDIAN
+ auto const tmp = createTempCopy("firebird_empty_be.odb");
+#else
+ auto const tmp = createTempCopy("firebird_empty_le.odb");
+#endif
+ uno::Reference< XOfficeDatabaseDocument > xDocument =
+ getDocumentForUrl(tmp.GetURL());
+
+ getConnectionForDocument(xDocument);
+
+ closeDocument(uno::Reference<lang::XComponent>(xDocument, uno::UNO_QUERY));
+}
+
+/**
+ * Test reading of integers from a known .odb to verify that the data
+ * can still be read on all systems.
+ */
+void FirebirdTest::testIntegerDatabase()
+{
+#ifdef OSL_BIGENDIAN
+ uno::Reference< XOfficeDatabaseDocument > xDocument =
+ getDocumentForFileName("firebird_integer_be_ods12.odb");
+#else
+ uno::Reference< XOfficeDatabaseDocument > xDocument =
+ getDocumentForFileName("firebird_integer_le_ods12.odb");
+#endif
+
+ uno::Reference< XConnection > xConnection =
+ getConnectionForDocument(xDocument);
+
+ uno::Reference< XStatement > xStatement = xConnection->createStatement();
+ CPPUNIT_ASSERT(xStatement.is());
+
+ uno::Reference< XResultSet > xResultSet = xStatement->executeQuery(
+ "SELECT * FROM TESTTABLE");
+ CPPUNIT_ASSERT(xResultSet.is());
+ CPPUNIT_ASSERT(xResultSet->next());
+
+ uno::Reference< XRow > xRow(xResultSet, UNO_QUERY);
+ CPPUNIT_ASSERT(xRow.is());
+ uno::Reference< XColumnLocate > xColumnLocate(xRow, UNO_QUERY);
+ CPPUNIT_ASSERT(xColumnLocate.is());
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(-30000),
+ xRow->getShort(xColumnLocate->findColumn("_SMALLINT")));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(-2100000000),
+ xRow->getInt(xColumnLocate->findColumn("_INT")));
+ CPPUNIT_ASSERT_EQUAL(SAL_CONST_INT64(-9000000000000000000),
+ xRow->getLong(xColumnLocate->findColumn("_BIGINT")));
+ CPPUNIT_ASSERT_EQUAL(OUString("5"),
+ xRow->getString(xColumnLocate->findColumn("_CHAR")));
+ CPPUNIT_ASSERT_EQUAL(OUString("5"),
+ xRow->getString(xColumnLocate->findColumn("_VARCHAR")));
+
+ CPPUNIT_ASSERT(!xResultSet->next()); // Should only be one row
+
+ closeDocument(uno::Reference<lang::XComponent>(xDocument, uno::UNO_QUERY));
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(FirebirdTest);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/qa/unit/firebird.cxx b/dbaccess/qa/unit/firebird.cxx
index db907d857b45..c3652b7debd1 100644
--- a/dbaccess/qa/unit/firebird.cxx
+++ b/dbaccess/qa/unit/firebird.cxx
@@ -58,7 +58,7 @@ void FirebirdTest::testEmptyDBConnection()
void FirebirdTest::testIntegerDatabase()
{
uno::Reference< XOfficeDatabaseDocument > xDocument =
- getDocumentForFileName("firebird_integer_x64le_ods12.odb");
+ getDocumentForFileName("firebird_integer_ods12.odb");
uno::Reference< XConnection > xConnection =
getConnectionForDocument(xDocument);
diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist
index 3c7af57a2af8..ebf7c2ed369a 100644
--- a/solenv/clang-format/blacklist
+++ b/solenv/clang-format/blacklist
@@ -3046,6 +3046,7 @@ dbaccess/qa/unit/dbaccess-dialogs-test.cxx
dbaccess/qa/unit/dbtest_base.cxx
dbaccess/qa/unit/embeddeddb_performancetest.cxx
dbaccess/qa/unit/firebird.cxx
+dbaccess/qa/unit/firebird-regression.cxx
dbaccess/qa/unit/hsqldb.cxx
dbaccess/source/core/api/BookmarkSet.cxx
dbaccess/source/core/api/BookmarkSet.hxx