]> granicus.if.org Git - php/commitdiff
Fix bug 61746 Failing tests in ext/standard/tests/file/windows_links/*
authorMatt Ficken <mattficken@php.net>
Tue, 8 May 2012 17:31:41 +0000 (19:31 +0200)
committerAnatoliy Belsky <ab@php.net>
Tue, 8 May 2012 17:31:41 +0000 (19:31 +0200)
Fixed that again for systems having their %SYSTEMROOT% not in
c:\windows

ext/standard/tests/file/windows_links/bug48746.phpt
ext/standard/tests/file/windows_links/bug48746_1.phpt
ext/standard/tests/file/windows_links/bug48746_2.phpt
ext/standard/tests/file/windows_links/bug48746_3.phpt
ext/standard/tests/file/windows_links/common.inc [new file with mode: 0644]

index a47b7cbf7aa8c130e82dda8fb9bf3e7ff0e9b633..55465aea8615b9d3eeff81da5bdee97f8cd89684 100644 (file)
@@ -9,7 +9,8 @@ Venkat Raman Don (don.raman@microsoft.com)
 if(substr(PHP_OS, 0, 3) != 'WIN' ) {\r
     die('skip windows only test');\r
 }\r
-$cmd = "mklink.exe /?";\r
+include_once __DIR__ . '/common.inc';\r
+$cmd = "mklink /?";\r
 $ret = @exec($cmd, $output, $return_val);\r
 if (count($output) == 0) {\r
     die("mklink.exe not found in PATH");\r
@@ -17,7 +18,8 @@ if (count($output) == 0) {
 ?>\r
 --FILE--\r
 <?php\r
-$mountvol = "c:\\Windows\\System32\\mountvol.exe";\r
+include_once __DIR__ . '/common.inc';\r
+$mountvol = get_mountvol();\r
 $old_dir = __DIR__;\r
 $dirname = __DIR__ . "\\mnt\\test\\directory";\r
 mkdir($dirname, 0700, true);\r
index 716c65634931de81ff1e2d95ad364fd921390d6e..5d8e685e1b8302a1ccaf0ed78b80dd5db3b1f43e 100644 (file)
@@ -9,7 +9,8 @@ Venkat Raman Don (don.raman@microsoft.com)
 if(substr(PHP_OS, 0, 3) != 'WIN' ) {\r
     die('skip windows only test');\r
 }\r
-$cmd = "mklink.exe /?";\r
+include_once __DIR__ . '/common.inc';\r
+$cmd = "mklink /?";\r
 $ret = @exec($cmd, $output, $return_val);\r
 if (count($output) == 0) {\r
     die("mklink.exe not found in PATH");\r
@@ -17,7 +18,8 @@ if (count($output) == 0) {
 ?>\r
 --FILE--\r
 <?php\r
-$mountvol = "c:\\Windows\\System32\\mountvol.exe";
+include_once __DIR__ . '/common.inc';\r
+$mountvol = get_mountvol();\r
 $old_dir = __DIR__;\r
 $dirname = __DIR__ . "\\mnt\\test\\directory";\r
 exec("mkdir " . $dirname, $output, $ret_val);\r
@@ -54,4 +56,4 @@ I am included.
 I am included.\r
 bool(true)\r
 bool(true)\r
-bool(true)
+bool(true)\r
index 637152cade98c09d5b7daa7744e2b80fd3f131e4..56924a59bc46e98783136e3d59a339dd35e5b81e 100644 (file)
@@ -9,15 +9,17 @@ Venkat Raman Don (don.raman@microsoft.com)
 if(substr(PHP_OS, 0, 3) != 'WIN' ) {\r
     die('skip windows only test');\r
 }\r
+include_once __DIR__ . '/common.inc';\r
 $ret = exec('mklink bug48746_tmp.lnk ' . __FILE__ .' 2>&1', $out);\r
 if (strpos($ret, 'privilege')) {\r
        die('skip. SeCreateSymbolicLinkPrivilege not enable for this user.');\r
 }\r
-unlink('mklink bug48746_tmp.lnk');\r
+unlink('bug48746_tmp.lnk');\r
 ?>\r
 --FILE--\r
 <?php\r
-$mountvol = "c:\\Windows\\System32\\mountvol.exe";
+include_once __DIR__ . '/common.inc';\r
+$mountvol = get_mountvol();\r
 $old_dir = __DIR__;\r
 $dirname = __DIR__ . "\\mnt\\test\\directory";\r
 exec("mkdir " . $dirname, $output, $ret_val);\r
@@ -64,4 +66,4 @@ Array
     [1] => ..\r
     [2] => a.php\r
     [3] => b.php\r
-)
+)\r
index a0dcbdc0265a39f44bd9ac5ba672859247614091..b88ab76ef3d9aa0c79625da2eec33c9073ab1e1e 100644 (file)
@@ -9,7 +9,8 @@ Venkat Raman Don (don.raman@microsoft.com)
 if(substr(PHP_OS, 0, 3) != 'WIN' ) {\r
        die('skip windows only test');\r
 }\r
-$ret = exec('junction /? 2>&1', $out);\r
+include_once __DIR__ . '/common.inc';\r
+$ret = exec(get_junction().' /? 2>&1', $out);\r
 if (strpos($out[0], 'recognized')) {\r
        die('skip. junction.exe not found in PATH.');\r
 }\r
@@ -17,11 +18,12 @@ if (strpos($out[0], 'recognized')) {
 ?>\r
 --FILE--\r
 <?php\r
+include_once __DIR__ . '/common.inc';\r
 $old_dir = __DIR__;\r
 $dirname = __DIR__ . "\\mnt\\test\\directory";\r
 exec("mkdir " . $dirname, $output, $ret_val);\r
 chdir(__DIR__ . "\\mnt\\test");\r
-exec("junction junction directory", $output, $ret_val);\r
+exec(get_junction()." junction directory", $output, $ret_val);\r
 file_put_contents("junction\\a.php", "<?php echo \"I am included.\n\" ?>");\r
 file_put_contents("junction\\b.php", "<?php echo \"I am included.\n\" ?>");\r
 include "junction/a.php";\r
@@ -45,4 +47,4 @@ Array
     [1] => ..\r
     [2] => a.php\r
     [3] => b.php\r
-)
+)\r
diff --git a/ext/standard/tests/file/windows_links/common.inc b/ext/standard/tests/file/windows_links/common.inc
new file mode 100644 (file)
index 0000000..2d4b47c
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+
+function get_sysroot() {
+       // usually c:\\windows, but not always
+       return exec('echo %SYSTEMROOT%');
+}
+
+function get_junction(){
+       // junction.exe isn't included with Windows
+       // its a sysinternals tool for working with filesystem links
+       // see: http://technet.microsoft.com/en-us/sysinternals/bb896768
+       
+       // install somewhere that is on %path% or added to %path%
+       return "junction.exe";
+}
+
+function get_mountvol() {
+       $sysroot = get_sysroot();
+
+       return "$sysroot\\System32\\mountvol.exe";
+}
+
+?>