ant Tue Dec 30 17:11:57 2008 UTC
Modified files: (Branch: PHP_5_2)
/php-src/ext/standard/tests/file flock_variation.phpt
Log:
Revert to the previous version for these tests as they were overwritten by
mistake (checked on Windows but not on Linux... so the six skipped tests may
not work correctly... but they should be ok and I'll watch the test results).
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/flock_variation.phpt?r1=1.1.2.2&r2=1.1.2.3&diff_format=u
Index: php-src/ext/standard/tests/file/flock_variation.phpt
diff -u php-src/ext/standard/tests/file/flock_variation.phpt:1.1.2.2
php-src/ext/standard/tests/file/flock_variation.phpt:1.1.2.3
--- php-src/ext/standard/tests/file/flock_variation.phpt:1.1.2.2 Tue Nov
25 11:31:24 2008
+++ php-src/ext/standard/tests/file/flock_variation.phpt Tue Dec 30
17:11:57 2008
@@ -1,45 +1,328 @@
--TEST--
-Test flock() function: usage variations
+Test flock() function: Variations
--FILE--
<?php
/*
Prototype: bool flock(resource $handle, int $operation [, int &$wouldblock]);
-Description: PHP supports a portable way of locking complete files in an
advisory way
+Description: PHP supports a portable way of locking complete files
+ in an advisory way
*/
-echo "*** Test flock() function: with the operations given as numeric values
***\n";
+echo "*** Testing flock() fun with the various operation and
+ wouldblock values ***\n";
+$file = dirname(__FILE__)."/flock.tmp";
+$fp = fopen($file, "w");
-$filename = dirname(__FILE__)."/flock_variation.tmp";
-$file_handle = fopen($filename, "w");
-
-/* array of operations */
+/* array of operatons */
$operations = array(
- 1, //nothing but LOCK_SH
- 2, //nothing but LOCK_EX
- 2.234, //nothing but LOCK_EX
- TRUE //nothing but LOCK_SH
+ LOCK_SH,
+ LOCK_EX,
+ LOCK_SH|LOCK_NB,
+ LOCK_EX|LOCK_NB,
+ LOCK_SH|LOCK_EX,
+ LOCK_UN,
+ 1,
+ 2,
+ 2.234,
+ TRUE
+);
+
+/* array of wouldblocks */
+$wouldblocks = array(
+ 0,
+ 1,
+ 2,
+ 1.234,
+ TRUE,
+ FALSE,
+ NULL,
+ array(1,2,3),
+ array(),
+ "string",
+ "",
+ "\0"
);
$i = 0;
foreach($operations as $operation) {
- var_dump(flock($file_handle, $operation));
- var_dump(flock($file_handle, 3)); //nothing but LOCK_UN
+ echo "--- Outer iteration $i ---\n";
+ var_dump(flock($fp, $operation));
+ $j = 0;
+ foreach($wouldblocks as $wouldblock) {
+ echo "-- Inner iteration $j in $i --\n";
+ var_dump(flock($fp, $operation, $wouldblock));
+ $j++;
+ }
$i++;
}
-fclose($file_handle);
-unlink($filename);
+fclose($fp);
+...@unlink($file);
-echo "*** Done ***\n";
+echo "\n*** Done ***\n";
?>
--EXPECTF--
-*** Test flock() function: with the operations given as numeric values ***
+*** Testing flock() fun with the various operation and
+ wouldblock values ***
+--- Outer iteration 0 ---
+bool(true)
+-- Inner iteration 0 in 0 --
+bool(true)
+-- Inner iteration 1 in 0 --
+bool(true)
+-- Inner iteration 2 in 0 --
+bool(true)
+-- Inner iteration 3 in 0 --
+bool(true)
+-- Inner iteration 4 in 0 --
+bool(true)
+-- Inner iteration 5 in 0 --
+bool(true)
+-- Inner iteration 6 in 0 --
+bool(true)
+-- Inner iteration 7 in 0 --
+bool(true)
+-- Inner iteration 8 in 0 --
+bool(true)
+-- Inner iteration 9 in 0 --
+bool(true)
+-- Inner iteration 10 in 0 --
+bool(true)
+-- Inner iteration 11 in 0 --
+bool(true)
+--- Outer iteration 1 ---
+bool(true)
+-- Inner iteration 0 in 1 --
+bool(true)
+-- Inner iteration 1 in 1 --
+bool(true)
+-- Inner iteration 2 in 1 --
+bool(true)
+-- Inner iteration 3 in 1 --
+bool(true)
+-- Inner iteration 4 in 1 --
+bool(true)
+-- Inner iteration 5 in 1 --
+bool(true)
+-- Inner iteration 6 in 1 --
+bool(true)
+-- Inner iteration 7 in 1 --
+bool(true)
+-- Inner iteration 8 in 1 --
+bool(true)
+-- Inner iteration 9 in 1 --
+bool(true)
+-- Inner iteration 10 in 1 --
+bool(true)
+-- Inner iteration 11 in 1 --
+bool(true)
+--- Outer iteration 2 ---
+bool(true)
+-- Inner iteration 0 in 2 --
+bool(true)
+-- Inner iteration 1 in 2 --
+bool(true)
+-- Inner iteration 2 in 2 --
+bool(true)
+-- Inner iteration 3 in 2 --
+bool(true)
+-- Inner iteration 4 in 2 --
+bool(true)
+-- Inner iteration 5 in 2 --
+bool(true)
+-- Inner iteration 6 in 2 --
+bool(true)
+-- Inner iteration 7 in 2 --
+bool(true)
+-- Inner iteration 8 in 2 --
+bool(true)
+-- Inner iteration 9 in 2 --
+bool(true)
+-- Inner iteration 10 in 2 --
+bool(true)
+-- Inner iteration 11 in 2 --
+bool(true)
+--- Outer iteration 3 ---
+bool(true)
+-- Inner iteration 0 in 3 --
+bool(true)
+-- Inner iteration 1 in 3 --
+bool(true)
+-- Inner iteration 2 in 3 --
+bool(true)
+-- Inner iteration 3 in 3 --
+bool(true)
+-- Inner iteration 4 in 3 --
+bool(true)
+-- Inner iteration 5 in 3 --
+bool(true)
+-- Inner iteration 6 in 3 --
+bool(true)
+-- Inner iteration 7 in 3 --
+bool(true)
+-- Inner iteration 8 in 3 --
+bool(true)
+-- Inner iteration 9 in 3 --
+bool(true)
+-- Inner iteration 10 in 3 --
+bool(true)
+-- Inner iteration 11 in 3 --
+bool(true)
+--- Outer iteration 4 ---
+bool(true)
+-- Inner iteration 0 in 4 --
+bool(true)
+-- Inner iteration 1 in 4 --
+bool(true)
+-- Inner iteration 2 in 4 --
+bool(true)
+-- Inner iteration 3 in 4 --
+bool(true)
+-- Inner iteration 4 in 4 --
+bool(true)
+-- Inner iteration 5 in 4 --
+bool(true)
+-- Inner iteration 6 in 4 --
+bool(true)
+-- Inner iteration 7 in 4 --
bool(true)
+-- Inner iteration 8 in 4 --
bool(true)
+-- Inner iteration 9 in 4 --
bool(true)
+-- Inner iteration 10 in 4 --
bool(true)
+-- Inner iteration 11 in 4 --
bool(true)
+--- Outer iteration 5 ---
bool(true)
+-- Inner iteration 0 in 5 --
bool(true)
+-- Inner iteration 1 in 5 --
bool(true)
+-- Inner iteration 2 in 5 --
+bool(true)
+-- Inner iteration 3 in 5 --
+bool(true)
+-- Inner iteration 4 in 5 --
+bool(true)
+-- Inner iteration 5 in 5 --
+bool(true)
+-- Inner iteration 6 in 5 --
+bool(true)
+-- Inner iteration 7 in 5 --
+bool(true)
+-- Inner iteration 8 in 5 --
+bool(true)
+-- Inner iteration 9 in 5 --
+bool(true)
+-- Inner iteration 10 in 5 --
+bool(true)
+-- Inner iteration 11 in 5 --
+bool(true)
+--- Outer iteration 6 ---
+bool(true)
+-- Inner iteration 0 in 6 --
+bool(true)
+-- Inner iteration 1 in 6 --
+bool(true)
+-- Inner iteration 2 in 6 --
+bool(true)
+-- Inner iteration 3 in 6 --
+bool(true)
+-- Inner iteration 4 in 6 --
+bool(true)
+-- Inner iteration 5 in 6 --
+bool(true)
+-- Inner iteration 6 in 6 --
+bool(true)
+-- Inner iteration 7 in 6 --
+bool(true)
+-- Inner iteration 8 in 6 --
+bool(true)
+-- Inner iteration 9 in 6 --
+bool(true)
+-- Inner iteration 10 in 6 --
+bool(true)
+-- Inner iteration 11 in 6 --
+bool(true)
+--- Outer iteration 7 ---
+bool(true)
+-- Inner iteration 0 in 7 --
+bool(true)
+-- Inner iteration 1 in 7 --
+bool(true)
+-- Inner iteration 2 in 7 --
+bool(true)
+-- Inner iteration 3 in 7 --
+bool(true)
+-- Inner iteration 4 in 7 --
+bool(true)
+-- Inner iteration 5 in 7 --
+bool(true)
+-- Inner iteration 6 in 7 --
+bool(true)
+-- Inner iteration 7 in 7 --
+bool(true)
+-- Inner iteration 8 in 7 --
+bool(true)
+-- Inner iteration 9 in 7 --
+bool(true)
+-- Inner iteration 10 in 7 --
+bool(true)
+-- Inner iteration 11 in 7 --
+bool(true)
+--- Outer iteration 8 ---
+bool(true)
+-- Inner iteration 0 in 8 --
+bool(true)
+-- Inner iteration 1 in 8 --
+bool(true)
+-- Inner iteration 2 in 8 --
+bool(true)
+-- Inner iteration 3 in 8 --
+bool(true)
+-- Inner iteration 4 in 8 --
+bool(true)
+-- Inner iteration 5 in 8 --
+bool(true)
+-- Inner iteration 6 in 8 --
+bool(true)
+-- Inner iteration 7 in 8 --
+bool(true)
+-- Inner iteration 8 in 8 --
+bool(true)
+-- Inner iteration 9 in 8 --
+bool(true)
+-- Inner iteration 10 in 8 --
+bool(true)
+-- Inner iteration 11 in 8 --
+bool(true)
+--- Outer iteration 9 ---
+bool(true)
+-- Inner iteration 0 in 9 --
+bool(true)
+-- Inner iteration 1 in 9 --
+bool(true)
+-- Inner iteration 2 in 9 --
+bool(true)
+-- Inner iteration 3 in 9 --
+bool(true)
+-- Inner iteration 4 in 9 --
+bool(true)
+-- Inner iteration 5 in 9 --
+bool(true)
+-- Inner iteration 6 in 9 --
+bool(true)
+-- Inner iteration 7 in 9 --
+bool(true)
+-- Inner iteration 8 in 9 --
+bool(true)
+-- Inner iteration 9 in 9 --
+bool(true)
+-- Inner iteration 10 in 9 --
+bool(true)
+-- Inner iteration 11 in 9 --
+bool(true)
+
*** Done ***
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php