Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Tests failing in Microsoft.Data.Sqlite on unchanged clone #35424

Open
davemateer opened this issue Jan 7, 2025 · 8 comments
Open

Tests failing in Microsoft.Data.Sqlite on unchanged clone #35424

davemateer opened this issue Jan 7, 2025 · 8 comments

Comments

@davemateer
Copy link

I'm looking to potentially get involved contributing this year, but am having a little trouble getting started. I have gone through the documents on getting set up, and while the build completes without errors, I am getting 9 failed tests before making any code changes. I'm sure this is just something on my local machine, but am having trouble determining what the issue might be.

All failing tests are in Microsoft.Data.Sqlite.sqlite3.Tests, and look to be pretty much all Microsoft.Data.Sqlite.SqliteBlobTest.Read_works, Microsoft.Data.Sqlite.SqliteBlobTest.Write_works, and Microsoft.Data.Sqlite.SqliteDataReaderTest.GetTextReader_works_streaming tests. The same exception is being thrown for all of them:

Microsoft.Data.Sqlite.SqliteException : SQLite Error 1: 'SQL logic error'.

Here is a representative stack trace:

Microsoft.Data.Sqlite.SqliteBlobTest.Read_works(expectedBytesRead: 0, expectedBuffer: [], initialPosition: 0, offset: 0, count: 0)
Microsoft.Data.Sqlite.SqliteException : SQLite Error 1: 'SQL logic error'.
   at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db) in /Users/dave/code/efcore/src/Microsoft.Data.Sqlite.Core/SqliteException.cs:line 84
   at Microsoft.Data.Sqlite.SqliteBlob.Read(Span`1 buffer) in /Users/dave/code/efcore/src/Microsoft.Data.Sqlite.Core/SqliteBlob.cs:line 210
   at Microsoft.Data.Sqlite.SqliteBlob.Read(Byte[] buffer, Int32 offset, Int32 count) in /Users/dave/code/efcore/src/Microsoft.Data.Sqlite.Core/SqliteBlob.cs:line 170
   at Microsoft.Data.Sqlite.SqliteBlobTest.Read_works(Int32 expectedBytesRead, Byte[] expectedBuffer, Int64 initialPosition, Int32 offset, Int32 count) in /Users/dave/code/efcore/test/Microsoft.Data.Sqlite.Tests/SqliteBlobTest.cs:line 153
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithManyArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

In case it makes a difference, I am working on MacOS Sequoia 15.2 (M2 Chip), and as of the time this issue was written, commit c434d6cc793f5157a677bc08b7743dbdaf14393c

@cincuranet
Copy link
Contributor

For CI builds we're using this image at the moment. Maybe it's time to update to newer image (#35437).

@roji do you have Sequoia 15.2 on your machine? Can you try it on your side?

@roji
Copy link
Member

roji commented Jan 9, 2025

Yeah, I have Sequoia 15.2, doing dotnet test in EFCore.Sqlite.FunctionalTests works with no issues:

Test summary: total: 37176, failed: 0, succeeded: 36818, skipped: 358, duration: 123.6s
Build succeeded with 8 warning(s) in 194.3s

@cincuranet
Copy link
Contributor

Running on 15 as part of CI (#35440) fails with same tests failing. I'll try to investigate.

@cincuranet
Copy link
Contributor

cincuranet commented Jan 14, 2025

At least on our CI only Microsoft.Data.Sqlite.sqlite3.Tests is failing. That one is using SQLitePCLRaw.bundle_sqlite3, which uses system-provided SQLite. On the CI image that's 3.43.2.

@davemateer Can you check what version you have in your system?
@roji Can you check what version you have in your system?

I'll keep working.

@roji
Copy link
Member

roji commented Jan 14, 2025

Doing brew show sqlite on my system reports 3.47.2 (I'm not 100% sure whether we use the system-installed version, or a version bundled with the nuget though... I think the former). Assuming my system version is used, that would fit well with this simply being a version problem: a recent version of Sqlite may be required to run these tests for whatever reason...

@cincuranet
Copy link
Contributor

You can run SqliteConnectionTest.ServerVersion_returns_value in Microsoft.Data.Sqlite.sqlite3.Tests and check the ServerVersion property there (to be really sure).

@roji
Copy link
Member

roji commented Jan 14, 2025

Sorry, my bad - above I accidentally ran the EF SQLite tests, not the M.D.Sqlite ones. Running the

~/projects/efcore/.dotnet/dotnet test -f net10.0 Microsoft.Data.Sqlite.sqlite3.Tests.csproj

... I indeed get the "SQL logic error" reported here; so this reproes here. The version report from the test ServerVersion_returns_value is 3.43.2.

Let me know how else I can help!

@davemateer
Copy link
Author

davemateer commented Jan 17, 2025

Assuming I am checking correctly, and there aren't multiple versions that could be loaded, I'm running 3.43.2:

sqlite3 --version
3.43.2 2023-10-10 13:08:14 1b37c146ee9ebb7acd0160c0ab1fd11017a419fa8a3187386ed8cb32b709aapl (64-bit)

Getting the latest via homebrew and changing the PATH in the terminal did not make a difference:

export PATH="/opt/homebrew/Cellar/sqlite/3.48.0/bin:$PATH"
sqlite3 --version
3.48.0 2025-01-14 11:05:00 d2fe6b05f38d9d7cd78c5d252e99ac59f1aea071d669830c1ffe4e8966e84010 (64-bit)

Same errors, unfortunately.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

3 participants