Reverts "Try to be more consistent about deleting test apps in devicelab logic (#146931)" (#146947)

Reverts: flutter/flutter#146931
Initiated by: Hixie
Reason for reverting: more failures
Original PR Author: Hixie

Reviewed By: {reidbaker}

This change reverts the following previous change:
Fixes #137555.

This is an updated version of https://github.com/flutter/flutter/pull/146856, which was reverted in https://github.com/flutter/flutter/pull/146927. The first commit is identical to the original PR, and subsequent commits are the fixes to address failures detected in devicelab post-commit.
This commit is contained in:
auto-submit[bot] 2024-04-17 21:08:47 +00:00 committed by GitHub
parent e660a93c63
commit 65d5d36759
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 34 additions and 74 deletions

View file

@ -32,7 +32,6 @@ void main() {
'-d',
deviceId,
]);
await device.uninstallApp();
});
final String outputPath = Platform.environment['FLUTTER_TEST_OUTPUTS_DIR'] ?? p.join(complexLayoutPath, 'build');

View file

@ -16,7 +16,6 @@ Future<String> _runWithMode(String mode, String deviceId) async {
'-d',
deviceId,
]);
await evalFlutter('install', options: <String>['--uninstall-only', '-d', deviceId]);
return stderr.toString();
}

View file

@ -29,7 +29,6 @@ class HelloWorldMemoryTest extends MemoryTest {
await recordStart();
await Future<void>.delayed(const Duration(milliseconds: 3000));
await recordEnd();
await device!.uninstallApp();
}
}

View file

@ -65,7 +65,6 @@ Future<TaskResult> run() async {
await Future<void>.delayed(const Duration(seconds: 30));
process.stdin.write('q');
await adb.cancel();
await device.uninstallApp();
});
if (!isUsingValidationLayers || impellerBackendCount != 1) {

View file

@ -7,5 +7,6 @@ import 'package:flutter_devicelab/framework/framework.dart' show task;
import 'package:flutter_devicelab/tasks/platform_channels_benchmarks.dart' as platform_channels_benchmarks;
Future<void> main() async {
await task(platform_channels_benchmarks.runTask(DeviceOperatingSystem.android));
await task(
platform_channels_benchmarks.runTask(DeviceOperatingSystem.android));
}

View file

@ -16,9 +16,9 @@ void main() {
final Device device = await devices.workingDevice;
await device.unlock();
final Directory appDir = dir(path.join(flutterDirectory.path, 'dev/integration_tests/ui'));
section('TEST WHETHER `flutter drive --route` WORKS ON iOS');
section('TEST WHETHER `flutter drive --route` WORKS on IOS');
await inDirectory(appDir, () async {
await flutter(
return flutter(
'drive',
options: <String>[
'--verbose',
@ -29,7 +29,6 @@ void main() {
'lib/route.dart',
],
);
await device.uninstallApp();
});
return TaskResult.success(null);
});

View file

@ -118,7 +118,6 @@ void main() {
if (result != 0) {
throw 'Received unexpected exit code $result from run process.';
}
await device.uninstallApp();
});
return TaskResult.success(null);
});

View file

@ -161,13 +161,6 @@ Future<void> main() async {
await stderr.cancel();
run.kill();
await inDirectory(path.join(tempDir.path, 'app'), () async {
await flutter(
'install',
options: <String>['--uninstall-only'],
);
});
if (nextCompleterIdx == sentinelCompleters.values.length) {
return TaskResult.success(null);
}

View file

@ -154,13 +154,6 @@ void main() {
await lifecycles.close();
await stdout.cancel();
await stderr.cancel();
await inDirectory(path.join(tempDir.path, 'app'), () async {
await flutter(
'install',
options: <String>['--uninstall-only'],
);
});
return TaskResult.success(null);
}

View file

@ -53,7 +53,7 @@ class DriverTest {
...extraOptions,
];
await flutter('drive', options: options, environment: environment);
await flutter('install', options: <String>['--uninstall-only', '-d', deviceId], environment: environment);
return TaskResult.success(null);
});
}

View file

@ -34,7 +34,8 @@ TaskFunction androidViewsTest({
final int exitCode = await exec(
'./gradlew',
<String>['-q', 'dependencies'],
workingDirectory: '${flutterDirectory.path}/dev/integration_tests/android_views/android'
workingDirectory:
'${flutterDirectory.path}/dev/integration_tests/android_views/android'
);
if (exitCode != 0) {
return TaskResult.failure('Failed to download gradle dependencies');
@ -50,12 +51,6 @@ TaskFunction androidViewsTest({
environment: environment,
workingDirectory: '${flutterDirectory.path}/dev/integration_tests/android_views'
);
await flutter(
'install',
options: <String>['--uninstall-only'],
environment: environment,
workingDirectory: '${flutterDirectory.path}/dev/integration_tests/android_views',
);
return TaskResult.success(null);
};
}

View file

@ -61,6 +61,7 @@ abstract class BuildTestTask {
await flutter('build', options: getBuildArgs(deviceOperatingSystem));
copyArtifacts();
});
}
/// Run Flutter drive test from [getTestArgs] against the application under test on the device.
@ -72,8 +73,8 @@ abstract class BuildTestTask {
await inDirectory<void>(workingDirectory, () async {
section('DRIVE START');
await flutter('drive', options: getTestArgs(deviceOperatingSystem, device.deviceId));
await device.uninstallApp();
});
return parseTaskResult();
}

