memwatch: quiet bounded test summary off a terminal; bounded analyze wrapper
run.sh now records flutter's JSON results beside the log and prints a summary from tool/memwatch/summary.dart: one verdict line (pass/fail/skip counts, peak MB, duration, exit status), only failing tests with their error and app stack frames (framework frames dropped, per-test and total caps, tail of printed output), the tests still running when killed, and the log and JSON paths. Quiet is the default when stdout is not a terminal; MEMWATCH_OUTPUT=full also prints the whole log. The watchdog loop and exit status are unchanged. tool/analyze.sh bounds flutter analyze to a verdict line and the first 40 issues. Tests: test/tool/memwatch/summary_test.dart and the end-to-end tool/memwatch/quiet_test.sh over fixture suites.
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
// Fixture for tool/memwatch/quiet_test.sh: one passing test, one plain
|
||||
// expectation failure and one widget-test failure that prints far more than
|
||||
// the quiet summary may show. It lives outside test/ so the app suite skips it.
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
test('passing neighbour', () => expect(1, 1));
|
||||
|
||||
test('plain expectation fails', () {
|
||||
expect('memwatch-actual', 'memwatch-expected');
|
||||
});
|
||||
|
||||
testWidgets('widget failure with long output', (tester) async {
|
||||
for (var i = 0; i < 2000; i++) {
|
||||
// ignore: avoid_print
|
||||
print('memwatch-flood line $i ${'x' * 60}');
|
||||
}
|
||||
await tester.pumpWidget(const Text('memwatch', textDirection: TextDirection.ltr));
|
||||
expect(find.text('memwatch-missing-widget'), findsOneWidget);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// Fixture for tool/memwatch/quiet_test.sh: a passing suite whose output must
|
||||
// not appear in quiet mode. It lives outside test/ so the app suite skips it.
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
for (var i = 0; i < 3; i++) {
|
||||
test('passing fixture $i', () {
|
||||
// Printed output of a passing test is not part of the quiet summary.
|
||||
// ignore: avoid_print
|
||||
print('memwatch-noise-from-passing-test $i');
|
||||
expect(i, lessThan(3));
|
||||
});
|
||||
}
|
||||
test('skipped fixture', () {}, skip: 'fixture skip');
|
||||
}
|
||||
Reference in New Issue
Block a user