]> granicus.if.org Git - php/commitdiff
Fix slowest tests
authorGabriel Caruso <carusogabriel34@gmail.com>
Sat, 2 Nov 2019 15:29:42 +0000 (16:29 +0100)
committerGabriel Caruso <carusogabriel34@gmail.com>
Sun, 5 Jan 2020 17:30:51 +0000 (18:30 +0100)
21 files changed:
ext/standard/tests/file/005_variation-win32.phpt
ext/standard/tests/file/lstat_stat_variation10.phpt
ext/standard/tests/file/lstat_stat_variation11.phpt
ext/standard/tests/file/lstat_stat_variation12.phpt
ext/standard/tests/file/lstat_stat_variation13.phpt
ext/standard/tests/file/lstat_stat_variation16.phpt
ext/standard/tests/file/lstat_stat_variation17.phpt
ext/standard/tests/file/lstat_stat_variation21.phpt
ext/standard/tests/file/lstat_stat_variation4.phpt
ext/standard/tests/file/lstat_stat_variation5.phpt
ext/standard/tests/file/lstat_stat_variation8.phpt
ext/standard/tests/file/stat_basic-win32-mb.phpt
ext/standard/tests/file/stat_basic-win32.phpt
ext/standard/tests/file/stat_variation1-win32-mb.phpt
ext/standard/tests/file/stat_variation1-win32.phpt
ext/standard/tests/file/stat_variation2-win32.phpt
ext/standard/tests/file/stat_variation3-win32.phpt
ext/standard/tests/file/stat_variation4-win32.phpt
ext/standard/tests/file/stat_variation5-win32.phpt
ext/standard/tests/file/stat_variation6-win32.phpt
ext/standard/tests/file/stat_variation8-win32.phpt

index 1e712b7828c6b91f6d69d313ee66bbd7f0e8c599..42502b65094d4fccd08d01cb8d286fe34ca28326 100644 (file)
@@ -40,7 +40,6 @@ function stat_fn( $filename ) {
   echo "-- inode change time is => ";
   print( @date( 'Y:M:D:H:i:s', filectime($filename) ) )."\n";
   clearstatcache();
-
 }
 
 echo "*** Testing fileattime(), filemtime(), filectime() & touch() : usage variations ***\n";
@@ -49,12 +48,12 @@ $file_path = __DIR__;
 $file_handle = fopen("$file_path/005_variation1.tmp", "w");
 fclose($file_handle);
 stat_fn("$file_path/005_variation1.tmp");
-sleep(2);
+sleep(1);
 
 $file_handle = fopen("$file_path/005_variation2.tmp", "w");
 fclose($file_handle);
 stat_fn("$file_path/005_variation2.tmp");
-sleep(2);
+sleep(1);
 
 $file_handle = fopen("$file_path/005_variation3.tmp", "w");
 fclose($file_handle);
@@ -70,13 +69,13 @@ $file_name = "$file_path/005_variation1.tmp";
 $file_write_handle = fopen($file_name, "w");
 fclose($file_write_handle);
 stat_fn($file_name);
-sleep(2);
+sleep(1);
 
 /* filectime + 2 */
 echo "\n-- Checking different times, after changing the file permission --\n";
 chmod($file_name, 0777);
 stat_fn($file_name);
-sleep(2);
+sleep(1);
 
 /* filemtime + 2 & filectime + 2 */
 echo "\n-- Checking different times, after writing into the file --\n";
@@ -84,7 +83,7 @@ $file_write_handle = fopen($file_name, "w");
 fwrite($file_write_handle, "Hello, world");
 fclose($file_write_handle);
 stat_fn($file_name);
-sleep(2);
+sleep(1);
 
 /* fileatime + 2 */
 echo "\n-- Checking different times, after reading from the file --\n";
@@ -92,42 +91,54 @@ $file_read_handle = fopen($file_name ,"r");
 fread($file_read_handle, 10);
 fclose( $file_read_handle);
 stat_fn($file_name);
-sleep(2);
+sleep(1);
+
+/* No change */
+echo "\n-- Checking same times, after creating a softlink to the file --\n";
+symlink($file_name, "$file_path/005_variation_softlink.tmp");
+stat_fn($file_name);
+sleep(1);
+
+/* filectime + 2 */
+echo "\n-- Checking different times, after creating a hardlink to the file --\n";
+link($file_name, "$file_path/005_variation_hardlink.tmp");
+stat_fn($file_name);
+sleep(1);
 
 /* No change */
