Unverified Commit 750fd1d5 authored by Dan Field's avatar Dan Field Committed by GitHub

Avoid hard coding "build" for test output files (#79322)

parent 7f651f54
...@@ -16,6 +16,11 @@ import 'package:flutter_devicelab/framework/host_agent.dart'; ...@@ -16,6 +16,11 @@ import 'package:flutter_devicelab/framework/host_agent.dart';
import 'package:flutter_devicelab/framework/task_result.dart'; import 'package:flutter_devicelab/framework/task_result.dart';
import 'package:flutter_devicelab/framework/utils.dart'; import 'package:flutter_devicelab/framework/utils.dart';
/// Must match flutter_driver/lib/src/common.dart.
///
/// Redefined here to avoid taking a dependency on flutter_driver.
final String _testOutputDirectory = Platform.environment['FLUTTER_TEST_OUTPUTS_DIR'] ?? 'build';
TaskFunction createComplexLayoutScrollPerfTest({bool measureCpuGpu = true}) { TaskFunction createComplexLayoutScrollPerfTest({bool measureCpuGpu = true}) {
return PerfTest( return PerfTest(
'${flutterDirectory.path}/dev/benchmarks/complex_layout', '${flutterDirectory.path}/dev/benchmarks/complex_layout',
...@@ -297,7 +302,7 @@ TaskFunction createStackSizeTest() { ...@@ -297,7 +302,7 @@ TaskFunction createStackSizeTest() {
hostAgent.dumpDirectory.path, hostAgent.dumpDirectory.path,
]); ]);
final Map<String, dynamic> data = json.decode( final Map<String, dynamic> data = json.decode(
file('$testDirectory/build/stack_size.json').readAsStringSync(), file('$testDirectory/$_testOutputDirectory/stack_size.json').readAsStringSync(),
) as Map<String, dynamic>; ) as Map<String, dynamic>;
final Map<String, dynamic> result = <String, dynamic>{ final Map<String, dynamic> result = <String, dynamic>{
...@@ -394,7 +399,7 @@ TaskFunction createsScrollSmoothnessPerfTest() { ...@@ -394,7 +399,7 @@ TaskFunction createsScrollSmoothnessPerfTest() {
hostAgent.dumpDirectory.path, hostAgent.dumpDirectory.path,
]); ]);
final Map<String, dynamic> data = json.decode( final Map<String, dynamic> data = json.decode(
file('$testDirectory/build/scroll_smoothness_test.json').readAsStringSync(), file('$testDirectory/$_testOutputDirectory/scroll_smoothness_test.json').readAsStringSync(),
) as Map<String, dynamic>; ) as Map<String, dynamic>;
final Map<String, dynamic> result = <String, dynamic>{}; final Map<String, dynamic> result = <String, dynamic>{};
...@@ -445,7 +450,7 @@ TaskFunction createFramePolicyIntegrationTest() { ...@@ -445,7 +450,7 @@ TaskFunction createFramePolicyIntegrationTest() {
hostAgent.dumpDirectory.path, hostAgent.dumpDirectory.path,
]); ]);
final Map<String, dynamic> data = json.decode( final Map<String, dynamic> data = json.decode(
file('$testDirectory/build/frame_policy_event_delay.json').readAsStringSync(), file('$testDirectory/$_testOutputDirectory/frame_policy_event_delay.json').readAsStringSync(),
) as Map<String, dynamic>; ) as Map<String, dynamic>;
final Map<String, dynamic> fullLiveData = data['fullyLive'] as Map<String, dynamic>; final Map<String, dynamic> fullLiveData = data['fullyLive'] as Map<String, dynamic>;
final Map<String, dynamic> benchmarkLiveData = data['benchmarkLive'] as Map<String, dynamic>; final Map<String, dynamic> benchmarkLiveData = data['benchmarkLive'] as Map<String, dynamic>;
...@@ -557,7 +562,7 @@ class StartupTest { ...@@ -557,7 +562,7 @@ class StartupTest {
], canFail: true); ], canFail: true);
if (result == 0) { if (result == 0) {
final Map<String, dynamic> data = json.decode( final Map<String, dynamic> data = json.decode(
file('$testDirectory/build/start_up_info.json').readAsStringSync(), file('$testDirectory/$_testOutputDirectory/start_up_info.json').readAsStringSync(),
) as Map<String, dynamic>; ) as Map<String, dynamic>;
results.add(data); results.add(data);
} else { } else {
...@@ -700,7 +705,7 @@ class PerfTest { ...@@ -700,7 +705,7 @@ class PerfTest {
hostAgent.dumpDirectory.path, hostAgent.dumpDirectory.path,
]); ]);
final Map<String, dynamic> data = json.decode( final Map<String, dynamic> data = json.decode(
file('$testDirectory/build/$resultFilename.json').readAsStringSync(), file('$testDirectory/$_testOutputDirectory/$resultFilename.json').readAsStringSync(),
) as Map<String, dynamic>; ) as Map<String, dynamic>;
if (data['frame_count'] as int < 5) { if (data['frame_count'] as int < 5) {
...@@ -717,7 +722,7 @@ class PerfTest { ...@@ -717,7 +722,7 @@ class PerfTest {
data, data,
detailFiles: <String>[ detailFiles: <String>[
if (saveTraceFile) if (saveTraceFile)
'$testDirectory/build/$traceFilename.json', '$testDirectory/$_testOutputDirectory/$traceFilename.json',
], ],
benchmarkScoreKeys: benchmarkScoreKeys ?? <String>[ benchmarkScoreKeys: benchmarkScoreKeys ?? <String>[
..._kCommonScoreKeys, ..._kCommonScoreKeys,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment