Commit:    c12fdbde5fe1da3f5ddd3be70a807b46755ff118
Author:    Matt Ficken <mattfic...@php.net>         Tue, 8 May 2012 19:31:41 
+0200
Committer: Anatoliy Belsky <a...@php.net>      Tue, 8 May 2012 19:31:41 +0200
Parents:   838b4b8ff7d78dfb0da99e0b17568558a85a1c2a
Branches:  PHP-5.3 PHP-5.4 master

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=c12fdbde5fe1da3f5ddd3be70a807b46755ff118

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

Fixed that again for systems having their %SYSTEMROOT% not in
c:\windows

Bugs:
https://bugs.php.net/61746

Changed paths:
  M  ext/standard/tests/file/windows_links/bug48746.phpt
  M  ext/standard/tests/file/windows_links/bug48746_1.phpt
  M  ext/standard/tests/file/windows_links/bug48746_2.phpt
  M  ext/standard/tests/file/windows_links/bug48746_3.phpt
  A  ext/standard/tests/file/windows_links/common.inc


Diff:
diff --git a/ext/standard/tests/file/windows_links/bug48746.phpt 
b/ext/standard/tests/file/windows_links/bug48746.phpt
index a47b7cb..55465ae 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.ra...@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 716c656..5d8e685 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.ra...@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 637152c..56924a5 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.ra...@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 a0dcbdc..b88ab76 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.ra...@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 0000000..2d4b47c
--- /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";
+}
+
+?>


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to