| Index: tests/standalone/io/file_blocking_lock_test.dart
|
| diff --git a/tests/standalone/io/file_blocking_lock_test.dart b/tests/standalone/io/file_blocking_lock_test.dart
|
| index ef826a2037075efa3dd2f35f13fd8db7653dff36..7445cb85405e7fb2257afa71d91911bffa9e7795 100644
|
| --- a/tests/standalone/io/file_blocking_lock_test.dart
|
| +++ b/tests/standalone/io/file_blocking_lock_test.dart
|
| @@ -39,7 +39,6 @@ runPeer(String path, int len, FileLock mode) {
|
|
|
| testLockWholeFile() async {
|
| const int length = 25;
|
| - asyncStart();
|
| Directory directory = await Directory.systemTemp.createTemp('dart_file_lock');
|
| File file = new File(join(directory.path, "file"));
|
| await file.writeAsBytes(new List.filled(length, 0));
|
| @@ -64,13 +63,17 @@ testLockWholeFile() async {
|
| // other process was able to take the lock and write some bytes.
|
| iWrote[nextToWrite-1] = nextToWrite;
|
| nextToWrite++;
|
| - await raf.unlock(0, length);
|
| - try {
|
| - await raf.lock(FileLock.EXCLUSIVE, 0, length);
|
| - } catch(e) {
|
| - // Check that at some point the non-blocking lock fails.
|
| - nonBlockingFailed = true;
|
| - await raf.lock(FileLock.BLOCKING_EXCLUSIVE, 0, length);
|
| + // Let the other process get the lock at least once by spinning until the
|
| + // non-blocking lock fails.
|
| + while (!nonBlockingFailed) {
|
| + await raf.unlock(0, length);
|
| + try {
|
| + await raf.lock(FileLock.EXCLUSIVE, 0, length);
|
| + } catch(e) {
|
| + // Check that at some point the non-blocking lock fails.
|
| + nonBlockingFailed = true;
|
| + await raf.lock(FileLock.BLOCKING_EXCLUSIVE, 0, length);
|
| + }
|
| }
|
| while (true) {
|
| p = await raf.position();
|
| @@ -96,14 +99,15 @@ testLockWholeFile() async {
|
|
|
| Expect.equals(true, nonBlockingFailed);
|
|
|
| - peer.exitCode.then((v) {
|
| + await peer.exitCode.then((v) async {
|
| Expect.equals(0, v);
|
| - raf.closeSync();
|
| - directory.deleteSync(recursive: true);
|
| - asyncEnd();
|
| + await raf.close();
|
| + await directory.delete(recursive: true);
|
| });
|
| }
|
|
|
| -main() {
|
| - testLockWholeFile();
|
| +main() async {
|
| + asyncStart();
|
| + await testLockWholeFile();
|
| + asyncEnd();
|
| }
|
|
|