25bc18c3b3
* Introduce steps to execute tests in AOT (using gen-kernel,
dart2bytecode, and aot compiler)
* Accept using filesystem-scheme to provide dynamic_interfaces.yaml input
* Accept empty dynamic_interfaces.yaml
* Make temporary test changes to get them running:
* include core types in dynamic_interfaces that we may want to have
by default
* rename entrypoint to `main`
Most existing test pass, the two tests that validate that a library
cannot be defined twice fail (expectation is to throw, bytecode ignores
the second definition).
To run locally:
```
./tool/build.py -m release --dart-dynamic-modules create_sdk
DART_CONFIGURATION=ReleaseX64 out/ReleaseX64/dart-sdk/bin/dart pkg/dynamic_modules/test/runner/main.dart -r aot
```
Tested: CL adds additional test coverage, currently ran manually, integrated in CI in child CL
Change-Id: I4868e765855d9951bff160c18b846aa628f5e0b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383928
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
41 lines
1.5 KiB
Dart
41 lines
1.5 KiB
Dart
// Copyright (c) 2024, 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.
|
|
|
|
/// A library used by dynamic module tests to simulate the loading process and
|
|
/// provide information to the test harness.
|
|
library;
|
|
|
|
import 'package:dynamic_modules/dynamic_modules.dart';
|
|
|
|
import 'read_bytes.dart' if (dart.library.io) 'read_bytes_aot.dart';
|
|
|
|
/// Load a module and invoke it's entrypoint.
|
|
///
|
|
/// The module is identified by the name of its entrypoint file within the
|
|
/// `modules/` subfolder.
|
|
Future<Object?> load(String moduleName) {
|
|
if (const bool.fromEnvironment('dart.library.html')) {
|
|
// DDC implementation
|
|
return loadModuleFromUri(Uri(scheme: '', path: moduleName));
|
|
}
|
|
if (const bool.fromEnvironment('dart.library.io')) {
|
|
final bytes = readBytes('modules/$moduleName.bytecode');
|
|
return loadModuleFromBytes(bytes);
|
|
}
|
|
throw "load is not implemented for dart2wasm";
|
|
}
|
|
|
|
/// Notify the test harness that the test has run to completion.
|
|
void done() {
|
|
print(successToken);
|
|
}
|
|
|
|
/// Token used by the tests to ensure they are run to completion. This mimics
|
|
/// a similar 'unit-test-done` token used by the langugage test framework.
|
|
///
|
|
/// Unit tests should call [done]. This constant is public only to ensure the
|
|
/// token is shared with the test runner, but it is not meant to be used
|
|
/// directly by tests.
|
|
const successToken = 'TOKEN!**ALL TEST EXECUTED**!!';
|