preserve detailFiles entry in TaskResult JSON (#70668)
* preserve detailFiles entry in TaskResult JSON
This commit is contained in:
parent
4cbafda853
commit
61460d255a
@ -10,7 +10,7 @@ class TaskResult {
|
|||||||
/// Constructs a successful result.
|
/// Constructs a successful result.
|
||||||
TaskResult.success(this.data, {
|
TaskResult.success(this.data, {
|
||||||
this.benchmarkScoreKeys = const <String>[],
|
this.benchmarkScoreKeys = const <String>[],
|
||||||
this.detailFiles,
|
this.detailFiles = const <String>[],
|
||||||
})
|
})
|
||||||
: succeeded = true,
|
: succeeded = true,
|
||||||
message = 'success' {
|
message = 'success' {
|
||||||
@ -29,11 +29,14 @@ class TaskResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Constructs a successful result using JSON data stored in a file.
|
/// Constructs a successful result using JSON data stored in a file.
|
||||||
factory TaskResult.successFromFile(File file,
|
factory TaskResult.successFromFile(File file, {
|
||||||
{List<String> benchmarkScoreKeys}) {
|
List<String> benchmarkScoreKeys = const <String>[],
|
||||||
|
List<String> detailFiles = const <String>[],
|
||||||
|
}) {
|
||||||
return TaskResult.success(
|
return TaskResult.success(
|
||||||
json.decode(file.readAsStringSync()) as Map<String, dynamic>,
|
json.decode(file.readAsStringSync()) as Map<String, dynamic>,
|
||||||
benchmarkScoreKeys: benchmarkScoreKeys,
|
benchmarkScoreKeys: benchmarkScoreKeys,
|
||||||
|
detailFiles: detailFiles,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,8 +45,11 @@ class TaskResult {
|
|||||||
final bool success = json['success'] as bool;
|
final bool success = json['success'] as bool;
|
||||||
if (success) {
|
if (success) {
|
||||||
final List<String> benchmarkScoreKeys = (json['benchmarkScoreKeys'] as List<dynamic> ?? <String>[]).cast<String>();
|
final List<String> benchmarkScoreKeys = (json['benchmarkScoreKeys'] as List<dynamic> ?? <String>[]).cast<String>();
|
||||||
|
final List<String> detailFiles = (json['detailFiles'] as List<dynamic> ?? <String>[]).cast<String>();
|
||||||
return TaskResult.success(json['data'] as Map<String, dynamic>,
|
return TaskResult.success(json['data'] as Map<String, dynamic>,
|
||||||
benchmarkScoreKeys: benchmarkScoreKeys);
|
benchmarkScoreKeys: benchmarkScoreKeys,
|
||||||
|
detailFiles: detailFiles,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TaskResult.failure(json['reason'] as String);
|
return TaskResult.failure(json['reason'] as String);
|
||||||
@ -54,7 +60,7 @@ class TaskResult {
|
|||||||
: succeeded = false,
|
: succeeded = false,
|
||||||
data = null,
|
data = null,
|
||||||
detailFiles = null,
|
detailFiles = null,
|
||||||
benchmarkScoreKeys = const <String>[];
|
benchmarkScoreKeys = null;
|
||||||
|
|
||||||
/// Whether the task succeeded.
|
/// Whether the task succeeded.
|
||||||
final bool succeeded;
|
final bool succeeded;
|
||||||
@ -98,7 +104,6 @@ class TaskResult {
|
|||||||
|
|
||||||
if (succeeded) {
|
if (succeeded) {
|
||||||
json['data'] = data;
|
json['data'] = data;
|
||||||
if (detailFiles != null)
|
|
||||||
json['detailFiles'] = detailFiles;
|
json['detailFiles'] = detailFiles;
|
||||||
json['benchmarkScoreKeys'] = benchmarkScoreKeys;
|
json['benchmarkScoreKeys'] = benchmarkScoreKeys;
|
||||||
} else {
|
} else {
|
||||||
|
@ -119,15 +119,14 @@ class GalleryTransitionTest {
|
|||||||
summary['transitions'] = transitions;
|
summary['transitions'] = transitions;
|
||||||
summary['missed_transition_count'] = _countMissedTransitions(transitions);
|
summary['missed_transition_count'] = _countMissedTransitions(transitions);
|
||||||
}
|
}
|
||||||
final List<String> detailFiles = <String>[
|
|
||||||
|
return TaskResult.success(summary,
|
||||||
|
detailFiles: <String>[
|
||||||
if (transitionDurationFile != null)
|
if (transitionDurationFile != null)
|
||||||
'${galleryDirectory.path}/build/$transitionDurationFile.json',
|
'${galleryDirectory.path}/build/$transitionDurationFile.json',
|
||||||
if (timelineTraceFile != null)
|
if (timelineTraceFile != null)
|
||||||
'${galleryDirectory.path}/build/$timelineTraceFile.json'
|
'${galleryDirectory.path}/build/$timelineTraceFile.json'
|
||||||
];
|
],
|
||||||
|
|
||||||
return TaskResult.success(summary,
|
|
||||||
detailFiles: detailFiles.isNotEmpty ? detailFiles : null,
|
|
||||||
benchmarkScoreKeys: <String>[
|
benchmarkScoreKeys: <String>[
|
||||||
if (transitionDurationFile != null)
|
if (transitionDurationFile != null)
|
||||||
'missed_transition_count',
|
'missed_transition_count',
|
||||||
|
@ -640,10 +640,6 @@ class PerfTest {
|
|||||||
final Map<String, dynamic> data = json.decode(
|
final Map<String, dynamic> data = json.decode(
|
||||||
file('$testDirectory/build/$resultFilename.json').readAsStringSync(),
|
file('$testDirectory/build/$resultFilename.json').readAsStringSync(),
|
||||||
) as Map<String, dynamic>;
|
) as Map<String, dynamic>;
|
||||||
final List<String> detailFiles = <String>[
|
|
||||||
if (saveTraceFile)
|
|
||||||
'$testDirectory/build/$traceFilename.json',
|
|
||||||
];
|
|
||||||
|
|
||||||
if (data['frame_count'] as int < 5) {
|
if (data['frame_count'] as int < 5) {
|
||||||
return TaskResult.failure(
|
return TaskResult.failure(
|
||||||
@ -657,7 +653,10 @@ class PerfTest {
|
|||||||
final bool isAndroid = deviceOperatingSystem == DeviceOperatingSystem.android;
|
final bool isAndroid = deviceOperatingSystem == DeviceOperatingSystem.android;
|
||||||
return TaskResult.success(
|
return TaskResult.success(
|
||||||
data,
|
data,
|
||||||
detailFiles: detailFiles.isNotEmpty ? detailFiles : null,
|
detailFiles: <String>[
|
||||||
|
if (saveTraceFile)
|
||||||
|
'$testDirectory/build/$traceFilename.json',
|
||||||
|
],
|
||||||
benchmarkScoreKeys: benchmarkScoreKeys ?? <String>[
|
benchmarkScoreKeys: benchmarkScoreKeys ?? <String>[
|
||||||
..._kCommonScoreKeys,
|
..._kCommonScoreKeys,
|
||||||
'average_vsync_transitions_missed',
|
'average_vsync_transitions_missed',
|
||||||
|
@ -17,6 +17,7 @@ void main() {
|
|||||||
'not_a_metric': 'something',
|
'not_a_metric': 'something',
|
||||||
},
|
},
|
||||||
'benchmarkScoreKeys': <String>['i', 'j'],
|
'benchmarkScoreKeys': <String>['i', 'j'],
|
||||||
|
'detailFiles': <String>[],
|
||||||
};
|
};
|
||||||
final TaskResult result = TaskResult.fromJson(expectedJson);
|
final TaskResult result = TaskResult.fromJson(expectedJson);
|
||||||
expect(result.toJson(), expectedJson);
|
expect(result.toJson(), expectedJson);
|
||||||
@ -30,6 +31,7 @@ void main() {
|
|||||||
'success': true,
|
'success': true,
|
||||||
'data': null,
|
'data': null,
|
||||||
'benchmarkScoreKeys': <String>[],
|
'benchmarkScoreKeys': <String>[],
|
||||||
|
'detailFiles': <String>[],
|
||||||
};
|
};
|
||||||
expect(result.toJson(), expectedJson);
|
expect(result.toJson(), expectedJson);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user