Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix bug 61746 Failing tests in ext/standard/tests/file/windows_links/*

Fixed that again for systems having their %SYSTEMROOT% not in
c:\windows
  • Loading branch information...
commit c12fdbde5fe1da3f5ddd3be70a807b46755ff118 1 parent 838b4b8
Matt Ficken authored weltling committed
View
6 ext/standard/tests/file/windows_links/bug48746.phpt
@@ -9,7 +9,8 @@ Venkat Raman Don (don.raman@microsoft.com)
if(substr(PHP_OS, 0, 3) != 'WIN' ) {
die('skip windows only test');
}
-$cmd = "mklink.exe /?";
+include_once __DIR__ . '/common.inc';
+$cmd = "mklink /?";
$ret = @exec($cmd, $output, $return_val);
if (count($output) == 0) {
die("mklink.exe not found in PATH");
@@ -17,7 +18,8 @@ if (count($output) == 0) {
?>
--FILE--
<?php
-$mountvol = "c:\\Windows\\System32\\mountvol.exe";
+include_once __DIR__ . '/common.inc';
+$mountvol = get_mountvol();
$old_dir = __DIR__;
$dirname = __DIR__ . "\\mnt\\test\\directory";
mkdir($dirname, 0700, true);
View
8 ext/standard/tests/file/windows_links/bug48746_1.phpt
@@ -9,7 +9,8 @@ Venkat Raman Don (don.raman@microsoft.com)
if(substr(PHP_OS, 0, 3) != 'WIN' ) {
die('skip windows only test');
}
-$cmd = "mklink.exe /?";
+include_once __DIR__ . '/common.inc';
+$cmd = "mklink /?";
$ret = @exec($cmd, $output, $return_val);
if (count($output) == 0) {
die("mklink.exe not found in PATH");
@@ -17,7 +18,8 @@ if (count($output) == 0) {
?>
--FILE--
<?php
-$mountvol = "c:\\Windows\\System32\\mountvol.exe";
+include_once __DIR__ . '/common.inc';
+$mountvol = get_mountvol();
$old_dir = __DIR__;
$dirname = __DIR__ . "\\mnt\\test\\directory";
exec("mkdir " . $dirname, $output, $ret_val);
@@ -54,4 +56,4 @@ I am included.
I am included.
bool(true)
bool(true)
-bool(true)
+bool(true)
View
8 ext/standard/tests/file/windows_links/bug48746_2.phpt
@@ -9,15 +9,17 @@ Venkat Raman Don (don.raman@microsoft.com)
if(substr(PHP_OS, 0, 3) != 'WIN' ) {
die('skip windows only test');
}
+include_once __DIR__ . '/common.inc';
$ret = exec('mklink bug48746_tmp.lnk ' . __FILE__ .' 2>&1', $out);
if (strpos($ret, 'privilege')) {
die('skip. SeCreateSymbolicLinkPrivilege not enable for this user.');
}
-unlink('mklink bug48746_tmp.lnk');
+unlink('bug48746_tmp.lnk');
?>
--FILE--
<?php
-$mountvol = "c:\\Windows\\System32\\mountvol.exe";
+include_once __DIR__ . '/common.inc';
+$mountvol = get_mountvol();
$old_dir = __DIR__;
$dirname = __DIR__ . "\\mnt\\test\\directory";
exec("mkdir " . $dirname, $output, $ret_val);
@@ -64,4 +66,4 @@ Array
[1] => ..
[2] => a.php
[3] => b.php
-)
+)
View
8 ext/standard/tests/file/windows_links/bug48746_3.phpt
@@ -9,7 +9,8 @@ Venkat Raman Don (don.raman@microsoft.com)
if(substr(PHP_OS, 0, 3) != 'WIN' ) {
die('skip windows only test');
}
-$ret = exec('junction /? 2>&1', $out);
+include_once __DIR__ . '/common.inc';
+$ret = exec(get_junction().' /? 2>&1', $out);
if (strpos($out[0], 'recognized')) {
die('skip. junction.exe not found in PATH.');
}
@@ -17,11 +18,12 @@ if (strpos($out[0], 'recognized')) {
?>
--FILE--
<?php
+include_once __DIR__ . '/common.inc';
$old_dir = __DIR__;
$dirname = __DIR__ . "\\mnt\\test\\directory";
exec("mkdir " . $dirname, $output, $ret_val);
chdir(__DIR__ . "\\mnt\\test");
-exec("junction junction directory", $output, $ret_val);
+exec(get_junction()." junction directory", $output, $ret_val);
file_put_contents("junction\\a.php", "<?php echo \"I am included.\n\" ?>");
file_put_contents("junction\\b.php", "<?php echo \"I am included.\n\" ?>");
include "junction/a.php";
@@ -45,4 +47,4 @@ Array
[1] => ..
[2] => a.php
[3] => b.php
-)
+)
View
23 ext/standard/tests/file/windows_links/common.inc
@@ -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";
+}
+
+?>
Please sign in to comment.
Something went wrong with that request. Please try again.