[gardening] Fix standalone/package/* tests.

BUG=https://github.com/dart-lang/sdk/issues/46528
TEST=standalone/package

Change-Id: Id8d99afef86df3f676bf54d62b047c2d9b4747fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319905
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Alexander Aprelev
2023-08-11 18:15:11 +00:00
committed by Commit Queue
parent f763d12190
commit f22d82f70e
16 changed files with 156 additions and 17 deletions
@@ -0,0 +1,41 @@
{
"configVersion": 2,
"packages": [
{
"name": "async_helper",
"rootUri": "../../../pkg/async_helper",
"packageUri": "lib/",
"languageVersion": "2.12"
},
{
"name": "expect",
"rootUri": "../../../../pkg/expect",
"packageUri": "lib/",
"languageVersion": "2.12"
},
{
"name": "lib1",
"rootUri": "../pkgs/lib1"
},
{
"name": "lib2",
"rootUri": "../pkgs/lib2"
},
{
"name": "lib3",
"rootUri": "../pkgs/lib3"
},
{
"name": "package1",
"rootUri": "../pkgs/package1"
},
{
"name": "package2",
"rootUri": "../pkgs/package2"
},
{
"name": "shared",
"rootUri": "../pkgs/shared"
}
]
}
+1 -1
View File
@@ -6,7 +6,7 @@
library package1_test;
import 'package:package1.dart' as p1;
import 'pkgs/package1/package1.dart' as p1;
main() {
p1.main();
@@ -2,14 +2,19 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
//
// Packages=.dart_tool/package_config.json
//
library package_isolate_test;
import 'packages/shared.dart' as shared;
import 'pkgs/shared/shared.dart' as shared;
import 'dart:isolate';
import '../../../pkg/async_helper/lib/async_helper.dart';
import '../../../pkg/expect/lib/expect.dart';
expectResponse() {
ReceivePort expectResponse() {
asyncStart();
var receivePort = new ReceivePort();
receivePort.first.then((msg) {
@@ -22,7 +27,7 @@ expectResponse() {
void main() {
{
var replyPort = expectResponse().sendPort;
final replyPort = expectResponse().sendPort;
shared.output = 'main';
Isolate.spawn(isolate_main, replyPort);
}
@@ -39,11 +44,13 @@ void main() {
var replyPort = expectResponse().sendPort;
shared.output = 'main';
Isolate.spawnUri(
Uri.parse('test_folder/folder_isolate.dart'), [], replyPort);
Uri.parse('test_folder/folder_isolate.dart'), [], replyPort,
packageConfig: Uri.parse(
'tests/standalone/package/test_folder/.dart_tool/package_config.json'));
}
}
void isolate_main(SendPort replyTo) {
shared.output = 'isolate';
replyTo.send(shared.output);
(replyTo as SendPort).send(shared.output);
}
+5 -5
View File
@@ -6,8 +6,10 @@
library package_test;
import 'package:lib1.dart';
import 'package:shared.dart';
import "package:expect/expect.dart";
import 'package:lib1/lib1.dart';
import 'package:shared/shared.dart';
void main() {
output = 'main';
@@ -15,7 +17,5 @@ void main() {
lib1();
// Make sure they were all reached successfully.
if (output != 'main|lib1|lib2|lib3') {
throw new Error("libraries were not reached successfully");
}
Expect.equals('main|lib1|lib2|lib3', output);
}
@@ -0,0 +1,13 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
library lib1;
import 'package:shared/shared.dart';
import 'package:lib2/lib2.dart';
void lib1() {
output += '|lib1';
lib2();
}
@@ -0,0 +1,13 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
library lib2;
import 'package:shared/shared.dart';
import 'package:lib3/sub/lib3.dart';
void lib2() {
output += '|lib2';
lib3();
}
@@ -0,0 +1,11 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
library lib3;
import 'package:shared/shared.dart';
void lib3() {
output += '|lib3';
}
@@ -0,0 +1,16 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
library package1;
import 'package:expect/expect.dart';
import '../package2/package2.dart' as p1;
import '../package2/package2.dart' as p2;
import 'package:package2/package2.dart' as p3;
main() {
Expect.identical(p1.x, p2.x);
Expect.notIdentical(p1.x, p3.x);
}
@@ -0,0 +1,11 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
library package2;
class X {
const X();
}
const X x = const X();
@@ -0,0 +1,7 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
library shared;
var output = '';
@@ -4,7 +4,7 @@
library sibling_isolate;
import 'package:shared.dart' as shared;
import 'package:shared/shared.dart' as shared;
import 'dart:isolate';
// This file is spawned from package_isolate_test.dart
@@ -0,0 +1,9 @@
{
"configVersion": 2,
"packages": [
{
"name": "folder_lib",
"rootUri": "../folder_lib"
}
]
}
@@ -5,11 +5,11 @@
library folder_isolate;
// This is a package that's not available to the main isolate
import 'package:folder_lib.dart' as isolate_package;
import 'package:folder_lib/folder_lib.dart' as isolate_package;
import 'dart:isolate';
// This file is spawned from package_isolate_test.dart
main(List<String> args, Sendport replyTo) {
main(List<String> args, SendPort? replyTo) {
isolate_package.count = 1;
replyTo.send('isolate');
replyTo?.send('isolate');
}
@@ -0,0 +1,9 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
library folder_lib;
// This is a library that's available to folder_isolate.dart
// but not package_isolate_test.dart
int count = 0;
+2
View File
@@ -11,6 +11,8 @@ io/large_file_read_small_file_test: Slow, Pass # Test reads small file 1M times
io/non_utf8_directory_test: Skip # Issue 33519. Temp files causing bots to go purple.
io/non_utf8_file_test: Skip # Issue 33519. Temp files causing bots to go purple.
io/non_utf8_link_test: Skip # Issue 33519. Temp files causing bots to go purple.
package/scenarios/invalid/invalid_utf8_test: CompileTimeError
package/scenarios/invalid/non_existent_packages_file_test: CompileTimeError
[ $builder_tag == dwarf ]
io/socket_connect_stacktrace_test: SkipByDesign # Assumes stacktrace can be inspected directly, without decoding
@@ -45,7 +45,7 @@ void main() {
}
}
void isolate_main(SendPort replyTo) {
void isolate_main(dynamic replyTo) {
shared.output = 'isolate';
replyTo.send(shared.output);
(replyTo as SendPort).send(shared.output);
}