SRombauts / SQLiteCpp

SQLiteC++ (SQLiteCpp) is a smart and easy to use C++ SQLite3 wrapper.
http://srombauts.github.io/SQLiteCpp
MIT License
2.19k stars 509 forks source link

23 tests fail #481

Closed yurivict closed 3 weeks ago

yurivict commented 3 weeks ago
$ cat /usr/ports/databases/sqlitecpp/work/.build/Testing/Temporary/LastTest.log 
Start testing: Aug 16 22:27 PDT
----------------------------------------------------------
1/1 Testing: UnitTests
1/1 Test: UnitTests
Command: "/usr/ports/databases/sqlitecpp/work/.build/bin/SQLiteCpp_tests"
Directory: /usr/ports/databases/sqlitecpp/work/.build
"UnitTests" start time: Aug 16 22:27 PDT
Output:
----------------------------------------------------------
Running main() from /wrkdirs/usr/ports/devel/googletest/work/googletest-1.15.0/googletest/src/gtest_main.cc
[==========] Running 48 tests from 9 test suites.
[----------] Global test environment set-up.
[----------] 5 tests from Column
[ RUN      ] Column.basis
unknown file: Failure
C++ exception with description "no such column: "first" - should this be a string literal in single-quotes?" thrown in the test body.

[  FAILED  ] Column.basis (1 ms)
[ RUN      ] Column.basis16
unknown file: Failure
C++ exception with description "no such column: "first" - should this be a string literal in single-quotes?" thrown in the test body.

[  FAILED  ] Column.basis16 (0 ms)
[ RUN      ] Column.getName
unknown file: Failure
C++ exception with description "no such column: "first" - should this be a string literal in single-quotes?" thrown in the test body.

[  FAILED  ] Column.getName (0 ms)
[ RUN      ] Column.stream
[       OK ] Column.stream (0 ms)
[ RUN      ] Column.shared_ptr
unknown file: Failure
C++ exception with description "no such column: "fortytwo" - should this be a string literal in single-quotes?" thrown in the test body.

[  FAILED  ] Column.shared_ptr (0 ms)
[----------] 5 tests from Column (3 ms total)

[----------] 15 tests from Database
[ RUN      ] Database.ctorExecCreateDropExist
[       OK ] Database.ctorExecCreateDropExist (24 ms)
[ RUN      ] Database.moveConstructor
[       OK ] Database.moveConstructor (0 ms)
[ RUN      ] Database.createCloseReopen
[       OK ] Database.createCloseReopen (9 ms)
[ RUN      ] Database.inMemory
[       OK ] Database.inMemory (0 ms)
[ RUN      ] Database.backup
[       OK ] Database.backup (9 ms)
[ RUN      ] Database.busyTimeout
[       OK ] Database.busyTimeout (0 ms)
[ RUN      ] Database.exec
unknown file: Failure
C++ exception with description "no such column: "first" - should this be a string literal in single-quotes?" thrown in the test body.

[  FAILED  ] Database.exec (0 ms)
[ RUN      ] Database.tryExec
/usr/ports/databases/sqlitecpp/work/SQLiteCpp-3.3.2/tests/Database_test.cpp:290: Failure
Expected equality of these values:
  SQLite::OK
    Which is: 0
  db.tryExec("INSERT INTO test VALUES (NULL, \"first\")")
    Which is: 1

/usr/ports/databases/sqlitecpp/work/SQLiteCpp-3.3.2/tests/Database_test.cpp:291: Failure
Expected equality of these values:
  1
  db.getChanges()
    Which is: 0

/usr/ports/databases/sqlitecpp/work/SQLiteCpp-3.3.2/tests/Database_test.cpp:292: Failure
Expected equality of these values:
  1
  db.getLastInsertRowid()
    Which is: 0

/usr/ports/databases/sqlitecpp/work/SQLiteCpp-3.3.2/tests/Database_test.cpp:293: Failure
Expected equality of these values:
  1
  db.getTotalChanges()
    Which is: 0

