ericsink / SQLitePCL.raw

A Portable Class Library (PCL) for low-level (raw) access to SQLite
Apache License 2.0
512 stars 106 forks source link

Adjust encryption tests to check sqlite3mc #567

Closed utelle closed 7 months ago

utelle commented 7 months ago
utelle commented 7 months ago

@ericsink Unfortunately, the encryption tests failed again. The reason is that obviously the test database files were not copied to the working directory of the test application. When a database file is not found SQLite will create a new database file (unless told otherwise). And of course the new empty database file doesn't have the tables that are queried.

I had added the following lines in the test project files:

  <ItemGroup>
    <None Update="..\common\sqlcipher-2.0-beta-testkey.db" CopyToOutputDirectory="PreserveNewest" />
    <None Update="..\common\sqlcipher-4.0-testkey.db" CopyToOutputDirectory="PreserveNewest" />
  </ItemGroup>

That had worked in my own repo, but does not here. What do I have to specify that the database files are copied to the right directory?

ericsink commented 7 months ago

Ah, I see. I hadn't looked at the PR content at all yet, so I didn't notice those new files. Up until now, tests_xunit.cs hasn't needed any dependencies.

The first problem I see is that the two csproj files you modified are not actually the ones used during tests.

Sorry for the confusion -- this repo isn't very intuitive.

Let me take a look at this myself. You've written the tests. I'll try to get them integrated.

utelle commented 7 months ago

Ah, I see. I hadn't looked at the PR content at all yet, so I didn't notice those new files. Up until now, tests_xunit.cs hasn't needed any dependencies.

I would love to get away without dependent database files. Theoretically, the library could generate encrypted database files on its own, but that would make the test useless, because it would only prove that the library can read and write databases created by itself. But we want to test that we can read and write original SQLCipher database files.

The first problem I see is that the two csproj files you modified are not actually the ones used during tests.

Oops, I haven't searched at different locations after having found the project files I modified.

Let me take a look at this myself. You've written the tests. I'll try to get them integrated.

Obviously, you managed to do that. Thanks.

ericsink commented 7 months ago

Actually so far I just merged the PR leaving it broken. I'm working now on fixing it. 😬

utelle commented 7 months ago

Actually so far I just merged the PR leaving it broken. I'm working now on fixing it. 😬

Yeah, I saw that now, but only after I had already submiited my previous comment.

It shouldn't be too difficult to fix, once the right project file(s) is/are identified.