Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions app/integration_test/app_performance_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:path_provider/path_provider.dart';

import 'package:omi/main.dart' as app;

Expand Down Expand Up @@ -582,14 +581,13 @@ void _printFinalSummary(Map<String, List<FrameTiming>> allTimings) {
debugPrint('');

// Write results to file for comparison
await _writeResultsToFile(allTimings);
_writeResultsToFile(allTimings);
}

Future<void> _writeResultsToFile(Map<String, List<FrameTiming>> allTimings) async {
void _writeResultsToFile(Map<String, List<FrameTiming>> allTimings) {
try {
final dir = await getTemporaryDirectory();
final timestamp = DateTime.now().toIso8601String().replaceAll(':', '-');
final file = File('${dir.path}/omi_perf_$timestamp.csv');
final file = File('/tmp/omi_perf_$timestamp.csv');
Comment on lines 589 to +590

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 The hardcoded /tmp path works on Linux/macOS but silently fails on Android and iOS — the two primary targets for Flutter integration tests. On Android the path is inaccessible to the app sandbox, and on iOS /tmp doesn't exist. The failure is swallowed by the catch block, so test results will be silently lost whenever the file write fails. The original code used getTemporaryDirectory() for exactly this reason. Since _writeResultsToFile is now void (not async), the async version can't be called directly, but the function can be made async and fire-and-forget via unawaited(), or the path can be resolved synchronously using Platform.environment as a fallback.

Suggested change
final timestamp = DateTime.now().toIso8601String().replaceAll(':', '-');
final file = File('${dir.path}/omi_perf_$timestamp.csv');
final file = File('/tmp/omi_perf_$timestamp.csv');
final timestamp = DateTime.now().toIso8601String().replaceAll(':', '-');
// Use TMPDIR env var so this works on iOS/Android sandboxes as well as
// Linux/macOS. Falls back to /tmp only on platforms where it is valid.
final tmpDir = Platform.environment['TMPDIR'] ?? Platform.environment['TMP'] ?? '/tmp';
final file = File('$tmpDir/omi_perf_$timestamp.csv');


final buffer = StringBuffer();
buffer.writeln('screen,frame_index,build_us,raster_us,total_us');
Expand Down
Loading
Loading