diff options
author | Matt Ficken <mattficken@php.net> | 2012-05-08 19:31:41 +0200 |
---|---|---|
committer | Anatoliy Belsky <ab@php.net> | 2012-05-08 19:31:41 +0200 |
commit | c12fdbde5fe1da3f5ddd3be70a807b46755ff118 (patch) | |
tree | eee56f51b435d2eaf5cb6dd75a251013124171aa | |
parent | 838b4b8ff7d78dfb0da99e0b17568558a85a1c2a (diff) | |
download | php-git-c12fdbde5fe1da3f5ddd3be70a807b46755ff118.tar.gz |
Fix bug 61746 Failing tests in ext/standard/tests/file/windows_links/*
Fixed that again for systems having their %SYSTEMROOT% not in
c:\windows
5 files changed, 42 insertions, 11 deletions
diff --git a/ext/standard/tests/file/windows_links/bug48746.phpt b/ext/standard/tests/file/windows_links/bug48746.phpt index a47b7cbf7a..55465aea86 100644 --- a/ext/standard/tests/file/windows_links/bug48746.phpt +++ b/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);
diff --git a/ext/standard/tests/file/windows_links/bug48746_1.phpt b/ext/standard/tests/file/windows_links/bug48746_1.phpt index 716c656349..5d8e685e1b 100644 --- a/ext/standard/tests/file/windows_links/bug48746_1.phpt +++ b/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)
diff --git a/ext/standard/tests/file/windows_links/bug48746_2.phpt b/ext/standard/tests/file/windows_links/bug48746_2.phpt index 637152cade..56924a59bc 100644 --- a/ext/standard/tests/file/windows_links/bug48746_2.phpt +++ b/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
-) +)
diff --git a/ext/standard/tests/file/windows_links/bug48746_3.phpt b/ext/standard/tests/file/windows_links/bug48746_3.phpt index a0dcbdc026..b88ab76ef3 100644 --- a/ext/standard/tests/file/windows_links/bug48746_3.phpt +++ b/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
-) +)
diff --git a/ext/standard/tests/file/windows_links/common.inc b/ext/standard/tests/file/windows_links/common.inc new file mode 100644 index 0000000000..2d4b47cd51 --- /dev/null +++ b/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"; +} + +?> |