dart-sdk/tests/ffi/regress_47594_test.dart
Ryan Macnak ae13d34299 [test] Avoid tests fighting over the default service port.
With no argument, --enable-vm-service and --observe default to port 8181. Passing 0 means to take any available port. If two tests try to use the default port at the same time, one will fail to bind that port.

TEST=ci
Change-Id: Ib7615911db9fb9ab037de1efdd4918b54f59d9e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268840
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-11-10 17:28:48 +00:00

23 lines
783 B
Dart

// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
//
// Regression test for http://dartbug.com/47594.
// FFI leaf calls did not mark the thread for the transition and would cause
// the stack walker to segfault when it was unable to interpret the frame.
//
// VMOptions=--deterministic --enable-vm-service=0 --profiler
import 'dart:ffi';
import 'package:ffi/ffi.dart';
final strerror = DynamicLibrary.process()
.lookupFunction<Pointer<Utf8> Function(Int32), Pointer<Utf8> Function(int)>(
'strerror',
isLeaf: true);
void main() {
for (var i = 0; i < 10000; i++) strerror(0).toDartString();
}