Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(824)

Unified Diff: tests/lib/mirrors/invocation_fuzz_test.dart

Issue 241993004: Mark private functions in dart:* that are native or constructors is not visible (omitted from stack… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/lib/lib.status ('k') | tests/lib/mirrors/invoke_natives_fuzz_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/mirrors/invocation_fuzz_test.dart
diff --git a/tests/lib/mirrors/invoke_natives_fuzz_test.dart b/tests/lib/mirrors/invocation_fuzz_test.dart
similarity index 62%
rename from tests/lib/mirrors/invoke_natives_fuzz_test.dart
rename to tests/lib/mirrors/invocation_fuzz_test.dart
index f9967eeffe2ea0d8ff438f705648019aed469898..aa0660aa7999f56970b185b19b8a5b7c32fdd94e 100644
--- a/tests/lib/mirrors/invoke_natives_fuzz_test.dart
+++ b/tests/lib/mirrors/invocation_fuzz_test.dart
@@ -14,24 +14,42 @@ import 'package:expect/expect.dart';
// Methods to be skipped, by qualified name.
var blacklist = [
- // These prevent the test from exiting, typically by spawning another isolate.
+ // Don't recurse on this test.
+ 'test.invoke_natives',
+
+ // Don't exit the test pre-maturely.
+ 'dart.io.exit',
+
+ // Don't run blocking io calls.
+ new RegExp(r".*Sync$"),
+
+ // These prevent the test from exiting.
'dart.async._scheduleAsyncCallback',
+ 'dart.async._setTimerFactoryClosure',
+
+ 'dart.isolate._startIsolate',
+ 'dart.io.sleep',
+ 'dart.io.HttpServer.HttpServer.listenOn',
+
+ // These either cause the VM to segfault or throw uncatchable API errors.
+ // TODO(15274): Fix them and remove from blacklist.
'dart.io._IOService.dispatch',
- 'dart.isolate.RawReceivePort.RawReceivePort',
- 'dart.isolate.ReceivePort.ReceivePort',
- 'dart.isolate.ReceivePort.ReceivePort.fromRawReceivePort',
- 'dart.isolate.ReceivePort.sendPort',
- 'dart.isolate.ReceivePort.close',
- 'dart.isolate.ReceivePort.listen',
- 'dart.isolate.RawReceivePort.sendPort',
- 'dart.isolate.RawReceivePort.close',
- 'dart.isolate.RawReceivePort.handler=',
-
- // These "crash" the VM (throw uncatchable API errors).
- // TODO(15274): Fill in this list to make the test pass and provide coverage
- // against addition of new natives.
+ new RegExp(r'.*_RandomAccessFile.*'),
+ 'dart.io._StdIOUtils._socketType',
+ 'dart.io._StdIOUtils._getStdioOutputStream',
+ 'dart.io._Filter.newZLibInflateFilter',
+ 'dart.io._Filter.newZLibDeflateFilter',
+ 'dart.io._FileSystemWatcher._listenOnSocket',
];
+bool isBlacklisted(Symbol qualifiedSymbol) {
+ var qualifiedString = MirrorSystem.getName(qualifiedSymbol);
+ for (var pattern in blacklist) {
+ if (qualifiedString.contains(pattern)) return true;
+ }
+ return false;
+}
+
class Task {
var name;
var action;
@@ -39,7 +57,7 @@ class Task {
var queue = new List();
checkMethod(MethodMirror m, ObjectMirror target, [origin]) {
- if (blacklist.contains(MirrorSystem.getName(m.qualifiedName))) return;
+ if (isBlacklisted(m.qualifiedName)) return;
var task = new Task();
task.name = '${MirrorSystem.getName(m.qualifiedName)} from $origin';
@@ -63,21 +81,24 @@ checkMethod(MethodMirror m, ObjectMirror target, [origin]) {
}
checkInstance(instanceMirror, origin) {
- instanceMirror.type.declarations.values
- .where((d) => d is MethodMirror)
- .forEach((m) => checkMethod(m, instanceMirror, origin));
+ ClassMirror klass = instanceMirror.type;
+ while (klass != null) {
+ instanceMirror.type.declarations.values
+ .where((d) => d is MethodMirror && !d.isStatic)
+ .forEach((m) => checkMethod(m, instanceMirror, origin));
+ klass = klass.superclass;
+ }
}
checkClass(classMirror) {
classMirror.declarations.values
- .where((d) => d is MethodMirror)
+ .where((d) => d is MethodMirror && d.isStatic)
.forEach((m) => checkMethod(m, classMirror));
classMirror.declarations.values
- .where((d) => d is MethodMirror)
+ .where((d) => d is MethodMirror && d.isConstructor)
.forEach((m) {
- if (blacklist.contains(MirrorSystem.getName(m.qualifiedName))) return;
- if (!m.isConstructor) return;
+ if (isBlacklisted(m.qualifiedName)) return;
var task = new Task();
task.name = MirrorSystem.getName(m.qualifiedName);
@@ -91,8 +112,8 @@ checkClass(classMirror) {
}
checkLibrary(libraryMirror) {
- // Don't recurse on this test.
- if (libraryMirror.simpleName == #test.invoke_natives) return;
+ print(libraryMirror.simpleName);
+ if (isBlacklisted(libraryMirror.qualifiedName)) return;
libraryMirror.declarations.values
.where((d) => d is ClassMirror)
@@ -104,19 +125,19 @@ checkLibrary(libraryMirror) {
}
var testZone;
-var debug = true;
doOneTask() {
if (queue.length == 0) {
- if (debug) print('Done');
+ print('Done');
return;
}
var task = queue.removeLast();
- if (debug) print(task.name);
+ print(task.name);
try {
task.action();
} catch(e) {}
+
// Register the next task in a timer callback so as to yield to async code
// scheduled in the current task. This isn't necessary for the test itself,
// but is helpful when trying to figure out which function is responsible for
@@ -124,9 +145,15 @@ doOneTask() {
testZone.createTimer(Duration.ZERO, doOneTask);
}
-main() {
+main([args]) {
currentMirrorSystem().libraries.values.forEach(checkLibrary);
+ var valueObjects =
+ [true, false, null,
+ 0, 0xEFFFFFF, 0xFFFFFFFF, 0xFFFFFFFFFFFFFFFF,
+ "foo", 'blåbærgrød', 'Îñţérñåţîöñåļîžåţîờñ'];
+ valueObjects.forEach((v) => checkInstance(reflect(v), 'value object'));
+
uncaughtErrorHandler(self, parent, zone, error, stack) {};
var zoneSpec =
new ZoneSpecification(handleUncaughtError: uncaughtErrorHandler);
« no previous file with comments | « tests/lib/lib.status ('k') | tests/lib/mirrors/invoke_natives_fuzz_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698