[VM/Service] Fix get_perfetto_cpu_samples_rpc_test My change https://github.com/dart-lang/sdk/commit/f3536c5c4211479918c9de34c9e74d866dd31c52 has made the test start failing on more configs, because now the `fib` computation isn't lasting long enough for any samples to get collected. This change makes the `fib` computation take longer. Issue: https://github.com/dart-lang/sdk/issues/54401 Change-Id: I0f038df21bb116f97a5093e7d2e58ccda7447977 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/411161 Commit-Queue: Derek Xu <derekx@google.com> Reviewed-by: Liam Appelbe <liama@google.com>
diff --git a/pkg/vm_service/test/get_perfetto_cpu_samples_rpc_test.dart b/pkg/vm_service/test/get_perfetto_cpu_samples_rpc_test.dart index 7b42b93..b94ea70 100644 --- a/pkg/vm_service/test/get_perfetto_cpu_samples_rpc_test.dart +++ b/pkg/vm_service/test/get_perfetto_cpu_samples_rpc_test.dart
@@ -11,15 +11,12 @@ import 'common/service_test_common.dart'; import 'common/test_helper.dart'; -int fib(n) { - if (n < 0) return 0; - if (n == 0) return 1; - return fib(n - 1) + fib(n - 2); -} - void testeeDo() { print('Testee doing something.'); - fib(21); + final stopwatch = Stopwatch(); + stopwatch.start(); + while (stopwatch.elapsedMilliseconds < 5000) {} + stopwatch.stop(); print('Testee did something.'); }