Chromium Code Reviews| Index: tests/standalone/io/file_lock_script.dart |
| diff --git a/tests/standalone/io/file_lock_script.dart b/tests/standalone/io/file_lock_script.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e5dbcd0a85f86931afe0c4596f88fe1449717a6f |
| --- /dev/null |
| +++ b/tests/standalone/io/file_lock_script.dart |
| @@ -0,0 +1,34 @@ |
| +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
|
Lasse Reichstein Nielsen
2015/01/08 11:59:22
2015
Søren Gjesse
2015/01/09 13:06:20
Done.
|
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| +// |
| +// Script used by the file_lock_test.dart test. |
| + |
| +import "dart:io"; |
| + |
| +main(List<String> args) { |
| + File file = new File(args[0]); |
| + int start = null; |
| + int end = null; |
| + var mode = FileLock.EXCLUSIVE; |
|
Lasse Reichstein Nielsen
2015/01/08 11:59:22
Consider making arguments optional, so:
if (args
Søren Gjesse
2015/01/09 13:06:20
The test code that calls this script always passes
|
| + if (args[1] != 'null') { |
| + start = int.parse(args[1]); |
| + } |
| + if (args[2] != 'null') { |
| + end = int.parse(args[2]); |
| + } |
| + if (args[3] == 'SHARED') { |
| + mode = FileLock.SHARED; |
| + } |
| + var raf = file.openSync(mode: WRITE); |
| + try { |
| + print('calling lockSync: $start $end $mode'); |
| + raf.lockSync(start, end, mode); |
| + } catch (e) { |
| + print('LOCK FAILED'); |
| + raf.closeSync(); |
| + return; |
| + } |
| + print('LOCK SUCCEEDED'); |
| + raf.closeSync(); |
|
kustermann
2015/01/08 12:54:27
move the raf.closeSync() into a finally? - then yo
Søren Gjesse
2015/01/09 13:06:20
Done.
|
| +} |