Use TEST_SRCDIR instead of RUNFILES to access the test files.

The RUNFILES environment variable is an implementation detail of the
internal build rule, while TEST_SRCDIR is set by bazel. In practice,
they are pointed to the same directory.

See go/lsc-dart-runfiles for context.

R=srawlins@google.com

Change-Id: I2f7ea1aef7ff4ce2209d001eb89054e86abf22d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/344342
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Chingjun Lau <chingjun@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
diff --git a/pkg/analyzer/lib/src/summary2/kernel_compilation_service.dart b/pkg/analyzer/lib/src/summary2/kernel_compilation_service.dart
index 232d9e7..4907db0 100644
--- a/pkg/analyzer/lib/src/summary2/kernel_compilation_service.dart
+++ b/pkg/analyzer/lib/src/summary2/kernel_compilation_service.dart
@@ -156,7 +156,7 @@
 
   static _SdkPaths _computeSdkPaths() {
     // Check for google3.
-    final runFiles = io.Platform.environment['RUNFILES'];
+    final runFiles = io.Platform.environment['TEST_SRCDIR'];
     if (runFiles != null) {
       final aotRuntimePath = io.Platform.environment['AOT_RUNTIME_PATH']!;
       final frontServerPath = io.Platform.environment['FRONTEND_SERVER_PATH']!;
diff --git a/pkg/analyzer_utilities/lib/package_root.dart b/pkg/analyzer_utilities/lib/package_root.dart
index 27a7d8a..c7ffdef 100644
--- a/pkg/analyzer_utilities/lib/package_root.dart
+++ b/pkg/analyzer_utilities/lib/package_root.dart
@@ -28,7 +28,7 @@
   // Try google3 environment. We expect that all packages that will be
   // accessed via this root are configured in the BUILD file, and located
   // inside this single root.
-  final runFiles = Platform.environment['RUNFILES'];
+  final runFiles = Platform.environment['TEST_SRCDIR'];
   final analyzerPackagesRoot = Platform.environment['ANALYZER_PACKAGES_ROOT'];
   if (runFiles != null && analyzerPackagesRoot != null) {
     return pathos.join(runFiles, analyzerPackagesRoot);