dart-sdk/tests/ffi/data_not_asan_test.dart
Samir Jindel 580f44aa83 [vm] Enable running FFI tests on Android in JIT-mode.
* Move FFI tests into a separate test suite.
  They never belonged in standalone_2/ since they are not only available in
  the standalone VM. Also, we want to have a separate status file.

* Add new "SharedObjects" option to test files to copy needed shared objects
  to the Android device for testing.

* Add support to compiler/runtime_configuration.dart for testing JIT-mode on Android.

* Add new configurations and builders to test_matrix.json to test JIT-mode on Android.

* Clean up status file entries for FFI (we didn't need to special-case stress & subtype tests).

Change-Id: Ifb32ef7051754f477d00ecd7a0f9b19ca8a66eae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97334
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2019-03-25 16:14:18 +00:00

29 lines
1,008 B
Dart

// Copyright (c) 2019, 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.
//
// Dart test program for testing dart:ffi primitive data pointers.
// This test tries to allocate too much memory on purpose to test the Exception
// thrown on malloc failing.
// This malloc also triggers an asan alarm, so this test is in a separate file
// which is excluded in asan mode.
library FfiTest;
import 'dart:ffi' as ffi;
import "package:expect/expect.dart";
void main() {
testPointerAllocateTooLarge();
}
/// This test is skipped in asan mode.
void testPointerAllocateTooLarge() {
int maxInt = 9223372036854775807; // 2^63 - 1
Expect.throws(
() => ffi.allocate<ffi.Int64>(count: maxInt)); // does not fit in range
int maxInt1_8 = 1152921504606846975; // 2^60 -1
Expect.throws(
() => ffi.allocate<ffi.Int64>(count: maxInt1_8)); // not enough memory
}