Ensure that the output path used by perf_tests_test matches the path used by perf_tests if the FLUTTER_TEST_OUTPUTS_DIR variable is set (#153888)
A recent change to the flutter_drone recipe is setting FLUTTER_TEST_OUTPUTS_DIR in the environment (see https://flutter.googlesource.com/recipes/+/b111cd3ef2297e66905cc48c2cfedce0cf1ba46f) If FLUTTER_TEST_OUTPUTS_DIR is set, then perf_tests will use an output path based on that variable. perf_tests_test needs to use the same logic when looking for the expected output file.
This commit is contained in:
@@ -16,9 +16,11 @@ void main() {
|
||||
late Directory testDirectory;
|
||||
late File testTarget;
|
||||
late Device device;
|
||||
late String perfTestOutputPath;
|
||||
|
||||
setUp(() async {
|
||||
testDirectory = Directory.systemTemp.createTempSync('test_dir');
|
||||
perfTestOutputPath = testOutputDirectory(testDirectory.absolute.path);
|
||||
testTarget = File('${testDirectory.absolute.path}/test_file')..createSync();
|
||||
device = const FakeDevice(deviceId: 'fakeDeviceId');
|
||||
deviceOperatingSystem = DeviceOperatingSystem.fake;
|
||||
@@ -64,7 +66,7 @@ void main() {
|
||||
};
|
||||
const String resultFileName = 'fake_result';
|
||||
void driveCallback(List<String> arguments) {
|
||||
final File resultFile = File('${testDirectory.absolute.path}/build/$resultFileName.json')..createSync(recursive: true);
|
||||
final File resultFile = File('$perfTestOutputPath/$resultFileName.json')..createSync(recursive: true);
|
||||
resultFile.writeAsStringSync(json.encode(fakeData));
|
||||
}
|
||||
final PerfTest perfTest = PerfTest(testDirectory.absolute.path, testTarget.absolute.path, 'test_file', resultFilename: resultFileName, device: device, flutterDriveCallback: driveCallback);
|
||||
@@ -117,7 +119,7 @@ void main() {
|
||||
};
|
||||
const String resultFileName = 'fake_result';
|
||||
void driveCallback(List<String> arguments) {
|
||||
final File resultFile = File('${testDirectory.absolute.path}/build/$resultFileName.json')..createSync(recursive: true);
|
||||
final File resultFile = File('$perfTestOutputPath/$resultFileName.json')..createSync(recursive: true);
|
||||
resultFile.writeAsStringSync(json.encode(fakeData));
|
||||
}
|
||||
final PerfTest perfTest = PerfTest(testDirectory.absolute.path, testTarget.absolute.path, 'test_file', resultFilename: resultFileName, device: device, flutterDriveCallback: driveCallback);
|
||||
|
||||
Reference in New Issue
Block a user