/usr/ports/databases/sqlitecpp/work/SQLiteCpp-3.3.2/tests/Database_test.cpp:296: Failure
Expected equality of these values:
  SQLite::OK
    Which is: 0
  db.tryExec("INSERT INTO test VALUES (NULL, \"second\")")
    Which is: 1

/usr/ports/databases/sqlitecpp/work/SQLiteCpp-3.3.2/tests/Database_test.cpp:297: Failure
Expected equality of these values:
  1
  db.getChanges()
    Which is: 0

/usr/ports/databases/sqlitecpp/work/SQLiteCpp-3.3.2/tests/Database_test.cpp:298: Failure
Expected equality of these values:
  2
  db.getLastInsertRowid()
    Which is: 0

/usr/ports/databases/sqlitecpp/work/SQLiteCpp-3.3.2/tests/Database_test.cpp:299: Failure
Expected equality of these values:
  2
  db.getTotalChanges()
    Which is: 0

/usr/ports/databases/sqlitecpp/work/SQLiteCpp-3.3.2/tests/Database_test.cpp:303: Failure
Expected equality of these values:
  SQLite::OK
    Which is: 0
  db.tryExec(insert)
    Which is: 1

/usr/ports/databases/sqlitecpp/work/SQLiteCpp-3.3.2/tests/Database_test.cpp:304: Failure
Expected equality of these values:
  1
  db.getChanges()
    Which is: 0

/usr/ports/databases/sqlitecpp/work/SQLiteCpp-3.3.2/tests/Database_test.cpp:305: Failure
Expected equality of these values:
  3
  db.getLastInsertRowid()
    Which is: 0

/usr/ports/databases/sqlitecpp/work/SQLiteCpp-3.3.2/tests/Database_test.cpp:306: Failure
Expected equality of these values:
  3
  db.getTotalChanges()
    Which is: 0

/usr/ports/databases/sqlitecpp/work/SQLiteCpp-3.3.2/tests/Database_test.cpp:309: Failure
Expected equality of these values:
  SQLite::OK
    Which is: 0
  db.tryExec("UPDATE test SET value=\"second-updated\" WHERE id='2'")
    Which is: 1

/usr/ports/databases/sqlitecpp/work/SQLiteCpp-3.3.2/tests/Database_test.cpp:310: Failure
Expected equality of these values:
  1
  db.getChanges()
    Which is: 0

/usr/ports/databases/sqlitecpp/work/SQLiteCpp-3.3.2/tests/Database_test.cpp:311: Failure
Expected equality of these values:
  3
  db.getLastInsertRowid()
    Which is: 0

/usr/ports/databases/sqlitecpp/work/SQLiteCpp-3.3.2/tests/Database_test.cpp:312: Failure
Expected equality of these values:
  4
  db.getTotalChanges()
    Which is: 0

/usr/ports/databases/sqlitecpp/work/SQLiteCpp-3.3.2/tests/Database_test.cpp:316: Failure
Expected equality of these values:
  1
  db.getChanges()
    Which is: 0

/usr/ports/databases/sqlitecpp/work/SQLiteCpp-3.3.2/tests/Database_test.cpp:317: Failure
Expected equality of these values:
  3
  db.getLastInsertRowid()
    Which is: 0

/usr/ports/databases/sqlitecpp/work/SQLiteCpp-3.3.2/tests/Database_test.cpp:318: Failure
Expected equality of these values:
  5
  db.getTotalChanges()
    Which is: 0

/usr/ports/databases/sqlitecpp/work/SQLiteCpp-3.3.2/tests/Database_test.cpp:323: Failure
Expected equality of these values:
  5
  db.getTotalChanges()
    Which is: 0

/usr/ports/databases/sqlitecpp/work/SQLiteCpp-3.3.2/tests/Database_test.cpp:327: Failure
Expected equality of these values:
  5
  db.getTotalChanges()
    Which is: 0

/usr/ports/databases/sqlitecpp/work/SQLiteCpp-3.3.2/tests/Database_test.cpp:330: Failure
Expected equality of these values:
  SQLite::OK
    Which is: 0
  db.tryExec("INSERT INTO test VALUES (NULL, \"first\");INSERT INTO test VALUES (NULL, \"second\");")
    Which is: 1

