Skip to content

Commit ccf2cda

Browse files
committed
Revert Dart testing changes
1 parent 5aa2970 commit ccf2cda

File tree

6 files changed

+57
-95
lines changed

6 files changed

+57
-95
lines changed

dart/pubspec.lock

Lines changed: 22 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,10 @@ packages:
1313
dependency: transitive
1414
description:
1515
name: analyzer
16-
sha256: "904ae5bb474d32c38fb9482e2d925d5454cda04ddd0e55d2e6826bc72f6ba8c0"
16+
sha256: "13c1e6c6fd460522ea840abec3f677cc226f5fec7872c04ad7b425517ccf54f7"
1717
url: "https://pub.dev"
1818
source: hosted
19-
version: "7.4.5"
20-
archive:
21-
dependency: transitive
22-
description:
23-
name: archive
24-
sha256: "2fde1607386ab523f7a36bb3e7edb43bd58e6edaf2ffb29d8a6d578b297fdbbd"
25-
url: "https://pub.dev"
26-
source: hosted
27-
version: "4.0.7"
19+
version: "7.4.4"
2820
args:
2921
dependency: transitive
3022
description:
@@ -53,10 +45,10 @@ packages:
5345
dependency: "direct main"
5446
description:
5547
name: bson
56-
sha256: f8c80be7a62a88f4add7c48cc83567c36a77532de107224df8328ef71f125045
48+
sha256: "9b761248a3494fea594aecf5d6f369b5f04d7b082aa2b8c06579ade77f1a7e47"
5749
url: "https://pub.dev"
5850
source: hosted
59-
version: "5.0.7"
51+
version: "5.0.6"
6052
cli_config:
6153
dependency: transitive
6254
description:
@@ -93,10 +85,10 @@ packages:
9385
dependency: transitive
9486
description:
9587
name: coverage
96-
sha256: aa07dbe5f2294c827b7edb9a87bba44a9c15a3cc81bc8da2ca19b37322d30080
88+
sha256: "9086475ef2da7102a0c0a4e37e1e30707e7fb7b6d28c209f559a9c5f8ce42016"
9789
url: "https://pub.dev"
9890
source: hosted
99-
version: "1.14.1"
91+
version: "1.12.0"
10092
crypto:
10193
dependency: transitive
10294
description:
@@ -109,10 +101,10 @@ packages:
109101
dependency: transitive
110102
description:
111103
name: decimal
112-
sha256: "6c2041df7caefc9393ae0b0dcc4abc700831014a2c252dd10e3952499673f0b2"
104+
sha256: "28239b8b929c1bd8618702e6dbc96e2618cf99770bbe9cb040d6cf56a11e4ec3"
113105
url: "https://pub.dev"
114106
source: hosted
115-
version: "3.2.2"
107+
version: "3.2.1"
116108
fake_async:
117109
dependency: "direct dev"
118110
description:
@@ -161,14 +153,6 @@ packages:
161153
url: "https://pub.dev"
162154
source: hosted
163155
version: "2.1.3"
164-
http:
165-
dependency: transitive
166-
description:
167-
name: http
168-
sha256: "2c11f3f94c687ee9bad77c171151672986360b2b001d109814ee7140b2cf261b"
169-
url: "https://pub.dev"
170-
source: hosted
171-
version: "1.4.0"
172156
http_multi_server:
173157
dependency: transitive
174158
description:
@@ -229,10 +213,10 @@ packages:
229213
dependency: "direct dev"
230214
description:
231215
name: meta
232-
sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394"
216+
sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c
233217
url: "https://pub.dev"
234218
source: hosted
235-
version: "1.17.0"
219+
version: "1.16.0"
236220
mime:
237221
dependency: transitive
238222
description:
@@ -241,22 +225,6 @@ packages:
241225
url: "https://pub.dev"
242226
source: hosted
243227
version: "2.0.0"
244-
native_assets_cli:
245-
dependency: transitive
246-
description:
247-
name: native_assets_cli
248-
sha256: "298ba641e47b44f039601141ab26f6865186b5d05b7f313d45797513d7205b3d"
249-
url: "https://pub.dev"
250-
source: hosted
251-
version: "0.14.0"
252-
native_toolchain_c:
253-
dependency: transitive
254-
description:
255-
name: native_toolchain_c
256-
sha256: e5b14abd4309f820817a48701dfd40d1fbd80a1d5fa2ce6838b758e952ea46d9
257-
url: "https://pub.dev"
258-
source: hosted
259-
version: "0.11.0"
260228
node_preamble:
261229
dependency: transitive
262230
description:
@@ -297,14 +265,6 @@ packages:
297265
url: "https://pub.dev"
298266
source: hosted
299267
version: "1.5.1"
300-
posix:
301-
dependency: transitive
302-
description:
303-
name: posix
304-
sha256: f0d7856b6ca1887cfa6d1d394056a296ae33489db914e365e2044fdada449e62
305-
url: "https://pub.dev"
306-
source: hosted
307-
version: "6.0.2"
308268
power_extensions:
309269
dependency: transitive
310270
description:
@@ -401,14 +361,6 @@ packages:
401361
url: "https://pub.dev"
402362
source: hosted
403363
version: "2.7.6"
404-
sqlite3_native_assets:
405-
dependency: "direct main"
406-
description:
407-
name: sqlite3_native_assets
408-
sha256: "0b379f37a642b20905e86fba43940bb429e44bed1d0fc6149076090815d450a7"
409-
url: "https://pub.dev"
410-
source: hosted
411-
version: "0.0.4"
412364
sqlite3_test:
413365
dependency: "direct dev"
414366
description:
@@ -453,26 +405,26 @@ packages:
453405
dependency: "direct dev"
454406
description:
455407
name: test
456-
sha256: "65e29d831719be0591f7b3b1a32a3cda258ec98c58c7b25f7b84241bc31215bb"
408+
sha256: "301b213cd241ca982e9ba50266bd3f5bd1ea33f1455554c5abb85d1be0e2d87e"
457409
url: "https://pub.dev"
458410
source: hosted
459-
version: "1.26.2"
411+
version: "1.25.15"
460412
test_api:
461413
dependency: transitive
462414
description:
463415
name: test_api
464-
sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00"
416+
sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd
465417
url: "https://pub.dev"
466418
source: hosted
467-
version: "0.7.6"
419+
version: "0.7.4"
468420
test_core:
469421
dependency: transitive
470422
description:
471423
name: test_core
472-
sha256: "80bf5a02b60af04b09e14f6fe68b921aad119493e26e490deaca5993fef1b05a"
424+
sha256: "84d17c3486c8dfdbe5e12a50c8ae176d15e2a771b96909a9442b40173649ccaa"
473425
url: "https://pub.dev"
474426
source: hosted
475-
version: "0.6.11"
427+
version: "0.6.8"
476428
typed_data:
477429
dependency: transitive
478430
description:
@@ -493,18 +445,18 @@ packages:
493445
dependency: transitive
494446
description:
495447
name: vm_service
496-
sha256: "45caa6c5917fa127b5dbcfbd1fa60b14e583afdc08bfc96dda38886ca252eb60"
448+
sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02
497449
url: "https://pub.dev"
498450
source: hosted
499-
version: "15.0.2"
451+
version: "15.0.0"
500452
watcher:
501453
dependency: transitive
502454
description:
503455
name: watcher
504-
sha256: "0b7fd4a0bbc4b92641dbf20adfd7e3fd1398fe17102d94b674234563e110088a"
456+
sha256: "69da27e49efa56a15f8afe8f4438c4ec02eff0a117df1b22ea4aad194fe1c104"
505457
url: "https://pub.dev"
506458
source: hosted
507-
version: "1.1.2"
459+
version: "1.1.1"
508460
web:
509461
dependency: transitive
510462
description:
@@ -517,10 +469,10 @@ packages:
517469
dependency: transitive
518470
description:
519471
name: web_socket
520-
sha256: "34d64019aa8e36bf9842ac014bb5d2f5586ca73df5e4d9bf5c936975cae6982c"
472+
sha256: bfe6f435f6ec49cb6c01da1e275ae4228719e59a6b067048c51e72d9d63bcc4b
521473
url: "https://pub.dev"
522474
source: hosted
523-
version: "1.0.1"
475+
version: "1.0.0"
524476
web_socket_channel:
525477
dependency: transitive
526478
description:

