[testing] Multitests' copied imports should not be read-only

Change-Id: I4f2957385336f5f56fa804360aca902b019aac58
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96801
Auto-Submit: William Hesse <whesse@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: William Hesse <whesse@google.com>
diff --git a/tools/testing/dart/multitest.dart b/tools/testing/dart/multitest.dart
index 258ed6d..c0c6d7d 100644
--- a/tools/testing/dart/multitest.dart
+++ b/tools/testing/dart/multitest.dart
@@ -201,9 +201,11 @@
       TestUtils.mkdirRecursive(targetDir, importDir);
     }
 
-    // Copy file.
-    futureCopies.add(TestUtils.copyFile(
-        sourceDir.join(importPath), targetDir.join(importPath)));
+    // Copy file. Because some test suites may be read-only, we don't
+    // want to copy the permissions, so we create the copy by writing.
+    final source = File(sourceDir.join(importPath).toNativePath()).openRead();
+    final target = File(targetDir.join(importPath).toNativePath()).openWrite();
+    futureCopies.add(source.pipe(target));
   }
 
   // Wait until all imports are copied before scheduling test cases.