/usr/ports/databases/sqlitecpp/work/SQLiteCpp-3.3.2/tests/Database_test.cpp:331: Failure
Expected equality of these values:
  1
  db.getChanges()
    Which is: 0

/usr/ports/databases/sqlitecpp/work/SQLiteCpp-3.3.2/tests/Database_test.cpp:332: Failure
Expected equality of these values:
  2
  db.getLastInsertRowid()
    Which is: 0

/usr/ports/databases/sqlitecpp/work/SQLiteCpp-3.3.2/tests/Database_test.cpp:333: Failure
Expected equality of these values:
  7
  db.getTotalChanges()
    Which is: 0

/usr/ports/databases/sqlitecpp/work/SQLiteCpp-3.3.2/tests/Database_test.cpp:337: Failure
Expected equality of these values:
  SQLite::OK
    Which is: 0
  db.tryExec("INSERT INTO test VALUES (NULL, \"third\"), (NULL, \"fourth\");")
    Which is: 1

/usr/ports/databases/sqlitecpp/work/SQLiteCpp-3.3.2/tests/Database_test.cpp:338: Failure
Expected equality of these values:
  2
  db.getChanges()
    Which is: 0

/usr/ports/databases/sqlitecpp/work/SQLiteCpp-3.3.2/tests/Database_test.cpp:339: Failure
Expected equality of these values:
  4
  db.getLastInsertRowid()
    Which is: 0

/usr/ports/databases/sqlitecpp/work/SQLiteCpp-3.3.2/tests/Database_test.cpp:340: Failure
Expected equality of these values:
  9
  db.getTotalChanges()
    Which is: 0

[  FAILED  ] Database.tryExec (2 ms)
[ RUN      ] Database.execAndGet
unknown file: Failure
C++ exception with description "no such column: "first" - should this be a string literal in single-quotes?" thrown in the test body.

[  FAILED  ] Database.execAndGet (0 ms)
[ RUN      ] Database.execException
unknown file: Failure
C++ exception with description "no such column: "first" - should this be a string literal in single-quotes?" thrown in the test body.

[  FAILED  ] Database.execException (0 ms)
[ RUN      ] Database.tryExecError
/usr/ports/databases/sqlitecpp/work/SQLiteCpp-3.3.2/tests/Database_test.cpp:432: Failure
Expected equality of these values:
  "table test has 3 columns but 4 values were supplied"
  db.getErrorMsg()
    Which is: "no such column: \"first\" - should this be a string literal in single-quotes?"

/usr/ports/databases/sqlitecpp/work/SQLiteCpp-3.3.2/tests/Database_test.cpp:435: Failure
Expected equality of these values:
  SQLite::OK
    Which is: 0
  db.tryExec("INSERT INTO test VALUES (NULL, \"first\",  3)")
    Which is: 1

/usr/ports/databases/sqlitecpp/work/SQLiteCpp-3.3.2/tests/Database_test.cpp:436: Failure
Expected equality of these values:
  1
  db.getLastInsertRowid()
    Which is: 0

/usr/ports/databases/sqlitecpp/work/SQLiteCpp-3.3.2/tests/Database_test.cpp:439: Failure
Expected equality of these values:
  19
  db.tryExec("INSERT INTO test VALUES (1, \"impossible\", 456)")
    Which is: 1

/usr/ports/databases/sqlitecpp/work/SQLiteCpp-3.3.2/tests/Database_test.cpp:440: Failure
Expected equality of these values:
  19
  db.getErrorCode()
    Which is: 1

/usr/ports/databases/sqlitecpp/work/SQLiteCpp-3.3.2/tests/Database_test.cpp:441: Failure
Expected equality of these values:
  (19 | (6<<8))
    Which is: 1555
  db.getExtendedErrorCode()
    Which is: 1

/usr/ports/databases/sqlitecpp/work/SQLiteCpp-3.3.2/tests/Database_test.cpp:442: Failure
Expected equality of these values:
  "UNIQUE constraint failed: test.id"
  db.getErrorMsg()
    Which is: "no such column: \"impossible\" - should this be a string literal in single-quotes?"