-echo "\n-- Checking different times, after making a copy of the file --\n";
+echo "\n-- Checking same times, after making a copy of the file --\n";
 $file_copy = "$file_path/005_variation_copy.tmp";
 copy($file_name, $file_copy);
 stat_fn($file_name);
-sleep(2);
+sleep(1);
 
 /* fileatime + 2 */
 echo "\n-- Checking different times, after performing is_file() operation on the file --\n";
 is_file($file_name);
 stat_fn($file_name);
-sleep(2);
+sleep(1);
 
 
 echo "\n*** Testing touch() function with different time values ***\n";
 $file_name2 = $file_path."/005_variation_touch.tmp";
 $file_handle = fopen($file_name2, "w");
 fclose($file_handle);
-sleep(2);
+sleep(1);
 
 /* Time is not mentioned */
 var_dump( touch($file_name2) ); //set to current system time
 stat_fn($file_name2);
-sleep(2);
+sleep(1);
 
 /* set to access(creation time of the file) time */
 var_dump( touch($file_name2, @date(fileatime($file_name2))) );
 stat_fn($file_name2);
-sleep(2);
+sleep(1);
 
 /* set to access time of $file_name2 */
 var_dump( touch($file_path."/005_variation_touch_fly.tmp", @date(fileatime($file_name2)), time()) );
 stat_fn($file_name2);
-sleep(2);
+sleep(1);
 
 /* set to default value, with Invalid timestamps */
 var_dump( touch($file_name2, 10) );
@@ -184,7 +195,17 @@ unlink($file_path."/005_variation_touch_new.tmp");
 -- File modification time is => %d:%s:%s:%d:%d:%d
 -- inode change time is => %d:%s:%s:%d:%d:%d
 
--- Checking different times, after making a copy of the file --
+-- Checking same times, after creating a softlink to the file --
+-- File access time is => %d:%s:%s:%d:%d:%d
+-- File modification time is => %d:%s:%s:%d:%d:%d
+-- inode change time is => %d:%s:%s:%d:%d:%d
+
+-- Checking different times, after creating a hardlink to the file --
+-- File access time is => %d:%s:%s:%d:%d:%d
+-- File modification time is => %d:%s:%s:%d:%d:%d
+-- inode change time is => %d:%s:%s:%d:%d:%d
+
+-- Checking same times, after making a copy of the file --
 -- File access time is => %d:%s:%s:%d:%d:%d
 -- File modification time is => %d:%s:%s:%d:%d:%d
 -- inode change time is => %d:%s:%s:%d:%d:%d
index 16ff75c26da8a155e71a400322a553cf4724debf..30578f5d184d160142165671424073d11f5cb409 100644 (file)
@@ -31,7 +31,7 @@ echo "*** Testing stat() on directory after using is_dir() on it ***\n";
 $old_stat = stat($dirname);
 // clear the cache
 clearstatcache();
-sleep(2);
+sleep(1);
 var_dump( is_dir($dirname) );
 $new_stat = stat($dirname);
 
index 9a394ae7e9a8d662d78f5ac3f8829dea1d67cb58..523bfacf5c8f4730d3923c349aae9990bc8c6fb9 100644 (file)
@@ -31,7 +31,7 @@ echo "*** Testing stat() on a file after using is_file() on it ***\n";
 $old_stat = stat($filename);
 // clear the stat
 clearstatcache();
-sleep(2);
+sleep(1);
 var_dump( is_file($filename) );
 $new_stat = stat($filename);
 // compare self stats
index eada799cdf99baad1bfb3aa0f01e3bc175037f9d..15f081f21f45ad0edff7eb7cc0070f8ed956807a 100644 (file)
@@ -36,7 +36,7 @@ $linkname = "$file_path/lstat_stat_variation12_link.tmp";
 $old_stat = lstat($linkname);
 // clear the stat
 clearstatcache();
-sleep(2);
+sleep(1);
 var_dump( is_link($linkname) );
 $new_stat = lstat($linkname);
 // compare self stats
index 22694240f57db1afbdd2793e533ce8ca675006b8..e94a5085ec3a9068b50ed881b6625d10a96a760a 100644 (file)
@@ -30,7 +30,7 @@ fclose($file_handle);
 $old_stat = stat($filename);
 // clear the stat
 clearstatcache();
-sleep(2);
+sleep(1);
 // opening file again in read mode
 $file_handle = fopen($filename, "r");  // read file
 fclose($file_handle);
