Skip to content

Commit bc5734a

Browse files
committed
Test with SQLite ciphers
1 parent 5510cc0 commit bc5734a

File tree

4 files changed

+39
-3
lines changed

4 files changed

+39
-3
lines changed

.github/workflows/main.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,16 +239,28 @@ jobs:
239239
dart run tool/write_asset_hashes.dart
240240
dart run tool/hook_overrides.dart compiled
241241
242-
- name: Driver tests on macOS
242+
- name: Flutter sqlite3 tests on macOS
243243
if: runner.os == 'macos'
244244
working-directory: examples/flutter_integration_tests
245245
run: |
246246
flutter config --enable-swift-package-manager
247247
flutter test integration_test
248248
flutter test integration_test -d macos
249249
250-
- name: Driver tests on Linux
250+
- name: Flutter sqlite3 tests on Linux
251251
if: runner.os == 'linux'
252252
working-directory: examples/flutter_integration_tests
253253
run: |
254254
flutter test integration_test -d linux
255+
256+
- name: Enable sqlite3mc
257+
run: |
258+
dart run tool/hook_overrides.dart compiled-ciphers
259+
260+
- name: Flutter sqlite3mc tests on macOS
261+
if: runner.os == 'macos'
262+
working-directory: examples/flutter_integration_tests
263+
run: |
264+
flutter config --enable-swift-package-manager
265+
flutter test integration_test -Dsqlite3.multipleciphers=true
266+
flutter test integration_test -Dsqlite3.multipleciphers=true -d macos

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,6 @@ lib/generated_plugin_registrant.dart
9999
# End of https://www.toptal.com/developers/gitignore/api/flutter,dart
100100

101101
*.wasm
102-
sqlite/out/
102+
sqlite-src
103+
sqlite-compiled
104+
tmp

examples/flutter_integration_tests/integration_test/integration_test.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,14 @@ void main() {
9999
[],
100100
);
101101
});
102+
103+
const ciphers = bool.fromEnvironment('sqlite3.multipleciphers');
104+
if (ciphers) {
105+
test('contains sqlite3multipleciphers', () {
106+
final db = sqlite3.openInMemory()..closeWhenDone();
107+
print(db.select('select sqlite3mc_config(?)', ['cipher']));
108+
});
109+
}
102110
}
103111

104112
extension on Database {

tool/hook_overrides.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import 'package:path/path.dart' as p;
66
/// running in to customize how `package:sqlite3` loads `libsqlite3`.
77
void main(List<String> args) async {
88
for (final path in ['pubspec.yaml', 'examples/pubspec.yaml']) {
9+
Process.runSync('git', ['restore', '--', path]);
10+
911
final out = await File(path).openWrite(mode: FileMode.append);
1012
final [mode] = args;
1113
switch (mode) {
@@ -26,6 +28,18 @@ hooks:
2628
source: test-sqlite3
2729
directory: $outPath/
2830
''');
31+
case 'compiled-ciphers':
32+
final outPath = p.relative('sqlite-compiled', from: p.dirname(path));
33+
34+
out.write('''
35+
hooks:
36+
user_defines:
37+
sqlite3:
38+
source: test-sqlite3mc
39+
directory: $outPath/
40+
''');
41+
default:
42+
throw 'Unsupported mode, can use system, compiled, compiled-ciphers';
2943
}
3044

3145
await out.flush();

0 commit comments

Comments
 (0)