Commit: 24b8c66d6b5659b614e21304f422c6ad655e856f Author: Matt Ficken <v-maf...@microsoft.com> Fri, 22 Feb 2013 01:10:48 -0800 Parents: 4ea11aba63bf6bb1f086611ebca46369fb88ac93 Branches: master
Link: http://git.php.net/?p=pftt2.git;a=commitdiff;h=24b8c66d6b5659b614e21304f422c6ad655e856f Log: improved o+ scenario Former-commit-id: 93bb2d7d8f7c02ef9b172a91a22762d9e3a49833 Changed paths: M src/com/mostc/pftt/host/AHost.java M src/com/mostc/pftt/host/ExecOutput.java M src/com/mostc/pftt/model/app/PhpUnitSourceTestPack.java M src/com/mostc/pftt/model/sapi/AbstractManagedProcessesWebServerManager.java M src/com/mostc/pftt/model/sapi/ApacheManager.java M src/com/mostc/pftt/model/sapi/CrashedWebServerInstance.java M src/com/mostc/pftt/model/sapi/SAPIInstance.java M src/com/mostc/pftt/model/sapi/SharedSAPIInstanceTestCaseGroupKey.java M src/com/mostc/pftt/model/sapi/WebServerInstance.java M src/com/mostc/pftt/model/sapi/WebServerManager.java M src/com/mostc/pftt/runner/AbstractLocalTestPackRunner.java M src/com/mostc/pftt/runner/AbstractPhptTestCaseRunner.java M src/com/mostc/pftt/runner/CliPhptTestCaseRunner.java M src/com/mostc/pftt/runner/HttpPhpUnitTestCaseRunner.java M src/com/mostc/pftt/runner/HttpPhptTestCaseRunner.java M src/com/mostc/pftt/runner/LocalPhpUnitTestPackRunner.java M src/com/mostc/pftt/scenario/AbstractINIScenario.java M src/com/mostc/pftt/scenario/AbstractWebServerScenario.java M src/com/mostc/pftt/scenario/CLIScenario.java M src/com/mostc/pftt/scenario/OptimizerPlusScenario.java
diff --git a/src/com/mostc/pftt/host/AHost.java b/src/com/mostc/pftt/host/AHost.java index 274954c..4650c88 100644 --- a/src/com/mostc/pftt/host/AHost.java +++ b/src/com/mostc/pftt/host/AHost.java @@ -355,8 +355,28 @@ public abstract class AHost extends Host { close(false); } public abstract boolean isRunning(); + /** returns if process crashed. + * + * if debugger was attached to process and debugger closed, then + * process did not crash. + * + * @return + */ public boolean isCrashed() { - return isCrashExitCode(AHost.this, getExitCode()); + return isCrashExitCode(AHost.this, getExitCode(), false); + } + /** returns if process crashed or if debugger was attached and then closed. + * + * @see #isCrashed - normally you'll check this. + * + * both #isCrashed and #isCrashedOrDebuggedAndClosed exist to ignore or detect the special case + * (where a debugger was attached to a process and then closed, which may cause the process to return + * a special non-zero exit code). + * + * @return + */ + public boolean isCrashedOrDebuggedAndClosed() { + return isCrashExitCode(AHost.this, getExitCode(), true); } /** immediately returns the output the process has returned (if process is still running, it may * return more output after this call) @@ -378,17 +398,26 @@ public abstract class AHost extends Host { public abstract int getExitCode(); } // end public abstract class ExecHandle - public static boolean isCrashExitCode(AHost host, int e) { + /** checks exit code to see if it means process crashed + * + * @param host + * @param exit_code + * @param debugger_closed_is_crashed - if true and if exit code indicates a debugger was attached + * and then closed, then this returns true... otherwise, this will return false in this special case. + * @return + */ + public static boolean isCrashExitCode(AHost host, int exit_code, boolean debugger_closed_is_crashed) { if (host.isWindows()) { // no strict standard other than 0 is success // it may be an NTStatus(ntstatus.h) or possibly a WinError(winerror.h) or it could be something else - switch(e) { + switch(exit_code) { case 0: // exited normally case 1: // closed (~sigterm~) return false; case NTStatus.STATUS_DEBUGGER_INACTIVE: // 0xC0000354 - // windebug released (not crashed) + // released by windebug + return debugger_closed_is_crashed; case NTStatus.STATUS_SYSTEM_SHUTDOWN: case NTStatus.STATUS_SHUTDOWN_IN_PROGRESS: case NTStatus.STATUS_SERVER_SHUTDOWN_IN_PROGRESS: @@ -403,9 +432,27 @@ public abstract class AHost extends Host { } } // end if - return e != 0; + return exit_code != 0; } // end public static boolean isCrashExitCode + /** guesses a status code as a String for the exit code, or returns null + * + * @param host + * @param exit_code + * @return + */ + @Nullable + public static String guessExitCodeStatus(AHost host, int exit_code) { + if ((host == null&&LocalHost.isLocalhostWindows()) || host.isWindows()) { + try { + return NTStatus.getStatusCodeName(exit_code); + } catch ( Exception ex ) { + ex.printStackTrace(); + } + } + return null; + } + public ExecHandle execThread(String commandline) throws Exception { return execThread(commandline, null, null, null); } diff --git a/src/com/mostc/pftt/host/ExecOutput.java b/src/com/mostc/pftt/host/ExecOutput.java index 49812d5..7e65987 100644 --- a/src/com/mostc/pftt/host/ExecOutput.java +++ b/src/com/mostc/pftt/host/ExecOutput.java @@ -39,6 +39,9 @@ public class ExecOutput { public boolean isCrashed() { return exit_code < -1; } + public String guessExitCodeStatus(AHost host) { + return AHost.guessExitCodeStatus(host, exit_code); + } public ExecOutput printOutputIfCrash(Class<?> clazz, ConsoleManager cm) { return printOutputIfCrash(Host.toContext(clazz), cm); } @@ -54,7 +57,7 @@ public class ExecOutput { if (ps!=null && isCrashed()) { String output_str = output.trim(); if (StringUtil.isEmpty(output_str)) - output_str = "<Crash with no output. exit_code="+exit_code+" cmd="+cmd+">"; + output_str = "<Crash with no output. exit_code="+exit_code+" status="+AHost.guessExitCodeStatus(null, exit_code)+" cmd="+cmd+">"; ps.println(ctx+": "+output_str); } diff --git a/src/com/mostc/pftt/model/app/PhpUnitSourceTestPack.java b/src/com/mostc/pftt/model/app/PhpUnitSourceTestPack.java index f28dc26..79aad11 100644 --- a/src/com/mostc/pftt/model/app/PhpUnitSourceTestPack.java +++ b/src/com/mostc/pftt/model/app/PhpUnitSourceTestPack.java @@ -370,6 +370,11 @@ public abstract class PhpUnitSourceTestPack implements SourceTestPack<PhpUnitAct public String getName() { return getVersionString(); } + + @Override + public String toString() { + return getName(); + } /** Sometimes there are multiple tests that share a common resource (such as a file directory * or database) and can not be run at the same time. Such tests are non-thread-safe (NTS). diff --git a/src/com/mostc/pftt/model/sapi/AbstractManagedProcessesWebServerManager.java b/src/com/mostc/pftt/model/sapi/AbstractManagedProcessesWebServerManager.java index 5e95d53..b72a363 100644 --- a/src/com/mostc/pftt/model/sapi/AbstractManagedProcessesWebServerManager.java +++ b/src/com/mostc/pftt/model/sapi/AbstractManagedProcessesWebServerManager.java @@ -226,8 +226,8 @@ public abstract class AbstractManagedProcessesWebServerManager extends WebServer } @Override - public boolean isCrashed() { - return super.isCrashed() || process.isCrashed(); + public boolean isCrashedOrDebuggedAndClosed() { + return super.isCrashedOrDebuggedAndClosed() || process.isCrashedOrDebuggedAndClosed(); } @Override @@ -238,7 +238,7 @@ public abstract class AbstractManagedProcessesWebServerManager extends WebServer private boolean waiting_for_debug_of_crashed_process; @Override protected void do_close() { - if (isCrashed() && debug_handle!=null) { + if (isCrashedOrDebuggedAndClosed() && debug_handle!=null) { if (waiting_for_debug_of_crashed_process) return; waiting_for_debug_of_crashed_process = true; @@ -269,7 +269,7 @@ public abstract class AbstractManagedProcessesWebServerManager extends WebServer @Override public boolean isRunning() { - return process.isRunning() && !isCrashed(); + return process.isRunning() && !isCrashedOrDebuggedAndClosed(); } } // end public static abstract class ManagedProcessWebServerInstance diff --git a/src/com/mostc/pftt/model/sapi/ApacheManager.java b/src/com/mostc/pftt/model/sapi/ApacheManager.java index 22d524f..7944a1e 100644 --- a/src/com/mostc/pftt/model/sapi/ApacheManager.java +++ b/src/com/mostc/pftt/model/sapi/ApacheManager.java @@ -280,7 +280,7 @@ public class ApacheManager extends AbstractManagedProcessesWebServerManager { @Override protected void do_close() { // do this several times to make sure it gets done - final boolean c = process.isCrashed(); + final boolean c = process.isCrashedOrDebuggedAndClosed(); for ( int i=0; i <3;i++) { super.do_close(); diff --git a/src/com/mostc/pftt/model/sapi/CrashedWebServerInstance.java b/src/com/mostc/pftt/model/sapi/CrashedWebServerInstance.java index 43e9c82..81f24cc 100644 --- a/src/com/mostc/pftt/model/sapi/CrashedWebServerInstance.java +++ b/src/com/mostc/pftt/model/sapi/CrashedWebServerInstance.java @@ -44,7 +44,7 @@ public class CrashedWebServerInstance extends WebServerInstance { } @Override - public boolean isCrashed() { + public boolean isCrashedOrDebuggedAndClosed() { return true; } diff --git a/src/com/mostc/pftt/model/sapi/SAPIInstance.java b/src/com/mostc/pftt/model/sapi/SAPIInstance.java index 791d16e..d8c0cd3 100644 --- a/src/com/mostc/pftt/model/sapi/SAPIInstance.java +++ b/src/com/mostc/pftt/model/sapi/SAPIInstance.java @@ -1,17 +1,17 @@ -package com.mostc.pftt.model.sapi; - -import com.mostc.pftt.results.ConsoleManager; - -/** Running instance of a SAPI like a web server - * - * @author Matt Ficken - * - */ - -public abstract class SAPIInstance { - public abstract String getSAPIOutput(); - public abstract void close(); - public abstract boolean isRunning(); - public abstract String getInstanceInfo(ConsoleManager cm); - public abstract boolean isCrashed(); -} +package com.mostc.pftt.model.sapi; + +import com.mostc.pftt.results.ConsoleManager; + +/** Running instance of a SAPI like a web server + * + * @author Matt Ficken + * + */ + +public abstract class SAPIInstance { + public abstract String getSAPIOutput(); + public abstract void close(); + public abstract boolean isRunning(); + public abstract String getInstanceInfo(ConsoleManager cm); + public abstract boolean isCrashedOrDebuggedAndClosed(); +} diff --git a/src/com/mostc/pftt/model/sapi/SharedSAPIInstanceTestCaseGroupKey.java b/src/com/mostc/pftt/model/sapi/SharedSAPIInstanceTestCaseGroupKey.java index 6402078..eafab1b 100644 --- a/src/com/mostc/pftt/model/sapi/SharedSAPIInstanceTestCaseGroupKey.java +++ b/src/com/mostc/pftt/model/sapi/SharedSAPIInstanceTestCaseGroupKey.java @@ -31,7 +31,7 @@ public class SharedSAPIInstanceTestCaseGroupKey extends TestCaseGroupKey { } if (this_sapi_instance!=null&&this_sapi_instance!=sapi_instance) { - if (this_sapi_instance!=null && (cm.isDisableDebugPrompt()||!this_sapi_instance.isCrashed()||!host.isWindows())) + if (this_sapi_instance!=null && (cm.isDisableDebugPrompt()||!this_sapi_instance.isCrashedOrDebuggedAndClosed()||!host.isWindows())) this_sapi_instance.close(); } diff --git a/src/com/mostc/pftt/model/sapi/WebServerInstance.java b/src/com/mostc/pftt/model/sapi/WebServerInstance.java index 7b3b3a1..35fd5aa 100644 --- a/src/com/mostc/pftt/model/sapi/WebServerInstance.java +++ b/src/com/mostc/pftt/model/sapi/WebServerInstance.java @@ -8,6 +8,7 @@ import java.util.Map; import javax.annotation.concurrent.ThreadSafe; import com.github.mattficken.io.StringUtil; +import com.mostc.pftt.host.AHost; import com.mostc.pftt.model.TestCase; import com.mostc.pftt.model.core.PhpIni; @@ -81,7 +82,7 @@ public abstract class WebServerInstance extends SAPIInstance { StringBuilder sb = new StringBuilder(); if (sapi_output!=null) sb.append(sapi_output); - sb.append("\nPFTT: later web server returned exit code("+exit_code+") and output:\n"); + sb.append("\nPFTT: later web server returned exit code("+exit_code+"), status="+AHost.guessExitCodeStatus(null, exit_code)+" and output:\n"); sb.append(output); sb.append("\nPFTT: end output.\n"); sapi_output = sb.toString(); @@ -95,7 +96,7 @@ public abstract class WebServerInstance extends SAPIInstance { StringBuilder sb = new StringBuilder(1024); - sb.append("PFTT: web server crashed with exit code: "+exit_code+"\n"); + sb.append("PFTT: web server crashed with exit code: "+exit_code+" status="+AHost.guessExitCodeStatus(null, exit_code)+" \n"); getActiveTestListString(sb); getAllTestListString(sb); if (StringUtil.isEmpty(output)) { @@ -175,7 +176,7 @@ public abstract class WebServerInstance extends SAPIInstance { * @return */ @Override - public boolean isCrashed() { + public boolean isCrashedOrDebuggedAndClosed() { synchronized(sync_lock) { return crashed; } diff --git a/src/com/mostc/pftt/model/sapi/WebServerManager.java b/src/com/mostc/pftt/model/sapi/WebServerManager.java index e1b769a..0b1bd54 100644 --- a/src/com/mostc/pftt/model/sapi/WebServerManager.java +++ b/src/com/mostc/pftt/model/sapi/WebServerManager.java @@ -54,7 +54,7 @@ public abstract class WebServerManager extends SAPIManager { public void close(boolean debug) { synchronized(instances) { for ( WebServerInstance wsi : instances ) { - if (debug && wsi.isCrashed()) + if (debug && wsi.isCrashedOrDebuggedAndClosed()) continue; // don't close instance if user might want to debug it diff --git a/src/com/mostc/pftt/runner/AbstractLocalTestPackRunner.java b/src/com/mostc/pftt/runner/AbstractLocalTestPackRunner.java index a0ddb88..dca3675 100644 --- a/src/com/mostc/pftt/runner/AbstractLocalTestPackRunner.java +++ b/src/com/mostc/pftt/runner/AbstractLocalTestPackRunner.java @@ -543,7 +543,7 @@ public abstract class AbstractLocalTestPackRunner<A extends ActiveTestPack, S ex if (sapi_scenario instanceof AbstractWebServerScenario) { // TODO temp //SAPIInstance sa = ((SharedSAPIInstanceTestCaseGroupKey)group_key).getSAPIInstance(); - if (sa==null||sa.isCrashed()||(debugger_attached && !((WebServerInstance)sa).isDebuggerAttached())) { + if (sa==null||sa.isCrashedOrDebuggedAndClosed()||(debugger_attached && !((WebServerInstance)sa).isDebuggerAttached())) { //((SharedSAPIInstanceTestCaseGroupKey)group_key).setSAPIInstance( sa = ((AbstractWebServerScenario)sapi_scenario).smgr.getWebServerInstance(cm, runner_host, scenario_set, build, group_key.getPhpIni(), group_key.getEnv(), this instanceof PhpUnitThread ? ((PhpUnitThread)this).my_temp_dir // TODO temp phpunit @@ -588,7 +588,7 @@ public abstract class AbstractLocalTestPackRunner<A extends ActiveTestPack, S ex // test runner instance (otherwise each test runner will create its own instance, which is slow) /*if (sapi_scenario instanceof AbstractWebServerScenario) { // TODO temp SAPIInstance sa = ((SharedSAPIInstanceTestCaseGroupKey)group_key).getSAPIInstance();*/ - if (sa!=null && (cm.isDisableDebugPrompt()||!sa.isCrashed()||!runner_host.isWindows())) + if (sa!=null && (cm.isDisableDebugPrompt()||!sa.isCrashedOrDebuggedAndClosed()||!runner_host.isWindows())) sa.close(); //} } diff --git a/src/com/mostc/pftt/runner/AbstractPhptTestCaseRunner.java b/src/com/mostc/pftt/runner/AbstractPhptTestCaseRunner.java index 934a735..7f4b375 100644 --- a/src/com/mostc/pftt/runner/AbstractPhptTestCaseRunner.java +++ b/src/com/mostc/pftt/runner/AbstractPhptTestCaseRunner.java @@ -82,7 +82,15 @@ public abstract class AbstractPhptTestCaseRunner extends AbstractTestCaseRunner "ext/standard/tests/php_ini_loaded_file.phpt", "tests/run-test/test010.phpt", "ext/standard/tests/misc/time_sleep_until_basic.phpt", - "ext/standard/tests/misc/time_nanosleep_basic.phpt")) { + "ext/standard/tests/misc/time_nanosleep_basic.phpt", + "ext/mbstring/tests/bug45239.phpt", + "ext/mbstring/tests/bug63447_001.phpt", + "ext/mbstring/tests/bug63447_002.phpt", + "ext/mbstring/tests/htmlent.phpt", + "ext/mbstring/tests/ini_language.phpt", + "ext/mbstring/tests/mb_parse_str02.phpt", + "ext/mbstring/tests/overload02.phpt", + "ext/mbstring/tests/php_gr_jp_16242.phpt")) { twriter.addResult(host, scenario_set, new PhptTestResult(host, EPhptTestStatus.XSKIP, test_case, "test sometimes randomly fails, ignore it", null, null, null, null, null, null, null, null, null, null, null)); return true; diff --git a/src/com/mostc/pftt/runner/CliPhptTestCaseRunner.java b/src/com/mostc/pftt/runner/CliPhptTestCaseRunner.java index 392e60d..7cec13e 100644 --- a/src/com/mostc/pftt/runner/CliPhptTestCaseRunner.java +++ b/src/com/mostc/pftt/runner/CliPhptTestCaseRunner.java @@ -318,7 +318,7 @@ public class CliPhptTestCaseRunner extends AbstractPhptTestCaseRunner2 { if (output.isCrashed()) { not_crashed = false; // @see #runTest - twriter.addResult(host, scenario_set, new PhptTestResult(host, EPhptTestStatus.CRASH, test_case, "PFTT: exit_code="+output.exit_code+"\n"+output.output, null, null, null, ini, env, null, stdin_post, null, null, null, null, output.output)); + twriter.addResult(host, scenario_set, new PhptTestResult(host, EPhptTestStatus.CRASH, test_case, "PFTT: exit_code="+output.exit_code+" status="+output.guessExitCodeStatus(host)+"\n"+output.output, null, null, null, ini, env, null, stdin_post, null, null, null, null, output.output)); } return output.output; diff --git a/src/com/mostc/pftt/runner/HttpPhpUnitTestCaseRunner.java b/src/com/mostc/pftt/runner/HttpPhpUnitTestCaseRunner.java index 77d3cef..1b60c67 100644 --- a/src/com/mostc/pftt/runner/HttpPhpUnitTestCaseRunner.java +++ b/src/com/mostc/pftt/runner/HttpPhpUnitTestCaseRunner.java @@ -139,7 +139,7 @@ public class HttpPhpUnitTestCaseRunner extends AbstractPhpUnitTestCaseRunner { this.web = _web; is_replacement = true; - if (web==null||web.isCrashed()) { + if (web==null||web.isCrashedOrDebuggedAndClosed()) { markTestAsCrash(); // test will fail (because this(`PFTT: server...`) is the actual output which won't match the expected output) @@ -155,7 +155,7 @@ public class HttpPhpUnitTestCaseRunner extends AbstractPhpUnitTestCaseRunner { // its certainly the fault of a test (not PFTT) if not this test web = smgr.getWebServerInstance(cm, host, scenario_set, build, ini, env, my_temp_dir, web, false, test_case); - if (web==null||web.isCrashed()) { + if (web==null||web.isCrashedOrDebuggedAndClosed()) { markTestAsCrash(); return "PFTT: no web server available!\n"; @@ -171,9 +171,9 @@ public class HttpPhpUnitTestCaseRunner extends AbstractPhpUnitTestCaseRunner { if (web!=null) { web.notifyTestPostResponse(test_case); - if (web.isCrashed()) + if (web.isCrashedOrDebuggedAndClosed()) markTestAsCrash(); - if (is_replacement && (cm.isDisableDebugPrompt()||!web.isCrashed()||!host.isWindows())) { + if (is_replacement && (cm.isDisableDebugPrompt()||!web.isCrashedOrDebuggedAndClosed()||!host.isWindows())) { // CRITICAL: if this WebServerInstance is a replacement, then it exists only within this specific HttpTestCaseRunner // instance. if it is not terminated here, it will keep running forever! // @@ -264,7 +264,7 @@ public class HttpPhpUnitTestCaseRunner extends AbstractPhpUnitTestCaseRunner { @Override public String getCrashedSAPIOutput() { - return web!=null&&web.isCrashed() ? web.getSAPIOutput() : null; + return web!=null&&web.isCrashedOrDebuggedAndClosed() ? web.getSAPIOutput() : null; } } // end public class HttpPhpUnitTestCaseRunner diff --git a/src/com/mostc/pftt/runner/HttpPhptTestCaseRunner.java b/src/com/mostc/pftt/runner/HttpPhptTestCaseRunner.java index 8b7c7d2..55a2656 100644 --- a/src/com/mostc/pftt/runner/HttpPhptTestCaseRunner.java +++ b/src/com/mostc/pftt/runner/HttpPhptTestCaseRunner.java @@ -314,7 +314,7 @@ public class HttpPhptTestCaseRunner extends AbstractPhptTestCaseRunner2 { this.web = _web; is_replacement = true; - if (web==null||web.isCrashed()) { + if (web==null||web.isCrashedOrDebuggedAndClosed()) { markTestAsCrash(); // test will fail (because this(`PFTT: server...`) is the actual output which won't match the expected output) @@ -330,7 +330,7 @@ public class HttpPhptTestCaseRunner extends AbstractPhptTestCaseRunner2 { // its certainly the fault of a test (not PFTT) if not this test this.web = smgr.getWebServerInstance(cm, host, scenario_set, build, ini, env, active_test_pack.getStorageDirectory(), web, false, test_case); - if (web==null||web.isCrashed()) { + if (web==null||web.isCrashedOrDebuggedAndClosed()) { markTestAsCrash(); return "PFTT: no web server available!\n"; @@ -350,9 +350,9 @@ public class HttpPhptTestCaseRunner extends AbstractPhptTestCaseRunner2 { if (web!=null) { web.notifyTestPostResponse(test_case); - if (web.isCrashed()) + if (web.isCrashedOrDebuggedAndClosed()) markTestAsCrash(); - if (is_replacement && (cm.isDisableDebugPrompt()||!web.isCrashed()||!host.isWindows())) { + if (is_replacement && (cm.isDisableDebugPrompt()||!web.isCrashedOrDebuggedAndClosed()||!host.isWindows())) { // CRITICAL: if this WebServerInstance is a replacement, then it exists only within this specific HttpTestCaseRunner // instance. if it is not terminated here, it will keep running forever! // @@ -535,7 +535,7 @@ public class HttpPhptTestCaseRunner extends AbstractPhptTestCaseRunner2 { @Override public String getCrashedSAPIOutput() { - return web!=null&&web.isCrashed() ? web.getSAPIOutput() : null; + return web!=null&&web.isCrashedOrDebuggedAndClosed() ? web.getSAPIOutput() : null; } @Override diff --git a/src/com/mostc/pftt/runner/LocalPhpUnitTestPackRunner.java b/src/com/mostc/pftt/runner/LocalPhpUnitTestPackRunner.java index 7d20843..e8ca982 100644 --- a/src/com/mostc/pftt/runner/LocalPhpUnitTestPackRunner.java +++ b/src/com/mostc/pftt/runner/LocalPhpUnitTestPackRunner.java @@ -27,6 +27,7 @@ import com.mostc.pftt.model.app.PhpUnitActiveTestPack; import com.mostc.pftt.model.app.PhpUnitSourceTestPack; import com.mostc.pftt.model.app.PhpUnitTestCase; import com.mostc.pftt.model.core.PhpBuild; +import com.mostc.pftt.model.core.PhpIni; import com.mostc.pftt.model.sapi.ApacheManager; import com.mostc.pftt.model.sapi.SharedSAPIInstanceTestCaseGroupKey; import com.mostc.pftt.model.sapi.TestCaseGroupKey; @@ -36,6 +37,7 @@ import com.mostc.pftt.results.ITestResultReceiver; import com.mostc.pftt.results.ConsoleManager.EPrintType; import com.mostc.pftt.scenario.AbstractFileSystemScenario.ITestPackStorageDir; import com.mostc.pftt.scenario.AbstractSMBScenario.SMBStorageDir; +import com.mostc.pftt.scenario.AbstractINIScenario; import com.mostc.pftt.scenario.ScenarioSet; public class LocalPhpUnitTestPackRunner extends AbstractLocalTestPackRunner<PhpUnitActiveTestPack, PhpUnitSourceTestPack, PhpUnitTestCase> { @@ -135,12 +137,13 @@ public class LocalPhpUnitTestPackRunner extends AbstractLocalTestPackRunner<PhpU @Override protected TestCaseGroupKey createGroupKey(PhpUnitTestCase test_case, TestCaseGroupKey group_key) throws Exception { - return group_key == null ? new SharedSAPIInstanceTestCaseGroupKey( - // CRITICAL: provide the INI to run all PhpUnitTestCases - // unlike PhptTestCases all PhpUnitTestCases share the same INI and environment variables - RequiredExtensionsSmokeTest.createDefaultIniCopy(runner_host, build), - null) : - group_key; + if (group_key!=null) + return group_key; + // CRITICAL: provide the INI to run all PhpUnitTestCases + // unlike PhptTestCases all PhpUnitTestCases share the same INI and environment variables + PhpIni ini = RequiredExtensionsSmokeTest.createDefaultIniCopy(runner_host, build); + AbstractINIScenario.setupScenarios(cm, runner_host, scenario_set, build, ini); + return new SharedSAPIInstanceTestCaseGroupKey(ini, null); } @Override diff --git a/src/com/mostc/pftt/scenario/AbstractINIScenario.java b/src/com/mostc/pftt/scenario/AbstractINIScenario.java index 886d64c..27c7a40 100644 --- a/src/com/mostc/pftt/scenario/AbstractINIScenario.java +++ b/src/com/mostc/pftt/scenario/AbstractINIScenario.java @@ -48,4 +48,13 @@ public abstract class AbstractINIScenario extends AbstractSerialScenario { */ public abstract boolean setup(ConsoleManager cm, Host host, PhpBuild build, PhpIni ini); + public static void setupScenarios(ConsoleManager cm, Host host, ScenarioSet scenario_set, PhpBuild build, PhpIni ini) { + for (Scenario scenario : scenario_set ) { + if (!(scenario instanceof AbstractINIScenario)) + continue; + + ((AbstractINIScenario)scenario).setup(cm, host, build, ini); + } + } + } // end public abstract class AbstractINIScenario diff --git a/src/com/mostc/pftt/scenario/AbstractWebServerScenario.java b/src/com/mostc/pftt/scenario/AbstractWebServerScenario.java index e56b73e..70294e0 100644 --- a/src/com/mostc/pftt/scenario/AbstractWebServerScenario.java +++ b/src/com/mostc/pftt/scenario/AbstractWebServerScenario.java @@ -136,7 +136,9 @@ public abstract class AbstractWebServerScenario extends AbstractSAPIScenario { @Override public PhpIni createIniForTest(ConsoleManager cm, AHost host, PhpBuild build, PhptActiveTestPack active_test_pack, ScenarioSet scenario_set) { // entire PhpIni will be given to web server when its started - return RequiredExtensionsSmokeTest.createDefaultIniCopy(host, build); + PhpIni ini = RequiredExtensionsSmokeTest.createDefaultIniCopy(host, build); + AbstractINIScenario.setupScenarios(cm, host, scenario_set, build, ini); + return ini; } @Override diff --git a/src/com/mostc/pftt/scenario/CLIScenario.java b/src/com/mostc/pftt/scenario/CLIScenario.java index 1be7c50..351e38c 100644 --- a/src/com/mostc/pftt/scenario/CLIScenario.java +++ b/src/com/mostc/pftt/scenario/CLIScenario.java @@ -62,7 +62,9 @@ public class CliScenario extends AbstractSAPIScenario { // default PhpIni will be given to php.exe using a file... @see CliPhptTestCaseRunner#prepare // // this is needed only to collect any custom directives that a test case provides - return new PhpIni(); + PhpIni ini = new PhpIni(); + AbstractINIScenario.setupScenarios(cm, host, scenario_set, build, ini); + return ini; } @Override diff --git a/src/com/mostc/pftt/scenario/OptimizerPlusScenario.java b/src/com/mostc/pftt/scenario/OptimizerPlusScenario.java index 2742dba..988b13d 100644 --- a/src/com/mostc/pftt/scenario/OptimizerPlusScenario.java +++ b/src/com/mostc/pftt/scenario/OptimizerPlusScenario.java @@ -13,6 +13,7 @@ import com.mostc.pftt.results.ConsoleManager; * * Formerly known as Zend Optimizer+, often abbreviated as o+ or zo+ * + * @see http://windows.php.net/downloads/pecl/snaps/Optimizer/7.0.0-dev/ * @see https://github.com/zend-dev/ZendOptimizerPlus * @see https://github.com/OSTC/ZendOptimizerPlus - fork for Windows/PHP on Windows *