index 652f5c29c7bd38e484399a6fdcede3f3f8a0cf4c..93791355bab1e13265050ba5eef3ee34133291e5 100644 (file)
@@ -28,7 +28,7 @@ fclose($fp);
 // checking stat() on file after changing its permission
 echo "*** Testing lstat() on a file after changing its access permission ***\n";
 $old_stat = stat($filename);
-sleep(2);
+sleep(1);
 var_dump( chmod($filename, 0777) );
 // clear the stat
 clearstatcache();
index 208cc0b388ac2165daff5841f5c3a9461aa17c6c..64039566f0b58fcffa7eef662beb4ba4b02c1a22 100644 (file)
@@ -27,7 +27,7 @@ $dirname = "$file_path/lstat_stat_variation17";
 mkdir($dirname);
 
 $old_stat = stat($dirname);
-sleep(2);
+sleep(1);
 var_dump( chmod($dirname, 0777) );
 // clear the stat
 clearstatcache();
index 23ed53e566861afc1702cbe10b809c704b8f12db..df09bc7f98b93cd490bfe387ea1dbb703c225797 100644 (file)
@@ -33,7 +33,7 @@ echo "*** Testing stat() on file by truncating it to given size ***\n";
 $old_stat = stat($filename);
 // clear the cache
 clearstatcache();
-sleep(2);
+sleep(1);
 // opening file in r/w mode
 $file_handle = fopen($filename, "r+");
 var_dump( ftruncate($file_handle, 512) );  // truncate it
index fe8b61e5ca2fa423b65fa2c10c92f989666d5048..c72d7ffe4bdb2f27c70cc4d26dd3b0064ed149d0 100644 (file)
@@ -33,7 +33,7 @@ echo "*** Testing stat() for file after using touch() on the file ***\n";
 $old_stat = stat($file_name);
 // clear the cache
 clearstatcache();
-sleep(2);
+sleep(1);
 var_dump( touch($file_name) );
 $new_stat = stat($file_name);
 
index b5c03c3f08f87b2db14f08f40d7875638e7b7c74..668e79238d2ab36b0e4d8f533768b7c6c5b1320b 100644 (file)
@@ -33,7 +33,7 @@ echo "*** Testing stat() for directory after using touch() on the directory ***\
 $old_stat = stat($dir_name);
 // clear the cache
 clearstatcache();
-sleep(2);
+sleep(1);
 var_dump( touch($dir_name) );
 $new_stat = stat($dir_name);
 
index db7f87f7f7968e9280d7b12e4aaabf0fa8dfc659..9870a56c10a1ccf0c946739a64753a21ab6dd90e 100644 (file)
@@ -30,7 +30,7 @@ echo "*** Testing stat() on dir after subdir and file is created in it ***\n";
 $dirname = "$file_path/lstat_stat_variation8";
 $old_stat = stat($dirname);
 clearstatcache();
-sleep(2);
+sleep(1);
 mkdir("$dirname/lstat_stat_variation8_subdir");
 $file_handle = fopen("$dirname/lstat_stat_variation8a.tmp", "w");
 fclose($file_handle);
index 504e0f45eab16bca6e2231af90000bfb43bc4672..29f1514d769aa8010ab90b3046fe8f99fecba437 100644 (file)
@@ -26,7 +26,7 @@ mkdir($dirname);
 // stat of the dir created
 $dir_stat = stat($dirname);
 clearstatcache();
-sleep(2);
+sleep(1);
 
 // creating file
 $filename = "$dirname/stat_basic_私はガラスを食べられます.tmp";
@@ -34,7 +34,7 @@ $file_handle = fopen($filename, "w");
 fclose($file_handle);
 // stat of the file created
 $file_stat = stat($filename);
-sleep(2);
+sleep(1);
 
 // now new stat of the dir after file is created
 $new_dir_stat = stat($dirname);
index 348ac2d38095dbc7328139bb7664ac3e0ef49096..4df006468891414a49dc1c723673924720dc9499 100644 (file)
@@ -34,7 +34,7 @@ $file_handle = fopen($filename, "w");
 fclose($file_handle);
 // stat of the file created
 $file_stat = stat($filename);
-sleep(2);
+sleep(1);
 
 // now new stat of the dir after file is created
 $new_dir_stat = stat($dirname);