[  FAILED  ] Database.tryExecError (0 ms)
[ RUN      ] Database.createFunction
unknown file: Failure
C++ exception with description "no such column: "first" - should this be a string literal in single-quotes?" thrown in the test body.

[  FAILED  ] Database.createFunction (0 ms)
[ RUN      ] Database.loadExtension
[       OK ] Database.loadExtension (0 ms)
[ RUN      ] Database.getHeaderInfo
[       OK ] Database.getHeaderInfo (43 ms)
[ RUN      ] Database.encryptAndDecrypt
[       OK ] Database.encryptAndDecrypt (11 ms)
[----------] 15 tests from Database (106 ms total)

[----------] 1 test from Savepoint
[ RUN      ] Savepoint.commitRollback
SQLite exception: near "DesiredSyntaxError": syntax error
[       OK ] Savepoint.commitRollback (0 ms)
[----------] 1 test from Savepoint (0 ms total)

[----------] 16 tests from Statement
[ RUN      ] Statement.invalid
unknown file: Failure
C++ exception with description "no such column: "first" - should this be a string literal in single-quotes?" thrown in the test body.

[  FAILED  ] Statement.invalid (0 ms)
[ RUN      ] Statement.moveConstructor
unknown file: Failure
C++ exception with description "no such column: "first" - should this be a string literal in single-quotes?" thrown in the test body.

[  FAILED  ] Statement.moveConstructor (0 ms)
[ RUN      ] Statement.executeStep
unknown file: Failure
C++ exception with description "no such column: "first" - should this be a string literal in single-quotes?" thrown in the test body.

[  FAILED  ] Statement.executeStep (0 ms)
[ RUN      ] Statement.tryExecuteStep
unknown file: Failure
C++ exception with description "no such column: "first" - should this be a string literal in single-quotes?" thrown in the test body.

[  FAILED  ] Statement.tryExecuteStep (0 ms)
[ RUN      ] Statement.bindings
[       OK ] Statement.bindings (0 ms)
[ RUN      ] Statement.bindNoCopy
[       OK ] Statement.bindNoCopy (0 ms)
[ RUN      ] Statement.bindByName
[       OK ] Statement.bindByName (0 ms)
[ RUN      ] Statement.bindByNameString
[       OK ] Statement.bindByNameString (0 ms)
[ RUN      ] Statement.bindNoCopyByName
[       OK ] Statement.bindNoCopyByName (0 ms)
[ RUN      ] Statement.isColumnNull
unknown file: Failure
C++ exception with description "no such column: "first" - should this be a string literal in single-quotes?" thrown in the test body.

[  FAILED  ] Statement.isColumnNull (0 ms)
[ RUN      ] Statement.isColumnNullByName
unknown file: Failure
C++ exception with description "no such column: "first" - should this be a string literal in single-quotes?" thrown in the test body.

[  FAILED  ] Statement.isColumnNullByName (0 ms)
[ RUN      ] Statement.getColumnByName
unknown file: Failure
C++ exception with description "no such column: "first" - should this be a string literal in single-quotes?" thrown in the test body.

[  FAILED  ] Statement.getColumnByName (0 ms)
[ RUN      ] Statement.getName
[       OK ] Statement.getName (0 ms)
[ RUN      ] Statement.getColumnDeclaredType
[       OK ] Statement.getColumnDeclaredType (0 ms)
[ RUN      ] Statement.getColumns
unknown file: Failure
C++ exception with description "no such column: "first" - should this be a string literal in single-quotes?" thrown in the test body.

[  FAILED  ] Statement.getColumns (0 ms)
[ RUN      ] Statement.getBindParameterCount
[       OK ] Statement.getBindParameterCount (0 ms)
[----------] 16 tests from Statement (7 ms total)

[----------] 4 tests from Backup
[ RUN      ] Backup.initException
unknown file: Failure
C++ exception with description "no such column: "first" - should this be a string literal in single-quotes?" thrown in the test body.

