[dart/fuzzing] Use current directory as SDK top (by default)

Rationale:
DART_TOP can now be provided through switch, as
an environment variable or, by default, using the
current directory from which script is started.
This simplifies set up in cluster runs.
Change-Id: Icb4f720b7a7bb7b349ce158d39574c271132c224
Reviewed-on: https://dart-review.googlesource.com/76201
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
diff --git a/runtime/tools/dartfuzz/README.md b/runtime/tools/dartfuzz/README.md
index 6ea6625..ba2ce55 100644
--- a/runtime/tools/dartfuzz/README.md
+++ b/runtime/tools/dartfuzz/README.md
@@ -54,10 +54,13 @@
         aot-[debug-]arm64 = Dart AOT (simarm64)
         js                = dart2js + JS
 
-This fuzz testing tool assumes the environment variable 'DART_TOP'
-points to the top of the Dart SDK development tree in which all proper
-binaries have been built already (e.g. testing jit-ia32 will invoke
-the binary ${DART_TOP}/out/ReleaseIA32/dart to start the Dart VM).
+This fuzz testing tool must have access to the top of a Dart SDK
+development tree (DART_TOP) in which all proper binaries have been
+built already (for example, testing jit-ia32 will invoke the binary
+${DART_TOP}/out/ReleaseIA32/dart to start the Dart VM). The DART_TOP
+can be provided through the --dart-top option, as an environment
+variable, or, by default, as the current directory by invoking the
+fuzz testing tool from the Dart SDK top.
 
 Background
 ==========
diff --git a/runtime/tools/dartfuzz/dartfuzz_test.dart b/runtime/tools/dartfuzz/dartfuzz_test.dart
index aed0162..b6da502 100644
--- a/runtime/tools/dartfuzz/dartfuzz_test.dart
+++ b/runtime/tools/dartfuzz/dartfuzz_test.dart
@@ -303,9 +303,12 @@
     final mode1 = results['mode1'];
     final mode2 = results['mode2'];
     var top = results['dart-top'];
-    if (top == '') {
+    if (top == null || top == '') {
       top = env['DART_TOP'];
     }
+    if (top == null || top == '') {
+      top = Directory.current.path;
+    }
     final session = new DartFuzzTest(
         env, repeat, trueDivergence, showStats, top, mode1, mode2);
     if (!session.runSession()) {