Commit: 67e9892364a10798fb9ef2498dd039a61898866d
Author: Matt Ficken <v-maf...@microsoft.com> Wed, 18 Sep 2013
15:07:13 -0700
Parents: 721bf60ca3d433dd6e218f25fef521471bc62192
Branches: master
Link:
http://git.php.net/?p=pftt2.git;a=commitdiff;h=67e9892364a10798fb9ef2498dd039a61898866d
Log:
adding `info` command
Changed paths:
A bin/info.cmd
M bin/pftt_shell.cmd
M bin/pftt_shell.sh
M bin/set_env.sh
M src/com/mostc/pftt/main/PfttMain.java
M src/com/mostc/pftt/model/core/PhpBuild.java
M src/com/mostc/pftt/results/PhpResultPack.java
M src/com/mostc/pftt/results/PhpResultPackWriter.java
diff --git a/bin/info.cmd b/bin/info.cmd
new file mode 100644
index 0000000..9880359
--- /dev/null
+++ b/bin/info.cmd
@@ -0,0 +1,3 @@
+@ECHO OFF
+REM windows doesn't do aliases, so have to make a batch script. see
`pftt_shell` on *nix
+pftt -ignore_unknown_option %* info %*
diff --git a/bin/pftt_shell.cmd b/bin/pftt_shell.cmd
index d831d42..e6e4202 100644
--- a/bin/pftt_shell.cmd
+++ b/bin/pftt_shell.cmd
@@ -26,7 +26,7 @@ CALL ^\php-sdk^\PFTT^\current^\bin^\set_env
@ECHO. ^|WMWMWMW^| ^|^>^>^>^>^>^>^>^>^>^>^>^>^>^> Php Full Test
Tool ^>^>^>^>^>^>^>^>^>^>^>^>^>:^>
@ECHO. `-------^| ^|--------------------------------------------'^^
@ECHO. ^\^\
-@ECHO. ^\)
+@ECHO. ^\) PFTT Shell - for testing the PHP Ecosystem
@ECHO.
ECHO Type `pftt ^<enter^>` to get help with PFTT. ^<tab^> for
auto-completion.
ECHO ^<F7^> for history. Control+C to interrupt. Right-click for copy/paste
menu.
@@ -46,7 +46,7 @@ ECHO tka_apache tka_php tka_windbg `net use`
stop
@ECHO.
ECHO Useful:
ECHO ls `start .` windbg npp clear
-ECHO php_sdk sleep pftt cat
+ECHO php_sdk sleep pftt cat info
@ECHO.
@prompt $t %COMPUTERNAME% $M$p$g
REM signal pftt.cmd to not run pftt with elevate ever
diff --git a/bin/pftt_shell.sh b/bin/pftt_shell.sh
index 0547d35..475fda4 100644
--- a/bin/pftt_shell.sh
+++ b/bin/pftt_shell.sh
@@ -15,7 +15,7 @@ echo app_all all_named app_list aa an al caua
smoke parse
echo ui_all ui_named ui_list ua un ul aua run-test
echo
echo Setup:
-echo lc setup
+echo lc setup info
echo
echo Cleanup:
echo tka_apache tka_php stop php_sdk
diff --git a/bin/set_env.sh b/bin/set_env.sh
index 15958aa..d407547 100644
--- a/bin/set_env.sh
+++ b/bin/set_env.sh
@@ -48,6 +48,9 @@ function core_named() {
function smoke() {
pftt -ignore_unknown_option $* smoke $*
}
+function info() {
+ pftt -ignore_unknown_option $* info $*
+}
alias aa=app_all
alias al=app_list
alias an=app_named
diff --git a/src/com/mostc/pftt/main/PfttMain.java
b/src/com/mostc/pftt/main/PfttMain.java
index f99357d..7342183 100644
--- a/src/com/mostc/pftt/main/PfttMain.java
+++ b/src/com/mostc/pftt/main/PfttMain.java
@@ -370,7 +370,8 @@ public class PfttMain {
// TODO fs test
.addRow("run-test <build> <test-pack> <full test
name,...>", "runs named tests using run-tests.php from test-pack")
.addRow("help", "")
- .addRow("smoke <build>", "smoke test a build");
+ .addRow("smoke <build>", "smoke test a build")
+ .addRow("info <build>", "returns phpinfo() for build
(using build/php.ini if present, otherwise uses default INI)");
if (LocalHost.isLocalhostWindows()) {
table.addRow("perf <build>", "performance test of
build")
.addRow("release_get <branch> <build-type>
<revision>", "download a build and test-pack snapshot release")
@@ -469,13 +470,6 @@ public class PfttMain {
System.out.println();
} // end protected static void help_all
- public void smoke() {
- // TODO
- System.err.println("Error: Not implemented");
- new RequiredExtensionsSmokeTest();
- new RequiredFeaturesSmokeTest();
- }
-
public void shell() {
IO io = new IO();
//
@@ -563,6 +557,36 @@ public class PfttMain {
}
} // end public void appList
+ public boolean smoke(PhpBuild build, Config config, PhpResultPackWriter
tmgr) {
+ for (ScenarioSet scenario_set : getScenarioSets(config,
EScenarioSetPermutationLayer.FUNCTIONAL_TEST_APPLICATION)) {
+ if (!cm.isSkipSmokeTests()) {
+ {
+ // TODO test running PHPTs on a build
that is missing a DLL that is
+ RequiredExtensionsSmokeTest test = new
RequiredExtensionsSmokeTest();
+ //
+ // on Windows, missing .DLLs from a php
build will cause a blocking winpop dialog msg to appear
+ // in such a case, the test will
timeout after 1 minute and then fail (stopping at that point is important)
+ // @see PhpBuild#getExtensionList
+ if (test.test(build, cm, host,
SAPIScenario.getSAPIScenario(scenario_set).getSAPIType(),
tmgr)==ESmokeTestStatus.FAIL) {
+ // if this test fails,
RequiredFeaturesSmokeTest will fail for sure
+
cm.println(EPrintType.CANT_CONTINUE, "Main", "Failed smoke test:
"+test.getName());
+
+ return false;
+ }
+ }
+ {
+ RequiredFeaturesSmokeTest test = new
RequiredFeaturesSmokeTest();
+ if (test.test(build, cm, host,
tmgr)==ESmokeTestStatus.FAIL) {
+
cm.println(EPrintType.CANT_CONTINUE, "Main", "Failed smoke test:
"+test.getName());
+
+ return false;
+ }
+ }
+ }
+ }
+ return true;
+ }
+
public void appAll(PhpBuild build, Config config, PhpResultPackWriter
tmgr) throws IOException, Exception {
ensureLocalhostPrepared(build);
@@ -580,32 +604,10 @@ public class PfttMain {
cm.println(EPrintType.CLUE, PfttMain.class,
"Writing Result-Pack: "+tmgr.getResultPackPath());
+ if (!smoke(build, config, tmgr))
+ break;
+
for (ScenarioSet scenario_set :
getScenarioSets(config,
EScenarioSetPermutationLayer.FUNCTIONAL_TEST_APPLICATION)) {
- if (!cm.isSkipSmokeTests()) {
- {
- // TODO test running
PHPTs on a build that is missing a DLL that is
-
RequiredExtensionsSmokeTest test = new RequiredExtensionsSmokeTest();
- //
- // on Windows, missing
.DLLs from a php build will cause a blocking winpop dialog msg to appear
- // in such a case, the
test will timeout after 1 minute and then fail (stopping at that point is
important)
- // @see
PhpBuild#getExtensionList
- if (test.test(build,
cm, host, SAPIScenario.getSAPIScenario(scenario_set).getSAPIType(),
tmgr)==ESmokeTestStatus.FAIL) {
- // if this test
fails, RequiredFeaturesSmokeTest will fail for sure
-
cm.println(EPrintType.CANT_CONTINUE, "Main", "Failed smoke test:
"+test.getName());
-
- break;
- }
- }
- {
-
RequiredFeaturesSmokeTest test = new RequiredFeaturesSmokeTest();
- if (test.test(build,
cm, host, tmgr)==ESmokeTestStatus.FAIL) {
-
cm.println(EPrintType.CANT_CONTINUE, "Main", "Failed smoke test:
"+test.getName());
-
- break;
- }
- }
- }
-
List<AHost> hosts = config.getHosts();
AHost host =
hosts.isEmpty()?this.host:hosts.get(0);
LocalPhpUnitTestPackRunner r = new
LocalPhpUnitTestPackRunner(cm, tmgr, scenario_set, build, host, host);
@@ -628,32 +630,9 @@ public class PfttMain {
hosts.add(this.host);
}
for ( int i=0 ; i < cm.getRunTestPack() ; i++ ) {
+ if (!smoke(build, config, tmgr))
+ break;
for ( ScenarioSet scenario_set :
getScenarioSets(config, EScenarioSetPermutationLayer.FUNCTIONAL_TEST_CORE) ) {
- if (!cm.isSkipSmokeTests()) {
- {
- // TODO test running PHPTs on a
build that is missing a DLL that is
- RequiredExtensionsSmokeTest
test = new RequiredExtensionsSmokeTest();
- //
- // on Windows, missing .DLLs
from a php build will cause a blocking winpop dialog msg to appear
- // in such a case, the test
will timeout after 1 minute and then fail (stopping at that point is important)
- // @see
PhpBuild#getExtensionList
- if (test.test(build, cm, host,
SAPIScenario.getSAPIScenario(scenario_set).getSAPIType(),
tmgr)==ESmokeTestStatus.FAIL) {
- // if this test fails,
RequiredFeaturesSmokeTest will fail for sure
-
cm.println(EPrintType.CANT_CONTINUE, "Main", "Failed smoke test:
"+test.getName());
-
- break;
- }
- }
- {
- RequiredFeaturesSmokeTest test
= new RequiredFeaturesSmokeTest();
- if (test.test(build, cm, host,
tmgr)==ESmokeTestStatus.FAIL) {
-
cm.println(EPrintType.CANT_CONTINUE, "Main", "Failed smoke test:
"+test.getName());
-
- break;
- }
- }
- }
-
//
for ( AHost storage_host : hosts ) {
LocalPhptTestPackRunner
test_pack_runner = new LocalPhptTestPackRunner(tmgr.getConsoleManager(), tmgr,
scenario_set, build, storage_host, host, config);
@@ -1302,10 +1281,12 @@ public class PfttMain {
LocalConsoleManager cm = new LocalConsoleManager();
// load config files
+ boolean config_default = true;
if (config_files.size()>0) {
config = Config.loadConfigFromFiles(cm,
(String[])config_files.toArray(new String[config_files.size()]));
if (config==null)
System.exit(-255);
+ config_default = false;
System.out.println("PFTT: Config: loaded
"+config_files);
} else {
File default_config_file = new File(new
LocalHost().getPfttConfDir()+"/default.groovy");
@@ -1481,7 +1462,7 @@ public class PfttMain {
help_all();
System.exit(-255);
return;
- } else if
(StringUtil.containsAnyCS(args[args_i], new String[]{"core_all", "core_named",
"core_list", "app_all", "app_named", "app_list", "ui_all", "ui_list",
"ui_named", "release_get", "release_list", "list_config"})) {
+ } else if
(StringUtil.containsAnyCS(args[args_i], new String[]{"core_all", "core_named",
"core_list", "app_all", "app_named", "app_list", "ui_all", "ui_list",
"ui_named", "release_get", "release_list", "list_config", "smoke", "info"})) {
if (args[args_i].endsWith("_"))
// for setup, lc
args[args_i] =
args[args_i].substring(0, args[args_i].length()-1);
@@ -1926,7 +1907,52 @@ public class PfttMain {
} else if (command.equals("smoke")) {
no_show_gui(show_gui, command);
- p.smoke();
+ if (args.length<=args_i+1) {
+ System.out.println("Usage:
smoke <path to PHP build(s);:>");
+ System.out.println("Usage:
smoke -config <config name> <path to PHP build(s);:>");
+ System.exit(-254);
+ return;
+ }
+
+ PhpBuild[] builds = newBuilds(cm,
p.host, args[args_i+1]);
+ for ( PhpBuild build : builds ) {
+ PhpResultPackWriter w =
p.getWriter(build);
+ if (p.smoke(build, config, w))
+
System.out.println("Smoke: smoke tests passed: "+build.getBuildPath());
+ else
+
System.out.println("Smoke: smoke tests FAILED: "+build.getBuildPath());
+ }
+ } else if (command.equals("info")) {
+ no_show_gui(show_gui, command);
+
+ if (args.length<=args_i+1) {
+ System.out.println("Usage: info
<path to PHP build(s);:>");
+ System.out.println("Usage: info
-config <config name> <path to PHP build(s);:>");
+
System.out.println("Tip(*nix|Windows) info <build> | more");
+ System.exit(-254);
+ return;
+ }
+
+ PhpBuild[] builds = newBuilds(cm,
p.host, args[args_i+1]);
+ for ( PhpBuild build : builds ) {
+ System.out.println(build);
+
System.out.println(build.getBuildPath());
+ System.out.println();
+ if
(p.host.exists(p.host.joinIntoOnePath(build.getBuildPath(), "php.ini"))) {
+
System.out.println("#Note: Using "+build.getBuildPath());
+
System.out.println(build.getPhpInfo(cm, p.host));
+ } else if (config_default) {
+
System.out.println("#Note: "+build.getBuildPath()+"/php.ini not found");
+
System.out.println("#Note: using PHP default INI values only! create php.ini or
use -config PFTT option");
+
System.out.println(build.getPhpInfo(cm, p.host));
+ } else {
+
System.out.println("#Note: "+build.getBuildPath()+"/php.ini not found");
+
System.out.println("#Note: using INI from given PFTT configuration files");
+ PhpIni ini =
RequiredExtensionsSmokeTest.createDefaultIniCopy(cm, p.host, build);
+
+
System.out.println(build.getPhpInfo(cm, ini, p.host));
+ }
+ }
} else if (command.equals("upgrade")) {
no_show_gui(show_gui, command);
diff --git a/src/com/mostc/pftt/model/core/PhpBuild.java
b/src/com/mostc/pftt/model/core/PhpBuild.java
index 0f47cd5..af81f87 100644
--- a/src/com/mostc/pftt/model/core/PhpBuild.java
+++ b/src/com/mostc/pftt/model/core/PhpBuild.java
@@ -610,6 +610,10 @@ public class PhpBuild extends SAPIManager {
* @throws Exception
*/
public String getPhpInfo(ConsoleManager cm, AHost host) throws
Exception {
+ return getPhpInfo(cm, null, host);
+ }
+
+ public String getPhpInfo(ConsoleManager cm, PhpIni ini, AHost host)
throws Exception {
String php_info;
if (this.php_info != null) {
php_info = this.php_info.get();
@@ -617,7 +621,7 @@ public class PhpBuild extends SAPIManager {
return php_info;
}
- PHPOutput eo = eval(host, "phpinfo();");
+ PHPOutput eo = eval(host, ini, "phpinfo();");
eo.printOutputIfCrash(Host.toContext(getClass(), "getPhpInfo"),
cm);
php_info = eo.output;
eo.cleanup(host);
diff --git a/src/com/mostc/pftt/results/PhpResultPack.java
b/src/com/mostc/pftt/results/PhpResultPack.java
index 593fac7..1d4c2a3 100644
--- a/src/com/mostc/pftt/results/PhpResultPack.java
+++ b/src/com/mostc/pftt/results/PhpResultPack.java
@@ -39,12 +39,16 @@ public abstract class PhpResultPack {
return parts[3]; // @see #makeName and
PhpBuildInfo#toStringWithoutBuildBranch
}
- protected static File makeName(PhptSourceTestPack src_test_pack, File
base, PhpBuildInfo build_info) throws Exception {
+ protected static File makeName(PhptSourceTestPack src_test_pack, File
base, PhpBuildInfo build_info, int i) throws Exception {
StringBuilder sb = new StringBuilder();
sb.append("/");
sb.append(build_info.getBuildBranch());
sb.append("-Result-Pack-");
sb.append(build_info.toStringWithoutBuildBranch());
+ if (i>1) {
+ sb.append("-");
+ sb.append(i);
+ }
if
(src_test_pack!=null&&src_test_pack.getNameAndVersionString()!=null&&src_test_pack.getNameAndVersionString().contains("sql"))
{
// TODO temp
diff --git a/src/com/mostc/pftt/results/PhpResultPackWriter.java
b/src/com/mostc/pftt/results/PhpResultPackWriter.java
index 2004458..6169a1d 100644
--- a/src/com/mostc/pftt/results/PhpResultPackWriter.java
+++ b/src/com/mostc/pftt/results/PhpResultPackWriter.java
@@ -128,7 +128,13 @@ public class PhpResultPackWriter extends PhpResultPack
implements ITestResultRec
this.local_host = local_host;
this.cm = cm;
this.build = build;
- this.telem_dir = new File(makeName(src_test_pack,
telem_base_dir, build_info).getAbsolutePath());
+ {
+ int i=1;
+ do {
+ this.telem_dir = new
File(makeName(src_test_pack, telem_base_dir, build_info, i).getAbsolutePath());
+ i++;
+ } while ( this.telem_dir.exists() );
+ }
this.telem_dir.mkdirs();
try {
@@ -166,7 +172,7 @@ public class PhpResultPackWriter extends PhpResultPack
implements ITestResultRec
};
writer_thread.start();
}
-
+
protected abstract class ResultQueueEntry {
public abstract void handle() throws IllegalArgumentException,
IllegalStateException, IOException;
}
--
PHP Quality Assurance Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php