View file

@ -65,13 +65,12 @@ class ApluginPlatformInterfaceMacOS {
pluginImplPubspecContent = pluginImplPubspecContent.replaceFirst(
' pluginClass: ApluginPlatformImplementationPlugin',
' pluginClass: ApluginPlatformImplementationPlugin\n'
' dartPluginClass: ApluginPlatformInterfaceMacOS\n',
' dartPluginClass: ApluginPlatformInterfaceMacOS\n',
);
pluginImplPubspecContent = pluginImplPubspecContent.replaceFirst(
' platforms:\n',
' implements: aplugin_platform_interface\n'
' platforms:\n',
);
' platforms:\n');
await pluginImplPubspec.writeAsString(pluginImplPubspecContent,
flush: true);
@ -105,8 +104,8 @@ class ApluginPlatformInterfaceMacOS {
pluginInterfacePubspecContent.replaceFirst(
'dependencies:',
'dependencies:\n'
' aplugin_platform_implementation:\n'
' path: ../aplugin_platform_implementation\n');
' aplugin_platform_implementation:\n'
' path: ../aplugin_platform_implementation\n');
await pluginInterfacePubspec.writeAsString(pluginInterfacePubspecContent,
flush: true);
@ -136,8 +135,8 @@ class ApluginPlatformInterfaceMacOS {
appPubspecContent = appPubspecContent.replaceFirst(
'dependencies:',
'dependencies:\n'
' aplugin_platform_interface:\n'
' path: ../aplugin_platform_interface\n');
' aplugin_platform_interface:\n'
' path: ../aplugin_platform_interface\n');
await appPubspec.writeAsString(appPubspecContent, flush: true);
section('Flutter run for macos');
@ -208,11 +207,6 @@ class ApluginPlatformInterfaceMacOS {
unawaited(stdoutSub.cancel());
unawaited(stderrSub.cancel());
await flutter(
'install',
options: <String>['--uninstall-only', '-d', 'macos'],
);
return TaskResult.success(null);
} finally {
rmTree(tempDir);

View file

@ -82,7 +82,6 @@ Future<TaskResult> _runWithTempDir(Directory tempDir) async {
process.stdin.write('q');
await process.stdin.flush();
process.kill(ProcessSignal.sigint);
await device.uninstallApp();
return entrypoint;
});
if (entrypoint.contains('$_messagePrefix $_entrypointName')) {

View file

@ -80,6 +80,7 @@ TaskFunction createGalleryTransitionHybridTest({bool semanticsEnabled = false})
}
class GalleryTransitionTest {
GalleryTransitionTest({
this.semanticsEnabled = false,
this.testFile = 'transitions_perf',
@ -153,7 +154,6 @@ class GalleryTransitionTest {
'-v',
'--verbose-system-logs'
]);
await flutter('install', options: <String>['--uninstall-only', '-d', deviceId]);
});
final String testOutputDirectory = Platform.environment['FLUTTER_TEST_OUTPUTS_DIR'] ?? '${galleryDirectory.path}/build';
@ -384,11 +384,11 @@ class GalleryTransitionBuildTest extends BuildTestTask {
String getApplicationBinaryPath() {
if (deviceOperatingSystem == DeviceOperatingSystem.android) {
return '$applicationBinaryPath/app-profile.apk';
}
if (deviceOperatingSystem == DeviceOperatingSystem.ios) {
} else if (deviceOperatingSystem == DeviceOperatingSystem.ios) {
return '$applicationBinaryPath/Flutter Gallery.app';
} else {
return applicationBinaryPath!;
}
return applicationBinaryPath!;
}
}

View file

@ -168,8 +168,6 @@ TaskFunction createHotModeTest({
<Future<void>>[stdoutDone.future, stderrDone.future]);
await process.exitCode;
await flutter('install', options: <String>['--uninstall-only', '-d', deviceIdOverride!]);
freshRestartReloadsData =
json.decode(benchmarkFile.readAsStringSync()) as Map<String, dynamic>;
}

View file