[  FAILED  ] Backup.initException (10 ms)
[ RUN      ] Backup.executeStepOne
unknown file: Failure
C++ exception with description "no such column: "first" - should this be a string literal in single-quotes?" thrown in the test body.

[  FAILED  ] Backup.executeStepOne (9 ms)
[ RUN      ] Backup.executeStepAll
unknown file: Failure
C++ exception with description "no such column: "first" - should this be a string literal in single-quotes?" thrown in the test body.

[  FAILED  ] Backup.executeStepAll (10 ms)
[ RUN      ] Backup.executeStepException
unknown file: Failure
C++ exception with description "no such column: "first" - should this be a string literal in single-quotes?" thrown in the test body.

[  FAILED  ] Backup.executeStepException (9 ms)
[----------] 4 tests from Backup (40 ms total)

[----------] 1 test from Transaction
[ RUN      ] Transaction.commitRollback
unknown file: Failure
C++ exception with description "no such column: "first" - should this be a string literal in single-quotes?" thrown in the test body.

[  FAILED  ] Transaction.commitRollback (0 ms)
[----------] 1 test from Transaction (0 ms total)

[----------] 1 test from VariadicBind
[ RUN      ] VariadicBind.invalid
[       OK ] VariadicBind.invalid (0 ms)
[----------] 1 test from VariadicBind (0 ms total)

[----------] 4 tests from Exception
[ RUN      ] Exception.copy
[       OK ] Exception.copy (0 ms)
[ RUN      ] Exception.assignment
[       OK ] Exception.assignment (0 ms)
[ RUN      ] Exception.throw_catch
[       OK ] Exception.throw_catch (0 ms)
[ RUN      ] Exception.constructor
[       OK ] Exception.constructor (0 ms)
[----------] 4 tests from Exception (0 ms total)

[----------] 1 test from ExecuteMany
[ RUN      ] ExecuteMany.invalid
[       OK ] ExecuteMany.invalid (0 ms)
[----------] 1 test from ExecuteMany (0 ms total)

[----------] Global test environment tear-down
[==========] 48 tests from 9 test suites ran. (160 ms total)
[  PASSED  ] 25 tests.
[  FAILED  ] 23 tests, listed below:
[  FAILED  ] Column.basis
[  FAILED  ] Column.basis16
[  FAILED  ] Column.getName
[  FAILED  ] Column.shared_ptr
[  FAILED  ] Database.exec
[  FAILED  ] Database.tryExec
[  FAILED  ] Database.execAndGet
[  FAILED  ] Database.execException
[  FAILED  ] Database.tryExecError
[  FAILED  ] Database.createFunction
[  FAILED  ] Statement.invalid
[  FAILED  ] Statement.moveConstructor
[  FAILED  ] Statement.executeStep
[  FAILED  ] Statement.tryExecuteStep
[  FAILED  ] Statement.isColumnNull
[  FAILED  ] Statement.isColumnNullByName
[  FAILED  ] Statement.getColumnByName
[  FAILED  ] Statement.getColumns
[  FAILED  ] Backup.initException
[  FAILED  ] Backup.executeStepOne
[  FAILED  ] Backup.executeStepAll
[  FAILED  ] Backup.executeStepException
[  FAILED  ] Transaction.commitRollback

23 FAILED TESTS
<end of output>
Test time =   0.17 sec
----------------------------------------------------------
Test Failed.
"UnitTests" end time: Aug 16 22:27 PDT
"UnitTests" time elapsed: 00:00:00
----------------------------------------------------------

End testing: Aug 16 22:27 PDT

Version: 3.3.2 FreeBSD 14.1

SRombauts commented 3 weeks ago

Hi @yurivict, thanks for the report. Is this a regression of 3.3.2 from 3.3.1? Can you provide any other useful context, like the CMake logs, OS and SQLite lib informations? Sébastien

yurivict commented 3 weeks ago

3.3.0 and 3.3.1 also had the same problem.

cmake logs:

