Skip to content

Commit f22d82f

Browse files
aamCommit Queue
authored and
Commit Queue
committed
[gardening] Fix standalone/package/* tests.
BUG=#46528 TEST=standalone/package Change-Id: Id8d99afef86df3f676bf54d62b047c2d9b4747fb Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319905 Commit-Queue: Alexander Aprelev <[email protected]> Reviewed-by: Ryan Macnak <[email protected]>
1 parent f763d12 commit f22d82f

File tree

16 files changed

+156
-17
lines changed

16 files changed

+156
-17
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"configVersion": 2,
3+
"packages": [
4+
{
5+
"name": "async_helper",
6+
"rootUri": "../../../pkg/async_helper",
7+
"packageUri": "lib/",
8+
"languageVersion": "2.12"
9+
},
10+
{
11+
"name": "expect",
12+
"rootUri": "../../../../pkg/expect",
13+
"packageUri": "lib/",
14+
"languageVersion": "2.12"
15+
},
16+
{
17+
"name": "lib1",
18+
"rootUri": "../pkgs/lib1"
19+
},
20+
{
21+
"name": "lib2",
22+
"rootUri": "../pkgs/lib2"
23+
},
24+
{
25+
"name": "lib3",
26+
"rootUri": "../pkgs/lib3"
27+
},
28+
{
29+
"name": "package1",
30+
"rootUri": "../pkgs/package1"
31+
},
32+
{
33+
"name": "package2",
34+
"rootUri": "../pkgs/package2"
35+
},
36+
{
37+
"name": "shared",
38+
"rootUri": "../pkgs/shared"
39+
}
40+
]
41+
}

tests/standalone/package/package1_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
library package1_test;
88

9-
import 'package:package1.dart' as p1;
9+
import 'pkgs/package1/package1.dart' as p1;
1010

1111
main() {
1212
p1.main();

tests/standalone/package/package_isolate_test.dart

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5+
//
6+
// Packages=.dart_tool/package_config.json
7+
//
8+
59
library package_isolate_test;
610

7-
import 'packages/shared.dart' as shared;
11+
import 'pkgs/shared/shared.dart' as shared;
812
import 'dart:isolate';
13+
914
import '../../../pkg/async_helper/lib/async_helper.dart';
1015
import '../../../pkg/expect/lib/expect.dart';
1116

12-
expectResponse() {
17+
ReceivePort expectResponse() {
1318
asyncStart();
1419
var receivePort = new ReceivePort();
1520
receivePort.first.then((msg) {
@@ -22,7 +27,7 @@ expectResponse() {
2227

2328
void main() {
2429
{
25-
var replyPort = expectResponse().sendPort;
30+
final replyPort = expectResponse().sendPort;
2631
shared.output = 'main';
2732
Isolate.spawn(isolate_main, replyPort);
2833
}
@@ -39,11 +44,13 @@ void main() {
3944
var replyPort = expectResponse().sendPort;
4045
shared.output = 'main';
4146
Isolate.spawnUri(
42-
Uri.parse('test_folder/folder_isolate.dart'), [], replyPort);
47+
Uri.parse('test_folder/folder_isolate.dart'), [], replyPort,
48+
packageConfig: Uri.parse(
49+
'tests/standalone/package/test_folder/.dart_tool/package_config.json'));
4350
}
4451
}
4552

4653
void isolate_main(SendPort replyTo) {
4754
shared.output = 'isolate';
48-
replyTo.send(shared.output);
55+
(replyTo as SendPort).send(shared.output);
4956
}

tests/standalone/package/package_test.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66

77
library package_test;
88

9-
import 'package:lib1.dart';
10-
import 'package:shared.dart';
9+
import "package:expect/expect.dart";
10+
11+
import 'package:lib1/lib1.dart';
12+
import 'package:shared/shared.dart';
1113

1214
void main() {
1315
output = 'main';
1416
// Call an imported lib, which will in turn call some others.
1517
lib1();
1618

1719
// Make sure they were all reached successfully.
18-
if (output != 'main|lib1|lib2|lib3') {
19-
throw new Error("libraries were not reached successfully");
20-
}
20+
Expect.equals('main|lib1|lib2|lib3', output);
2121
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
library lib1;
6+
7+
import 'package:shared/shared.dart';
8+
import 'package:lib2/lib2.dart';
9+
10+
void lib1() {
11+
output += '|lib1';
12+
lib2();
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
library lib2;
6+
7+
import 'package:shared/shared.dart';
8+
import 'package:lib3/sub/lib3.dart';
9+
10+
void lib2() {
11+
output += '|lib2';
12+
lib3();
13+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
library lib3;
6+
7+
import 'package:shared/shared.dart';
8+
9+
void lib3() {
10+
output += '|lib3';
11+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
library package1;
6+
7+
import 'package:expect/expect.dart';
8+
9+
import '../package2/package2.dart' as p1;
10+
import '../package2/package2.dart' as p2;
11+
import 'package:package2/package2.dart' as p3;
12+
13+
main() {
14+
Expect.identical(p1.x, p2.x);
15+
Expect.notIdentical(p1.x, p3.x);
16+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
library package2;
6+
7+
class X {
8+
const X();
9+
}
10+
11+
const X x = const X();
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
library shared;
6+
7+
var output = '';

tests/standalone/package/sibling_isolate.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
library sibling_isolate;
66

7-
import 'package:shared.dart' as shared;
7+
import 'package:shared/shared.dart' as shared;
88
import 'dart:isolate';
99

1010
// This file is spawned from package_isolate_test.dart
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"configVersion": 2,
3+
"packages": [
4+
{
5+
"name": "folder_lib",
6+
"rootUri": "../folder_lib"
7+
}
8+
]
9+
}

tests/standalone/package/test_folder/folder_isolate.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
library folder_isolate;
66

77
// This is a package that's not available to the main isolate
8-
import 'package:folder_lib.dart' as isolate_package;
8+
import 'package:folder_lib/folder_lib.dart' as isolate_package;
99
import 'dart:isolate';
1010

1111
// This file is spawned from package_isolate_test.dart
12-
main(List<String> args, Sendport replyTo) {
12+
main(List<String> args, SendPort? replyTo) {
1313
isolate_package.count = 1;
14-
replyTo.send('isolate');
14+
replyTo?.send('isolate');
1515
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
library folder_lib;
6+
7+
// This is a library that's available to folder_isolate.dart
8+
// but not package_isolate_test.dart
9+
int count = 0;

tests/standalone/standalone.status

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ io/large_file_read_small_file_test: Slow, Pass # Test reads small file 1M times
1111
io/non_utf8_directory_test: Skip # Issue 33519. Temp files causing bots to go purple.
1212
io/non_utf8_file_test: Skip # Issue 33519. Temp files causing bots to go purple.
1313
io/non_utf8_link_test: Skip # Issue 33519. Temp files causing bots to go purple.
14+
package/scenarios/invalid/invalid_utf8_test: CompileTimeError
15+
package/scenarios/invalid/non_existent_packages_file_test: CompileTimeError
1416

1517
[ $builder_tag == dwarf ]
1618
io/socket_connect_stacktrace_test: SkipByDesign # Assumes stacktrace can be inspected directly, without decoding

tests/standalone_2/package/package_isolate_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ void main() {
4545
}
4646
}
4747

48-
void isolate_main(SendPort replyTo) {
48+
void isolate_main(dynamic replyTo) {
4949
shared.output = 'isolate';
50-
replyTo.send(shared.output);
50+
(replyTo as SendPort).send(shared.output);
5151
}

0 commit comments

Comments
 (0)