Commit: 4ea11aba63bf6bb1f086611ebca46369fb88ac93 Author: Matt Ficken <v-maf...@microsoft.com> Thu, 21 Feb 2013 16:24:13 -0800 Parents: f9688d5e45a3159dec04d8cd7c957c76cfe15017 Branches: master
Link: http://git.php.net/?p=pftt2.git;a=commitdiff;h=4ea11aba63bf6bb1f086611ebca46369fb88ac93 Log: running phpunit tests with remote fs scenarios Former-commit-id: a7c014c195352699c4fbb02bd436575ae996278c Changed paths: M conf/app/joomla.groovy A conf/op.groovy M conf/symfony.groovy D conf/zop.groovy M src/com/mostc/pftt/host/AHost.java M src/com/mostc/pftt/host/LocalHost.java M src/com/mostc/pftt/host/SSHHost.java M src/com/mostc/pftt/main/Config.java M src/com/mostc/pftt/main/PfttMain.java M src/com/mostc/pftt/model/SourceTestPack.java M src/com/mostc/pftt/model/app/PhpUnitActiveTestPack.java M src/com/mostc/pftt/model/app/PhpUnitSourceTestPack.java M src/com/mostc/pftt/model/app/PhpUnitTemplate.groovy M src/com/mostc/pftt/model/core/EAcceleratorType.java M src/com/mostc/pftt/model/core/PhptSourceTestPack.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/AbstractTestPackRunner.java M src/com/mostc/pftt/runner/LocalPhpUnitTestPackRunner.java M src/com/mostc/pftt/runner/LocalPhptTestPackRunner.java M src/com/mostc/pftt/scenario/AbstractCodeCacheScenario.java M src/com/mostc/pftt/scenario/AbstractRemoteFileSystemScenario.java M src/com/mostc/pftt/scenario/AbstractSMBScenario.java M src/com/mostc/pftt/scenario/ApplicationScenario.java A src/com/mostc/pftt/scenario/OptimizerPlusScenario.java M src/com/mostc/pftt/scenario/SMBBasicScenario.java M src/com/mostc/pftt/scenario/SMBDFSScenario.java D src/com/mostc/pftt/scenario/ZendOptimizerPlusScenario.java
diff --git a/conf/app/joomla.groovy b/conf/app/joomla.groovy index 7742ac4..4d58d44 100644 --- a/conf/app/joomla.groovy +++ b/conf/app/joomla.groovy @@ -9,15 +9,10 @@ def scenarios() { * @see https://github.com/joomla/joomla-platform * */ -class SymfonyPhpUnitTestPack extends PhpUnitSourceTestPack { +abstract class SymfonyPhpUnitTestPack extends PhpUnitSourceTestPack { @Override - public String getVersionString() { - return "Symfony-2.1.7"; - } - - @Override - public boolean open(ConsoleManager cm, AHost host) throws Exception { + protected boolean openAfterInstall(ConsoleManager cm, AHost host) throws Exception { // 1. addBlacklist("vendor/kriswallsmith/assetic/tests/assetic/test/filter/sass/sassfiltertest.php"); addBlacklist("vendor/sensio/generator-bundle/sensio/bundle/generatorbundle/resources/skeleton/bundle/defaultcontrollertest.php"); @@ -47,7 +42,7 @@ class SymfonyPhpUnitTestPack extends PhpUnitSourceTestPack { } return true; - } // end public boolean open + } // end public boolean openAfterInstall } // end class SymfonyPhpUnitTestPack class JoomlaPlatformPhpUnitTestPack extends SymfonyPhpUnitTestPack { @@ -56,14 +51,18 @@ class JoomlaPlatformPhpUnitTestPack extends SymfonyPhpUnitTestPack { public String getVersionString() { return "Joomla-Platform-12.3"; } + + @Override + protected String getSourceRoot(AHost host) { + return host.getPfttDir()+"/cache/working/joomla-platform"; + } @Override - public boolean open(ConsoleManager cm, AHost host) throws Exception { + protected boolean openAfterInstall(ConsoleManager cm, AHost host) throws Exception { // 1. dependency on SymfonyPhpUnitTestPack (Joomla-Platform depends on Symfony) - super.open(cm, host); + super.openAfterInstall(cm, host); // 2. - setRoot("C:\\php-sdk\\PFTT\\current\\cache\\working\\joomla-platform"); addPhpUnitDist(getRoot()+"/tests/suites/database", getRoot()+"/tests/bootstrap.php"); addPhpUnitDist(getRoot()+"/tests/suites/unit", getRoot()+"/tests/bootstrap.php"); addPhpUnitDist(getRoot()+"/tests/suites/legacy", getRoot()+"/tests/bootstrap.legacy.php"); diff --git a/conf/op.groovy b/conf/op.groovy new file mode 100644 index 0000000..88ab1b8 --- /dev/null +++ b/conf/op.groovy @@ -0,0 +1,4 @@ + +def scenarios() { + new OptimizerPlusScenario() +} diff --git a/conf/symfony.groovy b/conf/symfony.groovy index eb067ab..1fcc87d 100644 --- a/conf/symfony.groovy +++ b/conf/symfony.groovy @@ -10,10 +10,15 @@ class SymfonyPhpUnitTestPack extends PhpUnitSourceTestPack { public String getVersionString() { return "Symfony-2.1.7"; } + + @Override + protected String getSourceRoot(AHost host) { + return host.getPfttDir()+"/cache/working/Symfony"; + } @Override - public boolean open(ConsoleManager cm, AHost host) throws Exception { - // 1. + protected boolean openAfterInstall(ConsoleManager cm, AHost host) throws Exception { + // 1. don't run these, they're really broken addBlacklist("vendor/kriswallsmith/assetic/tests/assetic/test/filter/sass/sassfiltertest.php"); addBlacklist("vendor/sensio/generator-bundle/sensio/bundle/generatorbundle/resources/skeleton/bundle/defaultcontrollertest.php"); addBlacklist("vendor/symfony/symfony/vendor/kriswallsmith/assetic/tests/assetic/test/filter/sass/sassfiltertest.php"); @@ -22,7 +27,6 @@ class SymfonyPhpUnitTestPack extends PhpUnitSourceTestPack { addBlacklist("vendor/twig/twig/test/twig/tests/integrationtest.php"); // 2. - setRoot("C:\\php-sdk\\PFTT\\current\\cache\\working\\Symfony"); addPhpUnitDist(getRoot()+"/vendor/symfony/symfony/src", getRoot()+"/vendor/symfony/symfony/autoload.php.dist"); addPhpUnitDist(getRoot()+"/vendor/doctrine/common/tests", getRoot()+"/vendor/doctrine/common/tests/Doctrine/Tests/TestInit.php"); addIncludeDirectory(getRoot()+"/vendor/symfony/symfony/src"); @@ -38,11 +42,11 @@ class SymfonyPhpUnitTestPack extends PhpUnitSourceTestPack { host.move(tmp_dir+"/vendor", getRoot()+"/vendor/symfony/symfony/vendor"); - host.delete(tmp_dir); + host.deleteIfExists(tmp_dir); } return true; - } // end public boolean open + } // end public boolean openAfterInstall } // end class SymfonyPhpUnitTestPack getBinding().setVariable("SymfonyPhpUnitTestPack", SymfonyPhpUnitTestPack); diff --git a/conf/zop.groovy b/conf/zop.groovy deleted file mode 100644 index 508ed0e..0000000 --- a/conf/zop.groovy +++ /dev/null @@ -1,4 +0,0 @@ - -def scenarios() { - new ZendOptimizerPlusScenario() -} diff --git a/src/com/mostc/pftt/host/AHost.java b/src/com/mostc/pftt/host/AHost.java index 8908c98..274954c 100644 --- a/src/com/mostc/pftt/host/AHost.java +++ b/src/com/mostc/pftt/host/AHost.java @@ -499,12 +499,12 @@ public abstract class AHost extends Host { } } - public void upload7ZipAndDecompress(ConsoleManager cm, Class<?> clazz, AHost src_host, String src, String dst) throws IllegalStateException, IOException, Exception { - upload7ZipAndDecompress(cm, toContext(clazz), src_host, src, dst); + public void upload7ZipFileAndDecompress(ConsoleManager cm, Class<?> clazz, AHost src_host, String src, String dst) throws IllegalStateException, IOException, Exception { + upload7ZipFileAndDecompress(cm, toContext(clazz), src_host, src, dst); } - public void download7ZipAndDecompress(ConsoleManager cm, Class<?> clazz, String src, AHost dst_host, String dst) throws IllegalStateException, IOException, Exception { - download7ZipAndDecompress(cm, toContext(clazz), src, dst_host, dst); + public void download7ZipFileAndDecompress(ConsoleManager cm, Class<?> clazz, String src, AHost dst_host, String dst) throws IllegalStateException, IOException, Exception { + download7ZipFileAndDecompress(cm, toContext(clazz), src, dst_host, dst); } /** uploads a 7zip file from local source to remote destination and decompresses it. @@ -520,7 +520,7 @@ public abstract class AHost extends Host { * @throws IOException * @throws Exception */ - public void upload7ZipAndDecompress(ConsoleManager cm, String ctx_str, AHost src_host, String src, String dst) throws IllegalStateException, IOException, Exception { + public void upload7ZipFileAndDecompress(ConsoleManager cm, String ctx_str, AHost src_host, String src, String dst) throws IllegalStateException, IOException, Exception { ensure7Zip(cm, src_host); String dst_7zip_file = mktempname(ctx_str, ".7z"); @@ -545,7 +545,7 @@ public abstract class AHost extends Host { * @throws IOException * @throws Exception */ - public void download7ZipAndDecompress(ConsoleManager cm, String ctx_str, String src, AHost dst_host, String dst) throws IllegalStateException, IOException, Exception { + public void download7ZipFileAndDecompress(ConsoleManager cm, String ctx_str, String src, AHost dst_host, String dst) throws IllegalStateException, IOException, Exception { ensure7Zip(cm, dst_host); String dst_7zip_file = dst_host.mktempname(ctx_str, ".7z"); diff --git a/src/com/mostc/pftt/host/LocalHost.java b/src/com/mostc/pftt/host/LocalHost.java index eff48d2..3d838f5 100644 --- a/src/com/mostc/pftt/host/LocalHost.java +++ b/src/com/mostc/pftt/host/LocalHost.java @@ -239,7 +239,8 @@ public class LocalHost extends AHost { String cmd = null; if (isDirectory(src)) { // ensure xcopy sees destination is supposed to be a directory, or xcopy will ask/block forever - dst += "\\"; + if (!dst.endsWith("\\")) + dst += "\\"; // /I is only for directories // TODO try /J => performance improvement? diff --git a/src/com/mostc/pftt/host/SSHHost.java b/src/com/mostc/pftt/host/SSHHost.java index 85fc964..3ac6d48 100644 --- a/src/com/mostc/pftt/host/SSHHost.java +++ b/src/com/mostc/pftt/host/SSHHost.java @@ -306,7 +306,8 @@ public class SSHHost extends RemoteHost { dst = toWindowsPath(dst); if (isDirectory(src)) { // ensure xcopy sees destination is supposed to be a directory, or xcopy will ask/block forever - dst += "\\"; + if (!dst.endsWith("\\")) + dst += "\\"; exec("xcopy /Q /Y /C /I /E /G /R /H \""+src+"\" \""+dst+"\"", FOUR_HOURS); } else { diff --git a/src/com/mostc/pftt/main/Config.java b/src/com/mostc/pftt/main/Config.java index e5deba0..0555f04 100644 --- a/src/com/mostc/pftt/main/Config.java +++ b/src/com/mostc/pftt/main/Config.java @@ -9,8 +9,6 @@ import java.util.List; import org.apache.commons.net.ftp.FTPClient; import org.codehaus.groovy.control.CompilationFailedException; -import org.codehaus.groovy.control.CompilerConfiguration; -import org.codehaus.groovy.control.customizers.ImportCustomizer; import org.codehaus.groovy.runtime.metaclass.MissingMethodExceptionNoStack; import org.codehaus.groovy.runtime.metaclass.MissingPropertyExceptionNoStack; import org.columba.ristretto.smtp.SMTPProtocol; @@ -21,7 +19,6 @@ import com.mostc.pftt.model.app.PhpUnitSourceTestPack; import com.mostc.pftt.model.core.PhptTestCase; import com.mostc.pftt.results.ConsoleManager; import com.mostc.pftt.results.ConsoleManager.EPrintType; -import com.mostc.pftt.scenario.ApplicationScenario; import com.mostc.pftt.scenario.Scenario; import com.mostc.pftt.scenario.ScenarioSet; import com.mostc.pftt.scenario.app.JoomlaScenario; diff --git a/src/com/mostc/pftt/main/PfttMain.java b/src/com/mostc/pftt/main/PfttMain.java index ac0d616..150db5d 100644 --- a/src/com/mostc/pftt/main/PfttMain.java +++ b/src/com/mostc/pftt/main/PfttMain.java @@ -775,18 +775,32 @@ public class PfttMain { } else if (command.equals("app_list")||command.equals("applist")||command.equals("al")) { // TODO } else if (command.equals("app_all")||command.equals("appall")||command.equals("aa")) { - // TODO + if (!(args.length > args_i+1)) { + System.err.println("User Error: must specify build"); + System.out.println("usage: pftt app_all <path to PHP build>"); + System.exit(-255); + return; + } + + PhpBuild build = newBuild(cm, rt.host, args[args_i+1]); + if (build==null) { + System.err.println("IO Error: can not open php build: "+build); + System.exit(-255); + return; + } + cm.println(EPrintType.CLUE, PfttMain.class, "Build: "+build); + ScenarioSet scenario_set = config.getScenarioSets().get(0); - // TODO - PhpBuild build = new PhpBuild("c:/php-sdk/php-5.5-ts-windows-vc9-x86-re6bde1f"); + checkDebugger(cm, rt.host, build); build.open(cm, rt.host); PhpUnitSourceTestPack test_pack = config.getPhpUnitSourceTestPack(cm); - test_pack.open(cm, rt.host); // CRITICAL + cm.println(EPrintType.CLUE, PfttMain.class, "Test-Pack: "+test_pack); PhpResultPackWriter tmgr = new PhpResultPackWriter(rt.host, cm, new File(rt.host.getPhpSdkDir()), build, scenario_set); - LocalPhpUnitTestPackRunner r = new LocalPhpUnitTestPackRunner(cm, tmgr, scenario_set, build, rt.host, rt.host); + List<AHost> hosts = config.getHosts(); + LocalPhpUnitTestPackRunner r = new LocalPhpUnitTestPackRunner(cm, tmgr, scenario_set, build, hosts.isEmpty()?rt.host:hosts.get(0), rt.host); r.runAllTests(test_pack); tmgr.close(); diff --git a/src/com/mostc/pftt/model/SourceTestPack.java b/src/com/mostc/pftt/model/SourceTestPack.java index 43f31d4..68562f3 100644 --- a/src/com/mostc/pftt/model/SourceTestPack.java +++ b/src/com/mostc/pftt/model/SourceTestPack.java @@ -13,7 +13,7 @@ public interface SourceTestPack<A extends ActiveTestPack, T extends TestCase> { void cleanup(ConsoleManager cm); String getSourceDirectory(); void read(List<T> test_cases, ConsoleManager cm, ITestResultReceiver twriter, PhpBuild build) throws FileNotFoundException, IOException, Exception; - A installInPlace(); + A installInPlace(ConsoleManager cm, AHost host) throws IOException, Exception; A installNamed(AHost host, String string, List<T> test_cases) throws IllegalStateException, IOException, Exception; A install(ConsoleManager cm, AHost host, String local_test_pack_dir, String remote_test_pack_dir) throws IllegalStateException, IOException, Exception; } diff --git a/src/com/mostc/pftt/model/app/PhpUnitActiveTestPack.java b/src/com/mostc/pftt/model/app/PhpUnitActiveTestPack.java index bdfc4f6..3e7c2b2 100644 --- a/src/com/mostc/pftt/model/app/PhpUnitActiveTestPack.java +++ b/src/com/mostc/pftt/model/app/PhpUnitActiveTestPack.java @@ -1,22 +1,23 @@ package com.mostc.pftt.model.app; -import com.mostc.pftt.host.AHost; import com.mostc.pftt.model.ActiveTestPack; public class PhpUnitActiveTestPack implements ActiveTestPack { -// C:\\php-sdk\\PFTT\\current\\cache\\working\\symfony\\vendor\\symfony\\symfony\\src - AHost host; + protected final String local_test_pack_dir, remote_test_pack_dir; + + public PhpUnitActiveTestPack(String local_test_pack_dir, String remote_test_pack_dir) { + this.local_test_pack_dir = local_test_pack_dir; + this.remote_test_pack_dir = remote_test_pack_dir; + } @Override public String getRunningDirectory() { - // TODO Auto-generated method stub - return null; + return remote_test_pack_dir; } @Override public String getStorageDirectory() { - // TODO Auto-generated method stub - return null; + return local_test_pack_dir; } diff --git a/src/com/mostc/pftt/model/app/PhpUnitSourceTestPack.java b/src/com/mostc/pftt/model/app/PhpUnitSourceTestPack.java index 532da92..f28dc26 100644 --- a/src/com/mostc/pftt/model/app/PhpUnitSourceTestPack.java +++ b/src/com/mostc/pftt/model/app/PhpUnitSourceTestPack.java @@ -23,6 +23,7 @@ import com.caucho.vfs.FileReadStream; import com.caucho.vfs.ReadStream; import com.mostc.pftt.host.AHost; import com.mostc.pftt.host.Host; +import com.mostc.pftt.host.LocalHost; import com.mostc.pftt.model.SourceTestPack; import com.mostc.pftt.model.core.PhpBuild; import com.mostc.pftt.results.ConsoleManager; @@ -32,7 +33,9 @@ import com.mostc.pftt.results.ITestResultReceiver; * * To configure a PhpUnitSourceTestPack: * 1. provide PhpUnitSourceTestPack the path to the test pack + * -implement #getSourceRoot * 2. find all the phpunit.dist.xml files in the test-pack + * -implement #openAfterInstall * 3. (required) create corresponding PhpUnitDists by calling PhpUnitSourceTestPack#addPhpUnitDist * and provide all the information from the phpunit.dist.xml file. * the Javadoc on the PhpUnitDist methods explains which method matches which XML tag. @@ -49,6 +52,7 @@ import com.mostc.pftt.results.ITestResultReceiver; */ public abstract class PhpUnitSourceTestPack implements SourceTestPack<PhpUnitActiveTestPack, PhpUnitTestCase> { + // TODO move javadoc from these fields to associated setter methods /** required: file path to test-pack */ protected String test_pack_root; /** optional: PHP code to run before every test case. this is meant to do additional initialization @@ -284,9 +288,16 @@ public abstract class PhpUnitSourceTestPack implements SourceTestPack<PhpUnitAct } @Override - public PhpUnitActiveTestPack installInPlace() { - // TODO Auto-generated method stub - return null; + public PhpUnitActiveTestPack installInPlace(ConsoleManager cm, AHost host) throws Exception { + final String src_root = getSourceRoot(new LocalHost()); + if (!new File(src_root).isDirectory()) { + throw new IOException("source-test-pack not found: "+src_root); + } + setRoot(src_root); + + openAfterInstall(cm, host); + + return new PhpUnitActiveTestPack(src_root, src_root); } @Override @@ -301,9 +312,42 @@ public abstract class PhpUnitSourceTestPack implements SourceTestPack<PhpUnitAct public PhpUnitActiveTestPack install(ConsoleManager cm, AHost host, String local_test_pack_dir, String remote_test_pack_dir) throws IllegalStateException, IOException, Exception { - // TODO Auto-generated method stub - return null; + + final String src_root = getSourceRoot(new LocalHost()); + if (!new File(src_root).isDirectory()) { + throw new IOException("source-test-pack not found: "+src_root); + } + + // using #uploadCompressWith7Zip instead of just #upload makes a huge difference + // for PhpUnit test-packs because of the large number of small files that have to be uploaded + host.uploadCompressWith7Zip(cm, getClass(), src_root, new LocalHost(), remote_test_pack_dir); + + setRoot(local_test_pack_dir); + + openAfterInstall(cm, host); + + return new PhpUnitActiveTestPack(local_test_pack_dir, remote_test_pack_dir); } + + /** the base directory within the PFTT directory to find the phpunit and required php files + * + * @param host - determine the absolute path on this host + * @see AHost#getPfttDir + * @return + */ + protected abstract String getSourceRoot(AHost host); + + /** installs the tests after they have been copied to storage (if needed) + * + * @see #getRoot() returns the location the tests and their php files have been copied to (if they were + * copied, if not copied, returns location they are stored at) + * + * @param cm + * @param host + * @return + * @throws Exception + */ + protected abstract boolean openAfterInstall(ConsoleManager cm, AHost host) throws Exception; public void setRoot(String test_pack_root) { this.test_pack_root = test_pack_root; @@ -322,8 +366,7 @@ public abstract class PhpUnitSourceTestPack implements SourceTestPack<PhpUnitAct } public abstract String getVersionString(); - public abstract boolean open(ConsoleManager cm, AHost host) throws Exception; - + public String getName() { return getVersionString(); } diff --git a/src/com/mostc/pftt/model/app/PhpUnitTemplate.groovy b/src/com/mostc/pftt/model/app/PhpUnitTemplate.groovy index c2abe37..3e7c5d1 100644 --- a/src/com/mostc/pftt/model/app/PhpUnitTemplate.groovy +++ b/src/com/mostc/pftt/model/app/PhpUnitTemplate.groovy @@ -113,6 +113,7 @@ function __phpunit_run_isolated_test() echo \$test->getStatusMessage(); echo PHP_EOL; echo \$output; + var_dump(get_loaded_extensions()); break; case PHPUnit_Runner_BaseTestRunner::STATUS_INCOMPLETE: echo 'NOT_IMPLEMENTED'; @@ -151,6 +152,12 @@ function __phpunit_run_isolated_test() } """); + // NOTE: when skipping, outputs get_loaded_extensions() to show what extensions were actually loaded + // may be skipped because an extension wasn't loaded (checked with extension_loaded('ext_name')) + // but some extensions (intl) aren't loaded even though other extensions from the INI are loaded + // + // (ie Apache gets the INI and loads most of the extensions from the INI, but sometimes fails to load intl) + // // PhpUnit test execution: // diff --git a/src/com/mostc/pftt/model/core/EAcceleratorType.java b/src/com/mostc/pftt/model/core/EAcceleratorType.java index 7485d11..6738f40 100644 --- a/src/com/mostc/pftt/model/core/EAcceleratorType.java +++ b/src/com/mostc/pftt/model/core/EAcceleratorType.java @@ -21,7 +21,7 @@ public enum EAcceleratorType { return AbstractCodeCacheScenario.NO; } }, - ZEND_OPTIMIZER_PLUS { + OPTIMIZER_PLUS { @Override public AbstractCodeCacheScenario getCodeCacheScenario() { return AbstractCodeCacheScenario.ZEND_OPTIMIZER_PLUS; diff --git a/src/com/mostc/pftt/model/core/PhptSourceTestPack.java b/src/com/mostc/pftt/model/core/PhptSourceTestPack.java index f63c7d3..3dd8998 100644 --- a/src/com/mostc/pftt/model/core/PhptSourceTestPack.java +++ b/src/com/mostc/pftt/model/core/PhptSourceTestPack.java @@ -251,7 +251,7 @@ public class PhptSourceTestPack implements SourceTestPack<PhptActiveTestPack, Ph * @return */ @Override - public PhptActiveTestPack installInPlace() { + public PhptActiveTestPack installInPlace(ConsoleManager cm, AHost host) { return new PhptActiveTestPack(this.getSourceDirectory(), this.getSourceDirectory()); } @@ -277,7 +277,7 @@ public class PhptSourceTestPack implements SourceTestPack<PhptActiveTestPack, Ph host.uploadCompressWith7Zip(cm, getClass(), test_pack, this.host, remote_test_pack_dir); } else if (!host.isRemote()) { // installing from remote host to local host - host.download7ZipAndDecompress(cm, getClass(), test_pack, this.host, remote_test_pack_dir); + host.download7ZipFileAndDecompress(cm, getClass(), test_pack, this.host, remote_test_pack_dir); } else { // installing from 1 remote host(src) to a different remote host (dst) LocalHost local_host = new LocalHost(); diff --git a/src/com/mostc/pftt/model/smoke/RequiredExtensionsSmokeTest.java b/src/com/mostc/pftt/model/smoke/RequiredExtensionsSmokeTest.java index 451b31b..8da22cb 100644 --- a/src/com/mostc/pftt/model/smoke/RequiredExtensionsSmokeTest.java +++ b/src/com/mostc/pftt/model/smoke/RequiredExtensionsSmokeTest.java @@ -116,6 +116,11 @@ public class RequiredExtensionsSmokeTest extends SmokeTest { * @return */ public static PhpIni createDefaultIniCopy(Host host, PhpBuild build) { + // these settings make a (big) difference in certain scenarios or for certain tests + // before committing changes to any of them, you MUST do a full run of all tests on + // all scenarios before and after the change to ensure that your change here does not + // break anything + // PhpIni ini = new PhpIni(); // ini.putSingle("default_mimetype", "text/plain"); // ini.putSingle("date.timezone", "'UTC'"); @@ -124,6 +129,10 @@ public class RequiredExtensionsSmokeTest extends SmokeTest { ini.putMulti(PhpIni.SAFE_MODE, 0); ini.putMulti(PhpIni.DISABLE_DEFS, PhpIni.OFF); ini.putMulti(PhpIni.OUTPUT_BUFFERING, PhpIni.ON); + + // CRITICAL PhpUnit tests w/ remote fs scenarios + ini.putSingle("max_execution_time", 60); // default is 30 + // // CRITICAL ini.putMulti(PhpIni.ERROR_REPORTING, PhpIni.E_ALL_NOTICE_WARNING); diff --git a/src/com/mostc/pftt/results/PhpResultPackWriter.java b/src/com/mostc/pftt/results/PhpResultPackWriter.java index 31e1253..5629353 100644 --- a/src/com/mostc/pftt/results/PhpResultPackWriter.java +++ b/src/com/mostc/pftt/results/PhpResultPackWriter.java @@ -70,9 +70,6 @@ public class PhpResultPackWriter extends PhpResultPack implements ITestResultRec sb.append(cpu); } - sb.append('-'); - sb.append(scenario_set.getShortName()); - return new File(base.getAbsolutePath() + sb); } diff --git a/src/com/mostc/pftt/runner/AbstractLocalTestPackRunner.java b/src/com/mostc/pftt/runner/AbstractLocalTestPackRunner.java index d84ec3d..a0ddb88 100644 --- a/src/com/mostc/pftt/runner/AbstractLocalTestPackRunner.java +++ b/src/com/mostc/pftt/runner/AbstractLocalTestPackRunner.java @@ -13,6 +13,8 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; +import javax.annotation.Nullable; + import com.mostc.pftt.host.AHost; import com.mostc.pftt.host.RemoteHost; import com.mostc.pftt.model.ActiveTestPack; @@ -29,6 +31,7 @@ import com.mostc.pftt.results.ITestResultReceiver; import com.mostc.pftt.results.ConsoleManager.EPrintType; import com.mostc.pftt.runner.LocalPhpUnitTestPackRunner.PhpUnitThread; import com.mostc.pftt.scenario.AbstractFileSystemScenario; +import com.mostc.pftt.scenario.AbstractRemoteFileSystemScenario; import com.mostc.pftt.scenario.AbstractSAPIScenario; import com.mostc.pftt.scenario.AbstractWebServerScenario; import com.mostc.pftt.scenario.Scenario; @@ -96,14 +99,55 @@ public abstract class AbstractLocalTestPackRunner<A extends ActiveTestPack, S ex public void runTestList(S test_pack, List<T> test_cases) throws Exception { this.src_test_pack = test_pack; - runTestList(test_pack, null, test_cases); + runTestList(null, test_pack, null, test_cases); } public void runTestList(A test_pack, List<T> test_cases) throws Exception { - runTestList(null, test_pack, test_cases); + runTestList(null, null, test_pack, test_cases); + } + + protected void checkHost(AHost host) { + if (host instanceof RemoteHost) { + RemoteHost remote_host = (RemoteHost) host; + if (!remote_host.ensureConnected(cm)) + throw new IllegalStateException("unable to connect to remote host: "+remote_host.getAddress()+" "+remote_host); + } } - protected void runTestList(S test_pack, A active_test_pack, List<T> test_cases) throws Exception { + protected void ensureFileSystemScenario() { + if (file_scenario==null) + file_scenario = AbstractFileSystemScenario.getFileSystemScenario(scenario_set); + if (file_scenario instanceof AbstractRemoteFileSystemScenario) { + storage_host = ((AbstractRemoteFileSystemScenario)file_scenario).getRemoteHost(); + } + } + + /** + * + * @param test_cases_read + * @param test_cases - will be null if !test_cases_read + * @throws Exception + */ + protected ITestPackStorageDir doSetupStorageAndTestPack(boolean test_cases_read, @Nullable List<T> test_cases) throws Exception { + cm.println(EPrintType.IN_PROGRESS, getClass(), "preparing storage for test-pack..."); + + ensureFileSystemScenario(); + + // prepare storage + ITestPackStorageDir storage_dir = file_scenario.createStorageDir(cm, runner_host); + if (storage_dir == null) { + cm.println(EPrintType.CANT_CONTINUE, getClass(), "unable to prepare storage for test-pack, giving up!"); + close(); + return null; + } + // + + setupStorageAndTestPack(storage_dir, test_cases); + + return storage_dir; + } + + protected void runTestList(ITestPackStorageDir storage_dir, S test_pack, A active_test_pack, List<T> test_cases) throws Exception { if (test_cases.isEmpty()) { if (cm!=null) cm.println(EPrintType.COMPLETED_OPERATION, getClass(), "no test cases to run. did nothing."); @@ -118,14 +162,10 @@ public abstract class AbstractLocalTestPackRunner<A extends ActiveTestPack, S ex runner_state.set(ETestPackRunnerState.RUNNING); sapi_scenario = AbstractSAPIScenario.getSAPIScenario(scenario_set); - if (file_scenario==null) - file_scenario = AbstractFileSystemScenario.getFileSystemScenario(scenario_set); + ensureFileSystemScenario(); + checkHost(storage_host); + checkHost(runner_host); - if (storage_host instanceof RemoteHost) { - RemoteHost remote_host = (RemoteHost) storage_host; - if (!remote_host.ensureConnected(cm)) - throw new IllegalStateException("unable to connect to remote host: "+remote_host.getAddress()+" "+remote_host); - } // ensure all scenarios are implemented if (!scenario_set.isImplemented()) { @@ -138,18 +178,12 @@ public abstract class AbstractLocalTestPackRunner<A extends ActiveTestPack, S ex // for local file system, this is just a file copy. for other scenarios, its more complicated (let the filesystem scenario deal with it) cm.println(EPrintType.IN_PROGRESS, getClass(), "loaded tests: "+test_cases.size()); - cm.println(EPrintType.IN_PROGRESS, getClass(), "preparing storage for test-pack..."); - // prepare storage - ITestPackStorageDir storage_dir = file_scenario.createStorageDir(cm, runner_host); - if (storage_dir == null) { - cm.println(EPrintType.CANT_CONTINUE, getClass(), "unable to prepare storage for test-pack, giving up!"); - close(); + // ensure storage dir setup before proceeding + if (storage_dir==null) + storage_dir = doSetupStorageAndTestPack(true, test_cases); + if (storage_dir==null) return; - } - // - - setupStorageAndTestPack(storage_dir, test_cases); // // @@ -198,7 +232,7 @@ public abstract class AbstractLocalTestPackRunner<A extends ActiveTestPack, S ex } } // end public void runTestList - protected abstract void setupStorageAndTestPack(ITestPackStorageDir storage_dir, List<T> test_cases); + protected abstract void setupStorageAndTestPack(ITestPackStorageDir storage_dir, List<T> test_cases) throws IOException, Exception; public void close() { // don't kill procs we're debugging @@ -599,17 +633,28 @@ public abstract class AbstractLocalTestPackRunner<A extends ActiveTestPack, S ex @Override public void runAllTests(S test_pack) throws FileNotFoundException, IOException, Exception { + this.src_test_pack = test_pack; + ArrayList<T> test_cases = new ArrayList<T>(13000); test_pack.cleanup(cm); + // PhpUnit test-packs have their storage setup FIRST, then they are read from storage SECOND + // -PhpUnit sets up storage with this call to #doSetupStorageAndTestPack + // -PhpUnit ignores the second #doSetupStorageAndTestPack in #runTestList + // PHPT test-packs are read FIRST then have their storage setup SECOND + // -PHPT ignores this #doSetupStorageAndTestPack call + // -PHPT honors the second #doSetupStorageAndTestPack in #runTestList + ITestPackStorageDir storage_dir = doSetupStorageAndTestPack(false, null); + // storage_dir may be null + cm.println(EPrintType.IN_PROGRESS, getClass(), "enumerating test cases from test-pack..."); test_pack.read(test_cases, cm, twriter, build); cm.println(EPrintType.IN_PROGRESS, getClass(), "enumerated test cases."); - runTestList(test_pack, test_cases); + runTestList(storage_dir, test_pack, null, test_cases); } public void runAllTests(A test_pack) throws FileNotFoundException, IOException, Exception { diff --git a/src/com/mostc/pftt/runner/AbstractTestPackRunner.java b/src/com/mostc/pftt/runner/AbstractTestPackRunner.java index c91e1be..0d4ca5b 100644 --- a/src/com/mostc/pftt/runner/AbstractTestPackRunner.java +++ b/src/com/mostc/pftt/runner/AbstractTestPackRunner.java @@ -12,7 +12,8 @@ import com.mostc.pftt.scenario.ScenarioSet; public abstract class AbstractTestPackRunner<S extends SourceTestPack, T extends TestCase> { protected final PhpBuild build; - protected final AHost storage_host, runner_host; + protected AHost storage_host; + protected final AHost runner_host; protected final ScenarioSet scenario_set; public AbstractTestPackRunner(ScenarioSet scenario_set, PhpBuild build, AHost storage_host, AHost runner_host) { diff --git a/src/com/mostc/pftt/runner/LocalPhpUnitTestPackRunner.java b/src/com/mostc/pftt/runner/LocalPhpUnitTestPackRunner.java index 710b301..7d20843 100644 --- a/src/com/mostc/pftt/runner/LocalPhpUnitTestPackRunner.java +++ b/src/com/mostc/pftt/runner/LocalPhpUnitTestPackRunner.java @@ -5,6 +5,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.annotation.Nullable; + import org.apache.http.HttpRequestInterceptor; import org.apache.http.HttpVersion; import org.apache.http.params.HttpParams; @@ -31,7 +33,9 @@ import com.mostc.pftt.model.sapi.TestCaseGroupKey; import com.mostc.pftt.model.smoke.RequiredExtensionsSmokeTest; import com.mostc.pftt.results.ConsoleManager; 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.ScenarioSet; public class LocalPhpUnitTestPackRunner extends AbstractLocalTestPackRunner<PhpUnitActiveTestPack, PhpUnitSourceTestPack, PhpUnitTestCase> { @@ -66,11 +70,68 @@ public class LocalPhpUnitTestPackRunner extends AbstractLocalTestPackRunner<PhpU smgr = new ApacheManager(); } - + @Override - protected void setupStorageAndTestPack(ITestPackStorageDir storage_dir, List<PhpUnitTestCase> test_cases) { - // TODO + protected ITestPackStorageDir doSetupStorageAndTestPack(boolean test_cases_read, @Nullable List<PhpUnitTestCase> test_cases) throws Exception { + if (test_cases_read) { + + // TODO cm.println(EPrintType.IN_PROGRESS, getClass(), "installed tests("+test_cases.size()+") from test-pack onto storage: local="+local_test_pack_dir+" remote="+remote_test_pack_dir); + + return null; + } + return super.doSetupStorageAndTestPack(test_cases_read, test_cases); } + + protected String temp_base_dir; + @Override + protected void setupStorageAndTestPack(ITestPackStorageDir storage_dir, List<PhpUnitTestCase> test_cases) throws Exception { + if (!(storage_dir instanceof SMBStorageDir)) { + temp_base_dir = runner_host.getPhpSdkDir()+"/temp/"; + + active_test_pack = src_test_pack.installInPlace(cm, runner_host); + + return; + } + + // generate name of directory on that storage to store the copy of the test-pack + String local_test_pack_dir = null, remote_test_pack_dir = null; + { + String local_path = storage_dir.getLocalPath(storage_host); + String remote_path = storage_dir.getRemotePath(storage_host); + 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-" + src_test_pack.getName() + (i==0?"":"-" + millis) + "/"; + remote_test_pack_dir = remote_path + "/PFTT-" + src_test_pack.getName() + (i==0?"":"-" + millis) + "/"; + if (!storage_host.exists(remote_test_pack_dir) || !runner_host.exists(local_test_pack_dir)) + break; + millis++; + if (i%100==0) + millis = System.currentTimeMillis(); + } + } + // + + + cm.println(EPrintType.IN_PROGRESS, getClass(), "installing... test-pack onto storage: remote="+remote_test_pack_dir+" local="+local_test_pack_dir); + + try { + active_test_pack = src_test_pack.install(cm, storage_host, local_test_pack_dir, remote_test_pack_dir); + } catch ( Exception ex ) { + cm.addGlobalException(EPrintType.CANT_CONTINUE, "setupStorageAndTestPack", ex, "can't install test-pack"); + close(); + return; + } + + // notify storage + if (!storage_dir.notifyTestPackInstalled(cm, runner_host)) { + cm.println(EPrintType.CANT_CONTINUE, getClass(), "unable to prepare storage for test-pack, giving up!(2)"); + close(); + return; + } + + temp_base_dir = local_test_pack_dir + "/temp/"; + } // end protected void setupStorageAndTestPack @Override protected TestCaseGroupKey createGroupKey(PhpUnitTestCase test_case, TestCaseGroupKey group_key) throws Exception { @@ -107,7 +168,7 @@ public class LocalPhpUnitTestPackRunner extends AbstractLocalTestPackRunner<PhpU protected PhpUnitThread(boolean parallel) throws IllegalStateException, IOException { super(parallel); - my_temp_dir = runner_host.fixPath(runner_host.mktempname(runner_host.getPhpSdkDir()+"/temp/", getClass()) + "/"); + my_temp_dir = runner_host.fixPath(runner_host.mktempname(temp_base_dir, getClass()) + "/"); runner_host.mkdirs(my_temp_dir); } diff --git a/src/com/mostc/pftt/runner/LocalPhptTestPackRunner.java b/src/com/mostc/pftt/runner/LocalPhptTestPackRunner.java index 702ac50..757051d 100644 --- a/src/com/mostc/pftt/runner/LocalPhptTestPackRunner.java +++ b/src/com/mostc/pftt/runner/LocalPhptTestPackRunner.java @@ -6,6 +6,8 @@ import java.util.Comparator; import java.util.LinkedList; import java.util.List; +import javax.annotation.Nullable; + import com.github.mattficken.io.StringUtil; import com.mostc.pftt.host.AHost; import com.mostc.pftt.model.core.PhpBuild; @@ -34,6 +36,13 @@ public class LocalPhptTestPackRunner extends AbstractLocalTestPackRunner<PhptAct } @Override + protected ITestPackStorageDir doSetupStorageAndTestPack(boolean test_cases_read, @Nullable List<PhptTestCase> test_cases) throws Exception { + if (!test_cases_read) + return null; + return super.doSetupStorageAndTestPack(test_cases_read, test_cases); + } + + @Override protected void setupStorageAndTestPack(ITestPackStorageDir storage_dir, List<PhptTestCase> test_cases) { // generate name of directory on that storage to store the copy of the test-pack String local_test_pack_dir = null, remote_test_pack_dir = null; @@ -63,7 +72,7 @@ public class LocalPhptTestPackRunner extends AbstractLocalTestPackRunner<PhptAct try { // if -auto or -phpt-not-in-place console option, copy test-pack and run phpts from that copy if (!cm.isPhptNotInPlace() && file_scenario.allowPhptInPlace()) - active_test_pack = src_test_pack.installInPlace(); + active_test_pack = src_test_pack.installInPlace(cm, runner_host); else // copy test-pack onto (remote) file system active_test_pack = src_test_pack.install(cm, storage_host, local_test_pack_dir, remote_test_pack_dir); diff --git a/src/com/mostc/pftt/scenario/AbstractCodeCacheScenario.java b/src/com/mostc/pftt/scenario/AbstractCodeCacheScenario.java index cf23e8f..63dac4f 100644 --- a/src/com/mostc/pftt/scenario/AbstractCodeCacheScenario.java +++ b/src/com/mostc/pftt/scenario/AbstractCodeCacheScenario.java @@ -6,7 +6,7 @@ public abstract class AbstractCodeCacheScenario extends AbstractINIScenario { public static final WinCacheScenario WINCACHE = new WinCacheScenario(); public static final NoCodeCacheScenario NO = new NoCodeCacheScenario(); public static final APCScenario APC = new APCScenario(); - public static final ZendOptimizerPlusScenario ZEND_OPTIMIZER_PLUS = new ZendOptimizerPlusScenario(); + public static final OptimizerPlusScenario ZEND_OPTIMIZER_PLUS = new OptimizerPlusScenario(); @Override public Class<?> getSerialKey() { diff --git a/src/com/mostc/pftt/scenario/AbstractRemoteFileSystemScenario.java b/src/com/mostc/pftt/scenario/AbstractRemoteFileSystemScenario.java index b663bd2..31dcfdc 100644 --- a/src/com/mostc/pftt/scenario/AbstractRemoteFileSystemScenario.java +++ b/src/com/mostc/pftt/scenario/AbstractRemoteFileSystemScenario.java @@ -1,5 +1,6 @@ package com.mostc.pftt.scenario; +import com.mostc.pftt.host.AHost; import com.mostc.pftt.host.Host; import com.mostc.pftt.model.core.PhpBuild; import com.mostc.pftt.results.ConsoleManager; @@ -18,5 +19,7 @@ public abstract class AbstractRemoteFileSystemScenario extends AbstractFileSyste public boolean isUACRequiredForSetup() { return true; } + + public abstract AHost getRemoteHost(); } diff --git a/src/com/mostc/pftt/scenario/AbstractSMBScenario.java b/src/com/mostc/pftt/scenario/AbstractSMBScenario.java index c927819..a65398e 100644 --- a/src/com/mostc/pftt/scenario/AbstractSMBScenario.java +++ b/src/com/mostc/pftt/scenario/AbstractSMBScenario.java @@ -46,6 +46,11 @@ public abstract class AbstractSMBScenario extends AbstractRemoteFileSystemScenar } @Override + public AHost getRemoteHost() { + return remote_host; + } + + @Override public boolean allowPhptInPlace() { // always make sure test-pack is installed onto SMB Share // otherwise, there wouldn't be a point in testing on SMB @@ -222,10 +227,24 @@ public abstract class AbstractSMBScenario extends AbstractRemoteFileSystemScenar if (dir.local_path==null) return false; - String cmd = "NET USE "+dir.local_path+" "+dir.unc_path+" /user:"+remote_host.getUsername()+" "+remote_host.getPassword(); + // /Y => or could get prompted to restore connection from previous Windows login session + String cmd = "NET USE "+dir.local_path+" "+dir.unc_path+" /Y /user:"+remote_host.getUsername()+" "+remote_host.getPassword(); - return local_host.execElevated(cm, getClass(), cmd, AHost.ONE_MINUTE); - } + if (local_host.execElevatedOut(cmd, AHost.ONE_MINUTE).printOutputIfCrash(getClass(), cm).isSuccess()) { + // wait until drive becomes available (sometimes it might take a second after `net use` implies its available) + for (int i=0 ; ; i++) { + if (new File(dir.local_path+"/").exists()) { + return true; + } else if (i >= 20) { + throw new RuntimeException("network drive did not become available after waiting: "+dir.local_path); + } + Thread.sleep(500); + i++; + } + } + // drive not mounted + return false; + } // end protected boolean connectFromWindows protected boolean connectFromSamba(SMBStorageDir dir, ConsoleManager cm) { // XXX diff --git a/src/com/mostc/pftt/scenario/ApplicationScenario.java b/src/com/mostc/pftt/scenario/ApplicationScenario.java index cb82a1a..4758172 100644 --- a/src/com/mostc/pftt/scenario/ApplicationScenario.java +++ b/src/com/mostc/pftt/scenario/ApplicationScenario.java @@ -10,6 +10,10 @@ public abstract class ApplicationScenario extends AbstractSerialScenario { return ApplicationScenario.class; } + public boolean ignoreForShortName() { + return false; + } + @Override public boolean isUACRequiredForStart() { return true; diff --git a/src/com/mostc/pftt/scenario/OptimizerPlusScenario.java b/src/com/mostc/pftt/scenario/OptimizerPlusScenario.java new file mode 100644 index 0000000..2742dba --- /dev/null +++ b/src/com/mostc/pftt/scenario/OptimizerPlusScenario.java @@ -0,0 +1,68 @@ +package com.mostc.pftt.scenario; + +import com.mostc.pftt.host.Host; +import com.mostc.pftt.model.core.EAcceleratorType; +import com.mostc.pftt.model.core.PhpBuild; +import com.mostc.pftt.model.core.PhpIni; +import com.mostc.pftt.results.ConsoleManager; + +/** The Optimizer+ provides faster PHP execution through opcode caching and optimization. + * It improves PHP performance by storing precompiled script bytecode in the shared memory. This + * eliminates the stages of reading code from the disk and compiling it on future access. In + * addition, it applies a few bytecode optimization patterns that make code execution faster. + * + * Formerly known as Zend Optimizer+, often abbreviated as o+ or zo+ + * + * @see https://github.com/zend-dev/ZendOptimizerPlus + * @see https://github.com/OSTC/ZendOptimizerPlus - fork for Windows/PHP on Windows + * + */ + +public class OptimizerPlusScenario extends AbstractCodeCacheScenario { + + @Override + public String getNameWithVersionInfo() { + return "OptimizerPlus"; // XXX version + } + + @Override + public EAcceleratorType getAcceleratorType() { + return EAcceleratorType.OPTIMIZER_PLUS; + } + + @Override + public boolean setup(ConsoleManager cm, Host host, PhpBuild build, PhpIni ini) { + // assume SO is in same directory as PHP extensions + String dll_path = ini.getExtensionDir() + "/php_ZendOptimizerPlus." + (host.isWindows() ? "dll" : "so" ); + + // must be absolute path to ZendOptimizerPlus.so + ini.putMulti("zend_extension", dll_path); + + // CRITICAL: for CliScenario + ini.putSingle("zend_optimizerplus.enable_cli", 1); + + // recommended settings, @see https://github.com/zend-dev/ZendOptimizerPlus + // (recommended settings differ from some of the documented default settings) + ini.putSingle("zend_optimizerplus.memory_consumption", 128); + ini.putSingle("zend_optimizerplus.interned_strings_buffer", 8); + ini.putSingle("zend_optimizerplus.max_accelerated_files", 4000); + ini.putSingle("zend_optimizerplus.revalidate_freq", 60); + ini.putSingle("zend_optimizerplus.save_comments", 0); + ini.putSingle("zend_optimizerplus.fast_shutdown", 1); + ini.putSingle("zend_optimizerplus.enable_file_override", 1); + + return true; + } + + @Override + public String getName() { + // use 'plus' instead of + symbol which may cause problems (ex: on certain filesystems) + return "OptimizerPlus"; + } + + @Override + public boolean isImplemented() { + return true; + } + +} // end public class ZendOptimizerPlusScenario diff --git a/src/com/mostc/pftt/scenario/SMBBasicScenario.java b/src/com/mostc/pftt/scenario/SMBBasicScenario.java index 990f3f0..b2583c0 100644 --- a/src/com/mostc/pftt/scenario/SMBBasicScenario.java +++ b/src/com/mostc/pftt/scenario/SMBBasicScenario.java @@ -16,6 +16,10 @@ public class SMBBasicScenario extends AbstractSMBScenario { public SMBBasicScenario(RemoteHost remote_host) { this(remote_host, null, null); } + + public SMBBasicScenario(RemoteHost remote_host, String base_file_path) { + this(remote_host, base_file_path, null); + } public SMBBasicScenario(RemoteHost remote_host, String base_file_path, String base_share_name) { super(remote_host, base_file_path, base_share_name); diff --git a/src/com/mostc/pftt/scenario/SMBDFSScenario.java b/src/com/mostc/pftt/scenario/SMBDFSScenario.java index 3274aeb..f3c560e 100644 --- a/src/com/mostc/pftt/scenario/SMBDFSScenario.java +++ b/src/com/mostc/pftt/scenario/SMBDFSScenario.java @@ -38,6 +38,10 @@ public class SMBDFSScenario extends AbstractSMBScenario { this(remote_host, null, "PFTT-TARGET", "PFTT-NS", "PFTT-NS", "PFTT-DFS"); } + public SMBDFSScenario(RemoteHost remote_host, String base_file_path) { + this(remote_host, base_file_path, "PFTT-TARGET", "PFTT-NS", "PFTT-NS", "PFTT-DFS"); + } + public SMBDFSScenario(RemoteHost remote_host, String base_file_path, String base_share_name, String base_remote_namespace, String base_namespace, String base_folder) { super(remote_host, base_file_path, base_share_name); diff --git a/src/com/mostc/pftt/scenario/ZendOptimizerPlusScenario.java b/src/com/mostc/pftt/scenario/ZendOptimizerPlusScenario.java deleted file mode 100644 index 8838790..0000000 --- a/src/com/mostc/pftt/scenario/ZendOptimizerPlusScenario.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.mostc.pftt.scenario; - -import com.mostc.pftt.host.Host; -import com.mostc.pftt.model.core.EAcceleratorType; -import com.mostc.pftt.model.core.PhpBuild; -import com.mostc.pftt.model.core.PhpIni; -import com.mostc.pftt.results.ConsoleManager; - -/** The Zend Optimizer+ provides faster PHP execution through opcode caching and optimization. - * It improves PHP performance by storing precompiled script bytecode in the shared memory. This - * eliminates the stages of reading code from the disk and compiling it on future access. In - * addition, it applies a few bytecode optimization patterns that make code execution faster. - * - * @see https://github.com/zend-dev/ZendOptimizerPlus - * @see https://github.com/OSTC/ZendOptimizerPlus - fork for Windows/PHP on Windows - * - */ - -public class ZendOptimizerPlusScenario extends AbstractCodeCacheScenario { - - @Override - public String getNameWithVersionInfo() { - return "ZendOptimizer+"; // XXX version - } - - @Override - public EAcceleratorType getAcceleratorType() { - return EAcceleratorType.ZEND_OPTIMIZER_PLUS; - } - - @Override - public boolean setup(ConsoleManager cm, Host host, PhpBuild build, PhpIni ini) { - // assume SO is in same directory as PHP extensions - String dll_path = ini.getExtensionDir() + "/ZendOptimizerPlus." + (host.isWindows() ? "dll" : "so" ); - - // must be absolute path to ZendOptimizerPlus.so - ini.putMulti("zend_extension", dll_path); - - // CRITICAL: for CliScenario - ini.putSingle("zend_optimizerplus.enable_cli", 1); - - // recommended settings, @see https://github.com/zend-dev/ZendOptimizerPlus - // (recommended settings differ from some of the documented default settings) - ini.putSingle("zend_optimizerplus.memory_consumption", 128); - ini.putSingle("zend_optimizerplus.interned_strings_buffer", 8); - ini.putSingle("zend_optimizerplus.max_accelerated_files", 4000); - ini.putSingle("zend_optimizerplus.revalidate_freq", 60); - ini.putSingle("zend_optimizerplus.save_comments", 0); - ini.putSingle("zend_optimizerplus.fast_shutdown", 1); - ini.putSingle("zend_optimizerplus.enable_file_override", 1); - - return true; - } - - @Override - public String getName() { - // use 'plus' instead of + symbol which may cause problems (ex: on certain filesystems) - return "ZendOptimizerPlus"; - } - - @Override - public boolean isImplemented() { - return true; - } - -} // end public class ZendOptimizerPlusScenario