===>  Configuring for sqlitecpp-3.3.2
===>  Performing out-of-source build
/bin/mkdir -p /usr/ports/databases/sqlitecpp/work/.build
-- The C compiler identification is Clang 18.1.5
-- The CXX compiler identification is Clang 18.1.5
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/local/libexec/ccache/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/local/libexec/ccache/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Using c++ standard c++11
-- CMake version: 3.29.6
-- Project version: 3.3.2
-- Using Stack Protection hardening
-- CMAKE_CXX_COMPILER '/usr/local/libexec/ccache/c++' 'Clang' '18.1.5'
-- CMAKE_CXX_FLAGS                '-O2 -pipe -fstack-protector-strong -fno-strict-aliasing -Wall -Wextra -Wpedantic -Wswitch-enum -Wshadow -Wno-long-long'
-- CMAKE_CXX_FLAGS_RELEASE        '-O2 -pipe -fstack-protector-strong -fno-strict-aliasing   -DNDEBUG'
-- Found SQLite3: /usr/local/include (found version "3.46.0")
-- Link to sqlite3 system library
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Found Threads: TRUE
-- SQLITECPP_RUN_CPPLINT OFF
-- Found Cppcheck: /usr/local/bin/cppcheck Cppcheck 2.14.2
-- SQLITECPP_RUN_DOXYGEN OFF
-- SQLITECPP_BUILD_EXAMPLES OFF
-- SQLITECPP_BUILD_TESTS OFF
-- Configuring done (1.2s)
-- Generating done (0.0s)
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_CXX_FLAGS_DEBUG
    CMAKE_C_FLAGS_DEBUG
    CMAKE_C_FLAGS_RELEASE
    CMAKE_MODULE_LINKER_FLAGS
    CMAKE_VERBOSE_MAKEFILE
    FETCHCONTENT_FULLY_DISCONNECTED

-- Build files have been written to: /usr/ports/databases/sqlitecpp/work/.build
===>  Testing for sqlitecpp-3.3.2
===>   sqlitecpp-3.3.2 depends on package: googletest>0 - found
-- Using c++ standard c++11
-- CMake version: 3.29.6
-- Project version: 3.3.2
-- Using Stack Protection hardening
-- CMAKE_CXX_COMPILER '/usr/local/libexec/ccache/c++' 'Clang' '18.1.5'
-- CMAKE_CXX_FLAGS                '-O2 -pipe -fstack-protector-strong -fno-strict-aliasing -Wall -Wextra -Wpedantic -Wswitch-enum -Wshadow -Wno-long-long'
-- CMAKE_CXX_FLAGS_RELEASE        '-O2 -pipe -fstack-protector-strong -fno-strict-aliasing   -DNDEBUG'
-- Link to sqlite3 system library
-- SQLITECPP_RUN_CPPLINT OFF
-- Found Cppcheck: /usr/local/bin/cppcheck Cppcheck 2.14.2
-- SQLITECPP_RUN_DOXYGEN OFF
-- SQLITECPP_BUILD_EXAMPLES OFF
-- Found GTest: /usr/local/lib/cmake/GTest/GTestConfig.cmake (found version "1.15.0")
-- Link to GTest system library
-- Configuring done (0.4s)
-- Generating done (0.0s)
-- Build files have been written to: /usr/ports/databases/sqlitecpp/work/.build

OS: FreeBSD 14.1

SRombauts commented 3 weeks ago

Thanks, that's helpful and reassuring. I'll make sure to fix the tests, but I'll want to try to reproduce the issue first

SRombauts commented 3 weeks ago

I found out that the error you have is because the sqlite3 library provided by FreeBSD seems to now be compiled with a more strict option;

The SQLITE_DQS compile-time option activates or deactivates the legacy double-quoted string literal misfeature. Legacy behavior is that double-quoted string literals are allowed anywhere.

I could test by changing myself its value from the default to the new value and could reproduce your issue, and then fix it for good.

Now I see this is a very recent change https://www.reddit.com/r/freebsd/comments/1chb82b/sqlite3_pkg_just_became_stricter_with_quoting/?rdt=64491

yurivict commented 3 weeks ago

The default sqlite3 package has the option DQS=off.

SRombauts commented 3 weeks ago

After more testing on other OSes, I merged the fix. Thanks for the report!

yurivict commented 3 weeks ago

Thanks for fixing it!