75da4db50a
The pub get was wrong on the wrong path, and the subsequent error was not displayed. Prevent the tests from not testing this scenario. Closes: https://github.com/dart-lang/sdk/issues/61721 Change-Id: I88755251086f3d520fd97273f7703f6d85441692 Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-mac-release-try,pkg-win-release-arm64-try,pkg-win-release-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/454602 Commit-Queue: Daco Harkes <dacoharkes@google.com> Reviewed-by: Moritz Sümmermann <mosum@google.com> Reviewed-by: Michael Goderbauer <goderbauer@google.com>
137 lines
3.3 KiB
Dart
137 lines
3.3 KiB
Dart
// Copyright (c) 2023, 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.
|
|
|
|
// @dart=2.18
|
|
|
|
import 'package:test/test.dart';
|
|
|
|
import '../utils.dart';
|
|
import 'helpers.dart';
|
|
|
|
void main([List<String> args = const []]) async {
|
|
if (!nativeAssetsExperimentAvailableOnCurrentChannel) {
|
|
return;
|
|
}
|
|
|
|
// No --source option, `dart run` from source does not output target program
|
|
// stdout.
|
|
|
|
for (final package in [
|
|
'dev_dependency_with_hook',
|
|
'native_add_version_skew',
|
|
'native_add',
|
|
'native_dynamic_linking',
|
|
'system_library',
|
|
]) {
|
|
test('package:$package dart test', timeout: longTimeout, () async {
|
|
await nativeAssetsTest(package, usePubWorkspace: true,
|
|
(packageUri) async {
|
|
final result = await runDart(
|
|
arguments: [
|
|
'test',
|
|
],
|
|
workingDirectory: packageUri,
|
|
logger: logger,
|
|
);
|
|
expect(result.stdout, contains('Running build hooks'));
|
|
expect(result.stdout, isNot(contains('Running link hooks')));
|
|
expect(
|
|
result.stdout,
|
|
stringContainsInOrder(
|
|
[
|
|
'All tests passed!',
|
|
],
|
|
),
|
|
);
|
|
});
|
|
});
|
|
}
|
|
|
|
test('dart run test:test', timeout: longTimeout, () async {
|
|
await nativeAssetsTest('native_add', (packageUri) async {
|
|
final result = await runDart(
|
|
arguments: [
|
|
'run',
|
|
'test:test',
|
|
],
|
|
workingDirectory: packageUri,
|
|
logger: logger,
|
|
);
|
|
expect(
|
|
result.stdout,
|
|
stringContainsInOrder(
|
|
[
|
|
'native add test',
|
|
'All tests passed!',
|
|
],
|
|
),
|
|
);
|
|
});
|
|
});
|
|
|
|
test('run pub get if needed', timeout: longTimeout, () async {
|
|
await nativeAssetsTest(
|
|
'native_add',
|
|
(dartAppUri) async {
|
|
final result = await runDart(
|
|
arguments: [
|
|
'test',
|
|
],
|
|
workingDirectory: dartAppUri,
|
|
logger: logger,
|
|
);
|
|
expect(result.exitCode, equals(0));
|
|
},
|
|
);
|
|
});
|
|
|
|
test('with native dynamic linking', timeout: longTimeout, () async {
|
|
await nativeAssetsTest('native_dynamic_linking', (packageUri) async {
|
|
final result = await runDart(
|
|
arguments: [
|
|
'test',
|
|
],
|
|
workingDirectory: packageUri,
|
|
logger: logger,
|
|
);
|
|
expect(
|
|
result.stdout,
|
|
stringContainsInOrder(
|
|
[
|
|
'invoke native function',
|
|
'All tests passed!',
|
|
],
|
|
),
|
|
);
|
|
});
|
|
});
|
|
|
|
for (final usePubWorkspace in [true, false]) {
|
|
test(
|
|
'dart test with user defines',
|
|
timeout: longTimeout,
|
|
() async {
|
|
await nativeAssetsTest('user_defines', usePubWorkspace: usePubWorkspace,
|
|
(packageUri) async {
|
|
final result = await runDart(
|
|
arguments: [
|
|
'test',
|
|
],
|
|
workingDirectory: packageUri,
|
|
logger: logger,
|
|
);
|
|
expect(
|
|
result.stdout,
|
|
stringContainsInOrder(
|
|
[
|
|
'All tests passed!',
|
|
],
|
|
),
|
|
);
|
|
});
|
|
},
|
|
);
|
|
}
|
|
}
|