dart/pubspec.yaml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ environment:
77
dependencies:
88
sqlite3: ^2.7.6
99
bson: ^5.0.5
10-
sqlite3_native_assets: ^0.0.4
1110

1211
dev_dependencies:
1312
test: ^1.25.0
@@ -16,12 +15,3 @@ dev_dependencies:
1615
fake_async: ^1.3.3
1716
convert: ^3.1.2
1817
meta: ^1.16.0
19-
20-
hooks:
21-
user_defines:
22-
sqlite3_native_assets:
23-
defines:
24-
defines:
25-
# We use the sqlite_stmt virtual table in tests to assert that the core extension is properly
26-
# returning all statements it starts.
27-
- SQLITE_ENABLE_STMTVTAB

dart/test/js_key_encoding_test.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import 'dart:convert';
22

33
import 'package:file/local.dart';
44
import 'package:sqlite3/common.dart';
5-
import 'package:sqlite3/native_assets.dart';
5+
import 'package:sqlite3/sqlite3.dart';
66
import 'package:sqlite3_test/sqlite3_test.dart';
77
import 'package:test/test.dart';
88

@@ -16,9 +16,9 @@ void main() {
1616

1717
setUpAll(() {
1818
loadExtension();
19-
sqlite3Native.registerVirtualFileSystem(vfs, makeDefault: false);
19+
sqlite3.registerVirtualFileSystem(vfs, makeDefault: false);
2020
});
21-
tearDownAll(() => sqlite3Native.unregisterVirtualFileSystem(vfs));
21+
tearDownAll(() => sqlite3.unregisterVirtualFileSystem(vfs));
2222

2323
setUp(() async {
2424
db = openTestDatabase(vfs: vfs)

dart/test/sync_local_performance_test.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import 'dart:convert';
22

33
import 'package:sqlite3/common.dart';
4-
import 'package:sqlite3/native_assets.dart';
4+
import 'package:sqlite3/sqlite3.dart';
55
import 'package:test/test.dart';
66

77
import 'utils/native_test_utils.dart';
@@ -32,13 +32,13 @@ void testFilesystemOperations(
3232
// Needs an unique name per test file to avoid concurrency issues
3333
vfs = new TrackingFileSystem(
3434
parent: new InMemoryFileSystem(), name: 'perf-test-vfs');
35-
sqlite3Native.registerVirtualFileSystem(vfs, makeDefault: false);
35+
sqlite3.registerVirtualFileSystem(vfs, makeDefault: false);
3636
db = openTestDatabase(vfs: vfs, fileName: 'test.db');
3737
});
3838

3939
tearDown(() {
4040
db.dispose();
41-
sqlite3Native.unregisterVirtualFileSystem(vfs);
41+
sqlite3.unregisterVirtualFileSystem(vfs);
4242
});
4343

4444
setUp(() {

dart/test/sync_test.dart

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import 'package:fake_async/fake_async.dart';
77
import 'package:file/local.dart';
88
import 'package:meta/meta.dart';
99
import 'package:sqlite3/common.dart';
10-
import 'package:sqlite3/native_assets.dart';
10+
import 'package:sqlite3/sqlite3.dart';
1111
import 'package:sqlite3_test/sqlite3_test.dart';
1212
import 'package:test/test.dart';
1313
import 'package:path/path.dart';
@@ -28,9 +28,9 @@ void main() {
2828

2929
setUpAll(() {
3030
loadExtension();
31-
sqlite3Native.registerVirtualFileSystem(vfs, makeDefault: false);
31+
sqlite3.registerVirtualFileSystem(vfs, makeDefault: false);
3232
});
33-
tearDownAll(() => sqlite3Native.unregisterVirtualFileSystem(vfs));
33+
tearDownAll(() => sqlite3.unregisterVirtualFileSystem(vfs));
3434

3535
group('text lines', () {
3636
_syncTests(vfs: vfs, isBson: false);
@@ -55,9 +55,10 @@ void _syncTests<T>({
5555

5656
// Make sure that powersync_control doesn't leave any busy statements
5757
// behind.
58-
const statement = 'SELECT * FROM sqlite_stmt WHERE busy AND sql != ?;';
59-
final busy = db.select(statement, [statement]);
60-
expect(busy, isEmpty);
58+
// TODO: Re-enable after we can guarantee sqlite_stmt being available
59+
// const statement = 'SELECT * FROM sqlite_stmt WHERE busy AND sql != ?;';
60+
// final busy = db.select(statement, [statement]);
61+
// expect(busy, isEmpty);
6162

6263
db.execute('commit');
6364
return jsonDecode(row.columnAt(0));

dart/test/utils/native_test_utils.dart

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import 'dart:ffi';
2+
import 'dart:io';
23

34
import 'package:sqlite3/common.dart';
4-
import 'package:sqlite3/native_assets.dart';
5+
import 'package:sqlite3/open.dart' as sqlite_open;
56
import 'package:sqlite3/sqlite3.dart';
67
import 'package:path/path.dart' as p;
78

@@ -10,19 +11,37 @@ const defaultSqlitePath = 'libsqlite3.so.0';
1011
const libPath = '../target/debug';
1112
var didLoadExtension = false;
1213

14+
void applyOpenOverride() {
15+
sqlite_open.open.overrideFor(sqlite_open.OperatingSystem.linux, () {
16+
return DynamicLibrary.open('libsqlite3.so.0');
17+
});
18+
sqlite_open.open.overrideFor(sqlite_open.OperatingSystem.macOS, () {
19+
// Prefer using Homebrew's SQLite which allows loading extensions.
20+
const fromHomebrew = '/opt/homebrew/opt/sqlite/lib/libsqlite3.dylib';
21+
if (File(fromHomebrew).existsSync()) {
22+
return DynamicLibrary.open(fromHomebrew);
23+
}
24+
25+
return DynamicLibrary.open('libsqlite3.dylib');
26+
});
27+
}
28+
1329
CommonDatabase openTestDatabase(
1430
{VirtualFileSystem? vfs, String fileName = ':memory:'}) {
31+
applyOpenOverride();
1532
if (!didLoadExtension) {
1633
loadExtension();
1734
}
1835

19-
return sqlite3Native.open(fileName, vfs: vfs?.name);
36+
return sqlite3.open(fileName, vfs: vfs?.name);
2037
}
2138

2239
void loadExtension() {
40+
applyOpenOverride();
41+
2342
var lib = DynamicLibrary.open(getLibraryForPlatform(path: libPath));
2443
var extension = SqliteExtension.inLibrary(lib, 'sqlite3_powersync_init');
25-
sqlite3Native.ensureExtensionLoaded(extension);
44+
sqlite3.ensureExtensionLoaded(extension);
2645
didLoadExtension = true;
2746
}
2847

0 commit comments

Comments
 (0)