@ -208,7 +208,7 @@ class DriverTest {
...extraOptions,
];
await flutter('drive', options: options, environment: environment);
await flutter('install', options: <String>['--uninstall-only', '-d', deviceId], environment: environment);
return TaskResult.success(null);
});
}
@ -267,7 +267,6 @@ class IntegrationTest {
if (withTalkBack) {
await disableTalkBack();
}
await flutter('install', options: <String>['--uninstall-only', '-d', deviceId], environment: environment);
return TaskResult.success(null);
});

View file

@ -47,9 +47,7 @@ TaskFunction createMicrobenchmarkTask({
environment: environment,
);
});
final Future<Map<String, double>> result = readJsonResults(flutterProcess);
await device.uninstallApp();
return result;
return readJsonResults(flutterProcess);
}
return run();

View file

@ -99,7 +99,6 @@ TaskFunction createNativeAssetsTest({
if (runFlutterResult != 0) {
print('Flutter run returned non-zero exit code: $runFlutterResult.');
}
await flutter('install', options: <String>['--uninstall-only', '-d', deviceIdOverride!]);
});
final int expectedNumberOfTransitions = buildMode == 'debug' ? 4 : 1;

View file

@ -1245,10 +1245,9 @@ class PerfTest {
/// If null, the device is selected depending on the current environment.
final Device? device;
/// The function called instead of the actual `flutter drive`.
/// The function called instead of the actually `flutter drive`.
///
/// If it is not `null`, `flutter drive` and `flutter install --uninstall-only`
/// will not happen in the PerfTests.
/// If it is not `null`, `flutter drive` will not happen in the PerfTests.
final FlutterDriveCallback? flutterDriveCallback;
/// Whether the perf test should enable Impeller.
@ -1261,8 +1260,6 @@ class PerfTest {
final bool disablePartialRepaint;
/// Number of seconds to time out the test after, allowing debug callbacks to run.
///
/// Passed to `--timeout`.
final int? timeoutSeconds;
/// The keys of the values that need to be reported.
@ -1396,7 +1393,6 @@ class PerfTest {
flutterDriveCallback!(options);
} else {
await flutter('drive', options: options);
await flutter('install', options: <String>['--uninstall-only', '-d', deviceId]);
}
} finally {
await resetManifest();
@ -2131,8 +2127,6 @@ class DevToolsMemoryTest {
}
}
await _device.uninstallApp();
return TaskResult.success(
<String, dynamic>{'maxRss': maxRss, 'maxAdbTotal': maxAdbTotal},
benchmarkScoreKeys: <String>['maxRss', 'maxAdbTotal'],
@ -2205,12 +2199,13 @@ class ReportedDurationTest {
await device!.stop(package);
await adb.cancel();
await device!.uninstallApp();
_device = null;
final Map<String, dynamic> reportedDuration = <String, dynamic>{
'duration': duration,
};
_device = null;
return TaskResult.success(reportedDuration, benchmarkScoreKeys: reportedDuration.keys.toList());
});
}

View file

@ -20,7 +20,7 @@ TaskFunction runTask(adb.DeviceOperatingSystem operatingSystem) {
final Directory appDir = utils.dir(path.join(utils.flutterDirectory.path,
'dev/benchmarks/platform_channels_benchmarks'));
return utils.inDirectory(appDir, () async {
final Process flutterProcess = await utils.inDirectory(appDir, () async {
final List<String> createArgs = <String>[
'--platforms',
'ios,android',
@ -39,13 +39,15 @@ TaskFunction runTask(adb.DeviceOperatingSystem operatingSystem) {
'-d',
device.deviceId,
];
final Process flutterProcess = await utils.startFlutter(
return utils.startFlutter(
'run',
options: options,
);
final Map<String, double> results = await microbenchmarks.readJsonResults(flutterProcess);
await device.uninstallApp();
return TaskResult.success(results, benchmarkScoreKeys: results.keys.toList());
});
final Map<String, double> results =
await microbenchmarks.readJsonResults(flutterProcess);
return TaskResult.success(results,
benchmarkScoreKeys: results.keys.toList());
};
}

View file

@ -109,7 +109,7 @@ class AndroidRunOutputTest extends RunOutputTask {
@override
bool isExpectedStderr(String line) {
// TODO(egarciad): Remove (because https://github.com/flutter/flutter/issues/95131 is now fixed)
// TODO(egarciad): Remove once https://github.com/flutter/flutter/issues/95131 is fixed.
return line.contains('Mapping new ns');
}
@ -321,8 +321,6 @@ abstract class RunOutputTask {
await run.exitCode;
await device.uninstallApp();
if (stderr.isNotEmpty) {
throw 'flutter run ${release ? '--release' : ''} had unexpected output on standard error.';
}

View file

@ -125,6 +125,7 @@ TaskFunction createWebDevModeTest(String webDevice, bool enableIncrementalCompil
// Start `flutter run` again to make sure it loads from the previous
// state. dev compilers loads up from previously compiled JavaScript.
{
final Stopwatch sw = Stopwatch()..start();
final Process process = await startFlutter(
'run',