| Index: tests/standalone/io/file_blocking_lock_script.dart
|
| diff --git a/tests/standalone/io/file_blocking_lock_script.dart b/tests/standalone/io/file_blocking_lock_script.dart
|
| index 5c955c49e70959ae3ad42a74c77fa1c51421b22b..9ba2feb4b8a675e00ee1373ef4633b7493c3f1c2 100644
|
| --- a/tests/standalone/io/file_blocking_lock_script.dart
|
| +++ b/tests/standalone/io/file_blocking_lock_script.dart
|
| @@ -11,32 +11,15 @@ Future<int> testLockWholeFile(File file, int len) async {
|
| var raf = await file.open(mode: APPEND);
|
| await raf.setPosition(0);
|
| int nextToWrite = 1;
|
| - while (nextToWrite <= len) {
|
| - await raf.lock(FileLock.BLOCKING_EXCLUSIVE, 0, len);
|
| + await raf.lock(FileLock.BLOCKING_EXCLUSIVE, 0, len);
|
|
|
| - int at;
|
| - int p;
|
| - while (true) {
|
| - p = await raf.position();
|
| - at = await raf.readByte();
|
| - if (at == 0 || at == -1) break;
|
| - nextToWrite++;
|
| - }
|
| - await raf.setPosition(p);
|
| - await raf.writeByte(nextToWrite);
|
| - await raf.flush();
|
| - nextToWrite++;
|
| - await raf.unlock(0, len);
|
| - }
|
| + // Make sure the peer fails a non-blocking lock at some point.
|
| + await new Future.delayed(const Duration(seconds: 1));
|
|
|
| - await raf.lock(FileLock.BLOCKING_EXCLUSIVE, 0, len);
|
| - await raf.setPosition(0);
|
| - for (int i = 1; i <= len; i++) {
|
| - if ((await raf.readByte()) != i) {
|
| - await raf.unlock(0, len);
|
| - await raf.close();
|
| - return 1;
|
| - }
|
| + int p = 0;
|
| + while (p < len) {
|
| + await raf.writeByte(1);
|
| + p++;
|
| }
|
| await raf.unlock(0, len);
|
| await raf.close();
|
|
|