Commit: d365e41e170c6e6084cc3933d9b76e57947c5bb1
Author: Matt Ficken <v-maf...@microsoft.com> Wed, 6 Feb 2013
12:55:45 -0800
Parents: 3ede9dc04797d9e5ffa7f4aae90498811f6f95c9
Branches: master
Link:
http://git.php.net/?p=pftt2.git;a=commitdiff;h=d365e41e170c6e6084cc3933d9b76e57947c5bb1
Log:
Windows VC11 support
Changed paths:
A bin/vc11_redist_x86.exe
M src/com/mostc/pftt/host/Host.java
M src/com/mostc/pftt/host/LocalHost.java
M src/com/mostc/pftt/main/PfttAgentMain.java
M src/com/mostc/pftt/main/PfttMain.java
M src/com/mostc/pftt/model/core/PhptSourceTestPack.java
M src/com/mostc/pftt/model/core/PhptTestCase.java
M src/com/mostc/pftt/model/sapi/AbstractManagedProcessesWebServerManager.java
M src/com/mostc/pftt/model/sapi/IISManager.java
M src/com/mostc/pftt/model/smoke/RequiredExtensionsSmokeTest.java
M src/com/mostc/pftt/results/PhpResultPackWriter.java
M src/com/mostc/pftt/runner/AbstractLocalTestPackRunner.java
M src/com/mostc/pftt/runner/AbstractPhptTestCaseRunner2.java
M src/com/mostc/pftt/runner/HttpPhptTestCaseRunner.java
M src/com/mostc/pftt/runner/LocalPhptTestPackRunner.java
M src/com/mostc/pftt/util/HostEnvUtil.java
diff --git a/bin/vc11_redist_x86.exe b/bin/vc11_redist_x86.exe
new file mode 100644
index 0000000..0fdfbdc
Binary files /dev/null and b/bin/vc11_redist_x86.exe differ
diff --git a/src/com/mostc/pftt/host/Host.java
b/src/com/mostc/pftt/host/Host.java
index ff97e30..7f7d821 100644
--- a/src/com/mostc/pftt/host/Host.java
+++ b/src/com/mostc/pftt/host/Host.java
@@ -50,7 +50,7 @@ public abstract class Host {
public String uniqueNameFromBase(String base) {
if (exists(base)) {
String name;
- for ( int i=1 ; ; i++ ) {
+ for ( int i=2 ; ; i++ ) {
name = base + "-" + i;
if (!exists(name))
return name;
diff --git a/src/com/mostc/pftt/host/LocalHost.java
b/src/com/mostc/pftt/host/LocalHost.java
index 8018548..b650bdc 100644
--- a/src/com/mostc/pftt/host/LocalHost.java
+++ b/src/com/mostc/pftt/host/LocalHost.java
@@ -251,7 +251,8 @@ public class LocalHost extends AHost {
}
}
if (cmd==null)
- cmd = "cmd /C copy \""+src+"\" \""+dst+"\"";
+ // /B => binary file copy
+ cmd = "cmd /C copy /B /Y \""+src+"\"
\""+dst+"\"";
exec(cmd, NO_TIMEOUT);
} else {
diff --git a/src/com/mostc/pftt/main/PfttAgentMain.java
b/src/com/mostc/pftt/main/PfttAgentMain.java
index 70b506e..64eb788 100644
--- a/src/com/mostc/pftt/main/PfttAgentMain.java
+++ b/src/com/mostc/pftt/main/PfttAgentMain.java
@@ -30,7 +30,7 @@ public class PfttAgentMain extends PSCAgentServer {
try {
// important: don't want to get WER popups on Windows
(user isn't there to close them)
- HostEnvUtil.prepareHostEnv(host, this, false);
+ HostEnvUtil.prepareHostEnv(host, this, build, false);
if (test_names.isEmpty()) {
// run all test cases in test-pack
diff --git a/src/com/mostc/pftt/main/PfttMain.java
b/src/com/mostc/pftt/main/PfttMain.java
index d584a6f..a402bc4 100644
--- a/src/com/mostc/pftt/main/PfttMain.java
+++ b/src/com/mostc/pftt/main/PfttMain.java
@@ -839,7 +839,7 @@ public class PfttMain {
cm.println(EPrintType.IN_PROGRESS, "Build",
build.toString());
cm.println(EPrintType.IN_PROGRESS, "Test-Pack",
test_pack.toString());
- HostEnvUtil.prepareHostEnv(rt.host, cm,
!cm.isDisableDebugPrompt());
+ HostEnvUtil.prepareHostEnv(rt.host, cm, build,
!cm.isDisableDebugPrompt());
cmd_phpt_named(rt, cm, config, build,
test_pack, names);
System.out.println("PFTT: finished");
@@ -878,7 +878,7 @@ public class PfttMain {
cm.println(EPrintType.IN_PROGRESS, "Build",
build.toString());
cm.println(EPrintType.IN_PROGRESS, "Test-Pack",
test_pack.toString());
- HostEnvUtil.prepareHostEnv(rt.host, cm,
!cm.isDisableDebugPrompt());
+ HostEnvUtil.prepareHostEnv(rt.host, cm, build,
!cm.isDisableDebugPrompt());
cmd_phpt_list(rt, cm, config, build, test_pack,
list_file);
System.out.println("PFTT: finished");
@@ -916,7 +916,7 @@ public class PfttMain {
checkUAC(is_uac, false, config, cm);
// run all tests
- HostEnvUtil.prepareHostEnv(rt.host, cm,
!cm.isDisableDebugPrompt());
+ HostEnvUtil.prepareHostEnv(rt.host, cm, build,
!cm.isDisableDebugPrompt());
cmd_phpt_all(rt, cm, config, build, test_pack);
System.out.println("PFTT: finished");
diff --git a/src/com/mostc/pftt/model/core/PhptSourceTestPack.java
b/src/com/mostc/pftt/model/core/PhptSourceTestPack.java
index 7e180d9..14c50a0 100644
--- a/src/com/mostc/pftt/model/core/PhptSourceTestPack.java
+++ b/src/com/mostc/pftt/model/core/PhptSourceTestPack.java
@@ -71,7 +71,7 @@ public class PhptSourceTestPack implements
SourceTestPack<PhptActiveTestPack, Ph
*/
@Override
public void cleanup(ConsoleManager cm) {
- cm.println(EPrintType.IN_PROGRESS, getClass(), "cleaning
source-test-pack from previous PFTT or run-test.php run");
+ /* TODO cm.println(EPrintType.IN_PROGRESS, getClass(),
"cleaning source-test-pack from previous PFTT or run-test.php run");
// these are symlinks(junctions) which may cause an infinite
loop
//
// normally, they are deleted, but if certain tests were
interrupted, they may still be there
@@ -85,7 +85,7 @@ public class PhptSourceTestPack implements
SourceTestPack<PhptActiveTestPack, Ph
host.deleteFileExtension(test_pack, ".skip.php");
host.deleteFileExtension(test_pack, ".cmd");
host.deleteFileExtension(test_pack, ".sh");
- host.deleteFileExtension(test_pack, ".php");
+ host.deleteFileExtension(test_pack, ".php");*/
}
public void read(List<PhptTestCase> test_cases, List<String> names,
ConsoleManager cm, PhpResultPackWriter twriter, PhpBuild build) throws
FileNotFoundException, IOException, Exception {
diff --git a/src/com/mostc/pftt/model/core/PhptTestCase.java
b/src/com/mostc/pftt/model/core/PhptTestCase.java
index 8bba68c..d377e6e 100644
--- a/src/com/mostc/pftt/model/core/PhptTestCase.java
+++ b/src/com/mostc/pftt/model/core/PhptTestCase.java
@@ -287,7 +287,7 @@ public class PhptTestCase extends TestCase {
public PhpIni getINI(PhptActiveTestPack active_test_pack, AHost host) {
PhpIni this_ini;
String this_ini_pwd;
- String ini_pwd =
active_test_pack.getStorageDirectory()+host.dirSeparator()+AHost.dirname(name);
+ String ini_pwd =
active_test_pack.getStorageDirectory()+"/"+AHost.dirname(name);
if (this.ini_pwd!=null) {
this_ini_pwd = this.ini_pwd.get();
if (this_ini_pwd != null &&
this_ini_pwd.equals(ini_pwd)) {
diff --git
a/src/com/mostc/pftt/model/sapi/AbstractManagedProcessesWebServerManager.java
b/src/com/mostc/pftt/model/sapi/AbstractManagedProcessesWebServerManager.java
index a74051e..68edaaa 100644
---
a/src/com/mostc/pftt/model/sapi/AbstractManagedProcessesWebServerManager.java
+++
b/src/com/mostc/pftt/model/sapi/AbstractManagedProcessesWebServerManager.java
@@ -52,7 +52,7 @@ public abstract class
AbstractManagedProcessesWebServerManager extends WebServer
}
@Override
- protected WebServerInstance createWebServerInstance(ConsoleManager cm,
AHost host, PhpBuild build, PhpIni ini, Map<String,String> env, final String
docroot, Object server_name) {
+ protected WebServerInstance createWebServerInstance(ConsoleManager cm,
AHost host, PhpBuild build, PhpIni ini, Map<String,String> env, final String
docroot, final Object server_name) {
String sapi_output = "";
int port_attempts;
boolean found_port;
@@ -138,11 +138,14 @@ public abstract class
AbstractManagedProcessesWebServerManager extends WebServer
public void run() {
if
(!handlef.isRunning()) {
try {
- if
(handlef.isCrashed())
+ if
(handlef.isCrashed()) {
+
if (handlef.getExitCode()!=1)
+
new IllegalStateException("server_name="+server_name+"
exit_code="+handlef.getExitCode()).printStackTrace(); // TODO
// notify of web server crash
//
// provide output and exit code
web.notifyCrash(handlef.getOutput(), handlef.getExitCode());
+ }
} finally {
//
don't need to check any more
cancel();
diff --git a/src/com/mostc/pftt/model/sapi/IISManager.java
b/src/com/mostc/pftt/model/sapi/IISManager.java
index 72b6301..2a81fd9 100644
--- a/src/com/mostc/pftt/model/sapi/IISManager.java
+++ b/src/com/mostc/pftt/model/sapi/IISManager.java
@@ -20,6 +20,7 @@ import com.mostc.pftt.util.ErrorUtil;
*
*/
+// XXX need process handle for each IIS process in order to tell for sure if
the process crashes
// this class only has to work on windows vista+
@ThreadSafe
public class IISManager extends WebServerManager {
diff --git a/src/com/mostc/pftt/model/smoke/RequiredExtensionsSmokeTest.java
b/src/com/mostc/pftt/model/smoke/RequiredExtensionsSmokeTest.java
index 9ea149f..0d36b64 100644
--- a/src/com/mostc/pftt/model/smoke/RequiredExtensionsSmokeTest.java
+++ b/src/com/mostc/pftt/model/smoke/RequiredExtensionsSmokeTest.java
@@ -117,8 +117,8 @@ public class RequiredExtensionsSmokeTest extends SmokeTest {
*/
public static PhpIni createDefaultIniCopy(Host host, PhpBuild build) {
PhpIni ini = new PhpIni();
- ini.putSingle("default_mimetype", "text/plain");
- ini.putSingle("date.timezone", "'UTC'"); // TODO ' matters?
+ // TODO ini.putSingle("default_mimetype", "text/plain");
+ // TODO ini.putSingle("date.timezone", "'UTC'"); // TODO '
matters?
ini.putMulti(PhpIni.OUTPUT_HANDLER, StringUtil.EMPTY);
ini.putMulti(PhpIni.OPEN_BASEDIR, StringUtil.EMPTY);
ini.putMulti(PhpIni.SAFE_MODE, 0);
diff --git a/src/com/mostc/pftt/results/PhpResultPackWriter.java
b/src/com/mostc/pftt/results/PhpResultPackWriter.java
index 9735d62..b7b494c 100644
--- a/src/com/mostc/pftt/results/PhpResultPackWriter.java
+++ b/src/com/mostc/pftt/results/PhpResultPackWriter.java
@@ -56,7 +56,7 @@ public class PhpResultPackWriter extends PhpResultPack
implements ITestResultRec
protected boolean run = true;
protected XmlSerializer serial;
- protected static File makeName(ConsoleManager cm, AHost host, File
base, PhpBuild build, ScenarioSet scenario_set, int i) throws Exception {
+ protected static File makeName(ConsoleManager cm, AHost host, File
base, PhpBuild build, ScenarioSet scenario_set) throws Exception {
StringBuilder sb = new StringBuilder();
sb.append("/");
sb.append(build.getVersionBranch(cm, host));
@@ -85,10 +85,6 @@ public class PhpResultPackWriter extends PhpResultPack
implements ITestResultRec
sb.append('-');
sb.append(scenario_set.getShortName());
- if (i>0) {
- sb.append("-");
- sb.append(i);
- }
return new File(base.getAbsolutePath() + sb);
}
@@ -110,7 +106,7 @@ public class PhpResultPackWriter extends PhpResultPack
implements ITestResultRec
this.scenario_set = scenario_set;
this.build = build;
this.test_pack = test_pack;
- this.telem_dir = new File(host.uniqueNameFromBase(makeName(cm,
host, telem_base_dir, build, scenario_set, 0).getAbsolutePath()));
+ this.telem_dir = new File(host.uniqueNameFromBase(makeName(cm,
host, telem_base_dir, build, scenario_set).getAbsolutePath()));
this.telem_dir.mkdirs();
results = new LinkedBlockingQueue<ResultQueueEntry>();
@@ -379,7 +375,7 @@ public class PhpResultPackWriter extends PhpResultPack
implements ITestResultRec
//
- if (store_all || !cm.isNoResultFileForPassSkipXSkip()) {
+ if (false) { // TODO store_all ||
!cm.isNoResultFileForPassSkipXSkip()) {
// may want to skip storing result files for PASS, SKIP
or XSKIP tests
try {
File result_file = new File(this_telem_dir,
test_case_base_name+".xml");
diff --git a/src/com/mostc/pftt/runner/AbstractLocalTestPackRunner.java
b/src/com/mostc/pftt/runner/AbstractLocalTestPackRunner.java
index b2db009..ff18c41 100644
--- a/src/com/mostc/pftt/runner/AbstractLocalTestPackRunner.java
+++ b/src/com/mostc/pftt/runner/AbstractLocalTestPackRunner.java
@@ -81,13 +81,13 @@ public abstract class AbstractLocalTestPackRunner<A extends
ActiveTestPack, S ex
runner_state = new AtomicReference<ETestPackRunnerState>();
storage_host = new LocalHost();
-
+ /*
SSHHost remote_host = new SSHHost("10.200.50.135",
"administrator", "password01!");
this.storage_host = remote_host; // for
LocalPhptTestPackRunner#setupStorageDir
// TODO
- file_scenario = new SMBDeduplicationScenario(remote_host,
"F:"); // TODO "B:");
- //file_scenario = new SMBDFSScenario(remote_host);
-
+ //file_scenario = new SMBDeduplicationScenario(remote_host,
"B:");
+ file_scenario = new SMBDFSScenario(remote_host);
+ */
}
public void runTestList(S test_pack, List<T> test_cases) throws
Exception {
@@ -282,7 +282,18 @@ public abstract class AbstractLocalTestPackRunner<A
extends ActiveTestPack, S ex
// -exceed this number and there will be threads that
won't have any tests to run
// 3. limit to MAX_THREAD_COUNT
// 4. if debugging
- int thread_count =
sapi_scenario.getTestThreadCount(runner_host);
+ // TODO temp 2*
+ /*<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
+ <html>
+ <head>
+ <title></title>
+ </head>
+ <body>
+
+ </body>
+ </html>
+*/
+ int thread_count = 2 *
sapi_scenario.getTestThreadCount(runner_host);
if (thread_count > thread_safe_test_count +
non_thread_safe_exts.size())
thread_count = thread_safe_test_count +
non_thread_safe_exts.size();
if (thread_count > MAX_THREAD_COUNT)
@@ -422,14 +433,14 @@ public abstract class AbstractLocalTestPackRunner<A
extends ActiveTestPack, S ex
}
}
- // TODO for ( int i=0 ; i <
run_test_times ; i++ ) {
+ for ( int i=0 ; i < run_test_times ;
i++ ) {
// CRITICAL: catch exception to
record with test
try {
runTest(group_key,
test_case);
} catch ( Throwable ex ) {
twriter.addTestException(storage_host, scenario_set, test_case, ex, sa);
}
- //}
+ }
test_count.incrementAndGet();
Thread.yield();
diff --git a/src/com/mostc/pftt/runner/AbstractPhptTestCaseRunner2.java
b/src/com/mostc/pftt/runner/AbstractPhptTestCaseRunner2.java
index 111c652..cc1162f 100644
--- a/src/com/mostc/pftt/runner/AbstractPhptTestCaseRunner2.java
+++ b/src/com/mostc/pftt/runner/AbstractPhptTestCaseRunner2.java
@@ -157,33 +157,9 @@ public abstract class AbstractPhptTestCaseRunner2 extends
AbstractPhptTestCaseRu
protected boolean evalSkipIf(String output) throws IOException {
String lc_output = output.toLowerCase();
//
- // find 'skip ' or 'skip...' or 'skip' but ignore '404 error,
file not found abc.skip.php'
- int skip_idx = -1, next;
- char nextc;
- boolean skip = false;
- main_loop:
- for (int i=0;i<32;i++) {
- skip_idx = lc_output.indexOf("skip", skip_idx+1);
- if (skip_idx==-1)
- break main_loop;
- next = skip_idx+"skip".length()+1;
- period_loop:
- for (;;) {
- if (next>lc_output.length()) {
- skip = true;
- break main_loop;
- }
- nextc = lc_output.charAt(next);
- if (nextc!='.')
- break period_loop;
- next++;
- }
- if (Character.isWhitespace(nextc)) {
- skip = true;
- break main_loop;
- }
- } // end for
- if (skip) {
+ // find 'skip ' or 'skip...' or 'skip.. ' or 'skip' but ignore
'404 error, file not found abc.skip.php'
+ // (don't need to check for multiple occurences of 'skip',
just one... finding abc.skip.php would be a TEST_EXCEPTION or FAIL anyway)
+ if (lc_output.contains("skip") && ( !( this instanceof
HttpPhptTestCaseRunner ) || !lc_output.contains("404")) ) {
// test is to be skipped
// decide to mark test SKIP or XSKIP (could test be
executed on this OS?)
@@ -227,6 +203,7 @@ public abstract class AbstractPhptTestCaseRunner2 extends
AbstractPhptTestCaseRu
AHost.dirname(test_case.getName()),
test_case.getTrim(EPhptSection.FILE_EXTERNAL).replaceAll("\\.\\.", "")
);
+ System.out.println("copy test="+test_case+"
src="+src_file+" dst="+test_file);
host.copy(src_file, test_file);
} else {
diff --git a/src/com/mostc/pftt/runner/HttpPhptTestCaseRunner.java
b/src/com/mostc/pftt/runner/HttpPhptTestCaseRunner.java
index 25092cc..43e83e3 100644
--- a/src/com/mostc/pftt/runner/HttpPhptTestCaseRunner.java
+++ b/src/com/mostc/pftt/runner/HttpPhptTestCaseRunner.java
@@ -281,12 +281,21 @@ public class HttpPhptTestCaseRunner extends
AbstractPhptTestCaseRunner2 {
protected String do_http_execute(String path, EPhptSection section,
boolean is_replacement) throws Exception {
path = AHost.toUnixPath(path);
+ if
(path.startsWith(AHost.toUnixPath(active_test_pack.getRunningDirectory())))
+ // important: convert to path web server is serving up
+ path =
path.substring(active_test_pack.getRunningDirectory().length());
if
(path.startsWith(AHost.toUnixPath(active_test_pack.getStorageDirectory())))
// important: convert to path web server is serving up
path =
path.substring(active_test_pack.getStorageDirectory().length());
if (!path.startsWith("/"))
path = "/" + path;
-
+ if (test_case.getName().contains("phar")) {
+ if (!path.startsWith("/ext/phar/")) {// TODO tests/")
&& !path.startsWith("/ext/phar//tests/") &&
!path.startsWith("/ext/phar/tests//") &&
!path.startsWith("/ext/phar//tests//")) {
+ if (!path.startsWith("/tests/"))
+ path = "/tests/" + path;
+ path = "/ext/phar/"+path; // TODO
+ }
+ }
try {
if (web!=null) {
synchronized(web) {
diff --git a/src/com/mostc/pftt/runner/LocalPhptTestPackRunner.java
b/src/com/mostc/pftt/runner/LocalPhptTestPackRunner.java
index 9b16953..e28a8de 100644
--- a/src/com/mostc/pftt/runner/LocalPhptTestPackRunner.java
+++ b/src/com/mostc/pftt/runner/LocalPhptTestPackRunner.java
@@ -43,8 +43,9 @@ public class LocalPhptTestPackRunner extends
AbstractLocalTestPackRunner<PhptAct
long millis = System.currentTimeMillis();
for ( int i=0 ; i < 131070 ; i++ ) {
// try to include version, branch info etc...
from name of test-pack
- local_test_pack_dir = local_path + "/PFTT-" +
AHost.basename(src_test_pack.getSourceDirectory()) + (i==0?"":"-" + millis);
- remote_test_pack_dir = remote_path + "/PFTT-" +
AHost.basename(src_test_pack.getSourceDirectory()) + (i==0?"":"-" + millis);
+ // CRITICAL: that directory paths end with /
(@see {PWD} in PhpIni)
+ local_test_pack_dir = local_path + "/PFTT-" +
AHost.basename(src_test_pack.getSourceDirectory()) + (i==0?"":"-" + millis) +
"/";
+ remote_test_pack_dir = remote_path + "/PFTT-" +
AHost.basename(src_test_pack.getSourceDirectory()) + (i==0?"":"-" + millis) +
"/";
if (!storage_host.exists(remote_test_pack_dir)
|| !runner_host.exists(local_test_pack_dir))
break;
millis++;
diff --git a/src/com/mostc/pftt/util/HostEnvUtil.java
b/src/com/mostc/pftt/util/HostEnvUtil.java
index 1e5b14f..2ee87a7 100644
--- a/src/com/mostc/pftt/util/HostEnvUtil.java
+++ b/src/com/mostc/pftt/util/HostEnvUtil.java
@@ -1,9 +1,13 @@
package com.mostc.pftt.util;
+import java.io.IOException;
+
import com.github.mattficken.io.StringUtil;
import com.mostc.pftt.host.ExecOutput;
import com.mostc.pftt.host.AHost;
import com.mostc.pftt.host.LocalHost;
+import com.mostc.pftt.model.core.EBuildBranch;
+import com.mostc.pftt.model.core.PhpBuild;
import com.mostc.pftt.results.ConsoleManager;
import com.mostc.pftt.results.ConsoleManager.EPrintType;
@@ -15,9 +19,9 @@ import com.mostc.pftt.results.ConsoleManager.EPrintType;
public final class HostEnvUtil {
- public static void prepareHostEnv(AHost host, ConsoleManager cm,
boolean enable_debug_prompt) throws Exception {
+ public static void prepareHostEnv(AHost host, ConsoleManager cm,
PhpBuild build, boolean enable_debug_prompt) throws Exception {
if (host.isWindows()) {
- prepareWindows(host, cm, enable_debug_prompt);
+ prepareWindows(host, cm, build, enable_debug_prompt);
} else {
// emerge dev-vcs/subversion
}
@@ -30,16 +34,17 @@ public final class HostEnvUtil {
* should be false. Windows Error Reporting popups will interfere
with automated testing
* -disables firewall, for network services like SOAP, HTTP, etc...
* -creates a php-sdk share pointing to %SYSTEMDRIVE%\\php-sdk
- * -installs VC9 runtime if its not Windows 7/2008r2 or Windows 8/2012
(which don't need it to run PHP)
+ * -installs VC runtime
*
* If enable_debug_prompt and if WinDebug is installed, enables it for
debugging PHP.
*
* @param host
* @param cm
+ * @param build
* @param enable_debug_prompt
* @throws Exception
*/
- public static void prepareWindows(AHost host, ConsoleManager cm,
boolean enable_debug_prompt) throws Exception {
+ public static void prepareWindows(AHost host, ConsoleManager cm,
PhpBuild build, boolean enable_debug_prompt) throws Exception {
cm.println(EPrintType.IN_PROGRESS, HostEnvUtil.class,
"preparing Windows host to run PHP...");
// have to fix Windows Error Reporting from popping up and
blocking execution:
@@ -87,28 +92,76 @@ public final class HostEnvUtil {
host.execElevated(cm, HostEnvUtil.class, "NET SHARE
PHP_SDK="+host.getPhpSdkDir()+" /Grant:"+host.getUsername()+",Full",
AHost.ONE_MINUTE);
}
- if (host.isVistaOrBefore()) {
- // install VC9 runtime (win7+ don't need this)
- if
(host.dirContainsFragment(host.getSystemRoot()+"\\WinSxS", "vc9")) {
- cm.println(EPrintType.CLUE, HostEnvUtil.class,
"VC9 Runtime alread installed");
- } else {
- String local_file =
LocalHost.getLocalPfttDir()+"/bin/vc9_vcredist_x86.exe";
- String remote_file = null;
- if (host.isRemote()) {
- remote_file =
host.mktempname(HostEnvUtil.class, ".exe");
-
- cm.println(EPrintType.IN_PROGRESS,
HostEnvUtil.class, "Uploading VC9 Runtime");
- host.upload(local_file, remote_file);
- }
- cm.println(EPrintType.IN_PROGRESS,
HostEnvUtil.class, "Installing VC9 Runtime");
- host.execElevated(cm, HostEnvUtil.class,
remote_file+" /Q", AHost.FOUR_HOURS);
- if (remote_file!=null)
- host.delete(remote_file);
- }
- }
+ installVCRuntime(host, cm, build);
cm.println(EPrintType.COMPLETED_OPERATION, HostEnvUtil.class,
"Windows host prepared to run PHP.");
} // end public static void prepareWindows
+ /** PHP on Windows requires Microsoft's VC Runtime to be installed.
This method ensures that the correct version is installed.
+ *
+ * PHP 5.3 and 5.4 require the VC9 x86 Runtime
+ * PHP 5.5+ require the VC11 x86 Runtime
+ *
+ * Windows 7+ already has the VC9 x86 Runtime
+ * Windows 8+ already has the VC11 x86 Runtime
+ *
+ * @param host
+ * @param cm
+ * @throws Exception
+ * @throws IOException
+ * @throws IllegalStateException
+ */
+ public static void installVCRuntime(AHost host, ConsoleManager cm,
PhpBuild build) throws IllegalStateException, IOException, Exception {
+ if (host.isWindows()) {
+ return;
+ }
+
+ switch (build.getVersionBranch(cm, host)) {
+ case PHP_5_3:
+ case PHP_5_4:
+ if (host.isVistaOrBefore()) {
+ // install VC9 runtime (win7+ don't need this)
+ if
(host.dirContainsFragment(host.getSystemRoot()+"\\WinSxS", "vc9")) {
+ cm.println(EPrintType.CLUE,
HostEnvUtil.class, "VC9 Runtime alread installed");
+ } else {
+ String local_file =
LocalHost.getLocalPfttDir()+"/bin/vc9_vcredist_x86.exe";
+ String remote_file = null;
+ if (host.isRemote()) {
+ remote_file =
host.mktempname(HostEnvUtil.class, ".exe");
+
+
cm.println(EPrintType.IN_PROGRESS, HostEnvUtil.class, "Uploading VC9 Runtime");
+ host.upload(local_file,
remote_file);
+ }
+ cm.println(EPrintType.IN_PROGRESS,
HostEnvUtil.class, "Installing VC9 Runtime");
+ host.execElevated(cm,
HostEnvUtil.class, remote_file+" /Q", AHost.FOUR_HOURS);
+ if (remote_file!=null)
+ host.delete(remote_file);
+ }
+ }
+ break;
+ default:
+ // PHP_5_5+ and master
+ if (!host.isWin8OrLater()) {
+ if
(host.dirContainsFragment(host.getSystemRoot()+"\\WinSxS", "vc11")) {
+ cm.println(EPrintType.CLUE,
HostEnvUtil.class, "VC11 Runtime alread installed");
+ } else {
+ String local_file =
LocalHost.getLocalPfttDir()+"/bin/vc11_vcredist_x86.exe";
+ String remote_file = null;
+ if (host.isRemote()) {
+ remote_file =
host.mktempname(HostEnvUtil.class, ".exe");
+
+
cm.println(EPrintType.IN_PROGRESS, HostEnvUtil.class, "Uploading VC11 Runtime");
+ host.upload(local_file,
remote_file);
+ }
+ cm.println(EPrintType.IN_PROGRESS,
HostEnvUtil.class, "Installing VC11 Runtime");
+ host.execElevated(cm,
HostEnvUtil.class, remote_file+" /Q", AHost.FOUR_HOURS);
+ if (remote_file!=null)
+ host.delete(remote_file);
+ }
+ }
+ break;
+ } // end switch
+ } // end public static void installVCRuntime
+
public static final String REG_DWORD = "REG_DWORD";
/** checks if a registry key matches the given value. if it does,
returns true.
*
--
PHP Quality Assurance Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php