@@ -697,21 +697,7 @@ abstract class HotReloadSuiteRunner {
697
697
var testPassed = false ;
698
698
switch (options.runtime) {
699
699
case RuntimePlatforms .d8:
700
- // Run the compiled JS generations with D8.
701
- _print ('Creating D8 hot reload test suite.' , label: test.name);
702
- // TODO(nshahan): Clean this up! The cast here just serves as a way to
703
- // allow for smaller refactor changes.
704
- final d8Suite = (this as D8SuiteRunner )
705
- ..bootstrapJsUri =
706
- tempDirectory.uri.resolve ('generation0/bootstrap.js' )
707
- ..outputSink = outputSink;
708
- await d8Suite.setupTest (
709
- testName: test.name,
710
- scriptDescriptors: filesystem! .scriptDescriptorForBootstrap,
711
- generationToModifiedFiles: filesystem! .generationsToModifiedFilePaths,
712
- );
713
- final d8ExitCode = await d8Suite.runTestOld (testName: test.name);
714
- testPassed = d8ExitCode == 0 ;
700
+ throw UnsupportedError ('Now implemented in D8SuiteRunner.' );
715
701
case RuntimePlatforms .chrome:
716
702
// Run the compiled JS generations with Chrome.
717
703
_print ('Creating Chrome hot reload test suite.' , label: test.name);
@@ -989,49 +975,35 @@ class D8SuiteRunner extends DdcSuiteRunner {
989
975
buildRootUri.resolve ('gen/utils/ddc/canary/sdk/ddc/dart_sdk.js' );
990
976
final Uri ddcModuleLoaderJsUri =
991
977
sdkRoot.resolve ('pkg/dev_compiler/lib/js/ddc/ddc_module_loader.js' );
992
- late StreamSink <List <int >> outputSink;
993
978
994
979
D8SuiteRunner (super .options);
995
980
996
- String _generateBootstrapper ({
997
- required List <Map <String , String ?>> scriptDescriptors,
998
- required ddc_helpers.FileDataPerGeneration generationToModifiedFiles,
999
- }) {
1000
- return ddc_helpers.generateD8Bootstrapper (
981
+ @override
982
+ Future <bool > runTest (
983
+ HotReloadTest test, Directory tempDirectory, IOSink outputSink) async {
984
+ // Run the compiled JS generations with D8.
985
+ _print ('Creating D8 hot reload test suite.' , label: test.name);
986
+ bootstrapJsUri = tempDirectory.uri.resolve ('generation0/bootstrap.js' );
987
+ _print ('Preparing to run D8 test.' , label: test.name);
988
+ final d8BootstrapJS = ddc_helpers.generateD8Bootstrapper (
1001
989
ddcModuleLoaderJsPath: escapedString (ddcModuleLoaderJsUri.toFilePath ()),
1002
990
dartSdkJsPath: escapedString (dartSdkJsUri.toFilePath ()),
1003
991
entrypointModuleName: escapedString (entrypointModuleName),
1004
992
entrypointLibraryExportName: escapedString (entrypointLibraryExportName),
1005
- scriptDescriptors: scriptDescriptors ,
1006
- modifiedFilesPerGeneration: generationToModifiedFiles ,
993
+ scriptDescriptors: filesystem ! .scriptDescriptorForBootstrap ,
994
+ modifiedFilesPerGeneration: filesystem ! .generationsToModifiedFilePaths ,
1007
995
);
1008
- }
1009
-
1010
- Future <void > setupTest ({
1011
- String ? testName,
1012
- List <Map <String , String ?>>? scriptDescriptors,
1013
- ddc_helpers.FileDataPerGeneration ? generationToModifiedFiles,
1014
- }) async {
1015
- _print ('Preparing to run D8 test.' , label: testName);
1016
- if (scriptDescriptors == null || generationToModifiedFiles == null ) {
1017
- throw ArgumentError ('D8SuiteRunner requires that "scriptDescriptors" '
1018
- 'and "generationToModifiedFiles" be provided during setup.' );
1019
- }
1020
- final d8BootstrapJS = _generateBootstrapper (
1021
- scriptDescriptors: scriptDescriptors,
1022
- generationToModifiedFiles: generationToModifiedFiles);
1023
- File .fromUri (bootstrapJsUri).writeAsStringSync (d8BootstrapJS);
1024
- _debugPrint ('Writing D8 bootstrapper: $bootstrapJsUri ' , label: testName);
1025
- }
1026
-
1027
- Future <int > runTestOld ({String ? testName}) async {
996
+ _debugPrint ('Writing D8 bootstrapper: $bootstrapJsUri ' , label: test.name);
997
+ final bootstrapJSFile = File .fromUri (bootstrapJsUri)
998
+ ..writeAsStringSync (d8BootstrapJS);
999
+ _debugPrint ('Running test in D8.' , label: test.name);
1028
1000
final process = await startProcess ('D8' , config.binary.toFilePath (), [
1029
1001
config.sealNativeObjectScript.toFilePath (),
1030
1002
config.preamblesScript.toFilePath (),
1031
- bootstrapJsUri. toFilePath ()
1003
+ bootstrapJSFile.path
1032
1004
]);
1033
1005
unawaited (process.stdout.pipe (outputSink));
1034
- return process.exitCode;
1006
+ return await process.exitCode == 0 ;
1035
1007
}
1036
1008
}
1037
1009
0 commit comments