index 1db467632b046ed5b72887bb32a74bb3319a33be..002d5ac6502144e07e802f23dc0e7ea38e68b4f5 100644 (file)
@@ -35,7 +35,7 @@ $old_filename = "$file_path/stat_variation1_私はガラスを食べられます
 $new_filename = "$file_path/stat_variation1a_私はガラスを食べられます.tmp";
 $old_stat = stat($old_filename);
 clearstatcache();
-sleep(2);
+sleep(1);
 var_dump( rename($old_filename, $new_filename) );
 $new_stat = stat($new_filename);
 
index 26b1549e02a2d674c82649c79518b03e91561621..03d94b8898e2b868012ce6d32756c63931cb4c73 100644 (file)
@@ -35,7 +35,7 @@ $old_filename = "$file_path/stat_variation1.tmp";
 $new_filename = "$file_path/stat_variation1a.tmp";
 $old_stat = stat($old_filename);
 clearstatcache();
-sleep(2);
+sleep(1);
 var_dump( rename($old_filename, $new_filename) );
 $new_stat = stat($new_filename);
 
index 2d4f44bf02599012ffb214cb94c08e8248fcfb8d..66347ce2b541edad57d4a670008a581881709a02 100644 (file)
@@ -32,7 +32,7 @@ echo "*** Testing stat(): writing to a file ***\n";
 echo "-- Testing stat() on file after data is written in it --\n";
 $old_stat = stat($filename);
 clearstatcache();
-sleep(2);
+sleep(1);
 $file_handle = fopen($filename, "w");  // temp file
 fwrite($file_handle, "Hello World");
 fclose($file_handle);
index d08612fc7f0df87fb9938fac09cf200b9c7659a9..980fc56836db17ed299a5c75d1f6609a2ac99d71 100644 (file)
@@ -30,7 +30,7 @@ echo "-- Testing stat() on dir after subdir and file is created in it --\n";
 $dirname = "$file_path/stat_variation3";
 $old_stat = stat($dirname);
 clearstatcache();
-sleep(2);
+sleep(1);
 mkdir("$dirname/stat_variation3_subdir");
 $file_handle = fopen("$dirname/stat_variation3a.tmp", "w");
 fclose($file_handle);
index a5e25f99d03a4458a76663e70cc245dd59dc184b..9cae39a4980f28dbeef7ddba28d1b82ba7863a5c 100644 (file)
@@ -36,7 +36,7 @@ $old_dirname = "$file_path/stat_variation4";
 $old_stat = stat($old_dirname);
 // clear the cache
 clearstatcache();
-sleep(2);
+sleep(1);
 var_dump( is_dir($old_dirname) );
 $new_stat = stat($old_dirname);
 
index d2c9fd4c84225ea5dba0b1567c5f18d65111c562..47627671dbd45e6b0b71a865061fac83b57590b3 100644 (file)
@@ -32,7 +32,7 @@ fclose($file_handle);
 $old_stat = stat($filename);
 // clear the stat
 clearstatcache();
-sleep(2);
+sleep(1);
 // opening file again in read mode
 $file_handle = fopen($filename, "r");  // read file
 fclose($file_handle);
index 953d7df04581e419632f855e9173295d40d0d793..3dc7a4bac101ab587a84869bf1cc6b3213857da6 100644 (file)
@@ -32,11 +32,12 @@ fclose($file_handle);
 
 // checking stat() on file
 echo "\n*** Testing stat() on file with miscellaneous file permission and content ***\n";
+clearstatcache();
 $old_stat = stat($filename);
+sleep(1);
 var_dump( chmod($filename, 0777) );
 // clear the stat
 clearstatcache();
-sleep(2);
 $new_stat = stat($filename);
 // compare self stats
 var_dump( compare_self_stat($old_stat) );
@@ -50,10 +51,10 @@ clearstatcache();  // clear statement cache
 // checking stat() on directory
 echo "\n*** Testing stat() on directory with miscellaneous file permission ***\n";
 $old_stat = stat($dirname);
+sleep(1);
 var_dump( chmod($dirname, 0777) );
 // clear the stat
 clearstatcache();
-sleep(2);
 $new_stat = stat($dirname);
 // compare self stats
 var_dump( compare_self_stat($old_stat) );
index 7a0cf65d411d753d0fffb5a35644ee3a6193df6a..c86ba3206e14967943337c40a72b60efee33e192 100644 (file)
@@ -37,7 +37,7 @@ fclose($file_handle);
 clearstatcache(true, $filename);
 $old_stat = stat($filename);
 // clear the cache
-sleep(2);
+sleep(1);
 
 // opening file in r/w mode
 $file_handle = fopen($filename, "r+");