com pftt2: Issue #19: Have pftt delete the files created to run the test if the test passes.: .classpath
src/com/mostc/pftt/model/core/PhptSourceTestPack.java src/com/mostc/pftt/runner/AbstractPhptTestCaseRunner.java
src/com/mostc/pftt/runner/PhptTestPreparer.java
| From: | Anatol Belski | Date: | Tue, 07 May 2019 19:34:32 +0000 |
| Subject: | com pftt2: Issue #19: Have pftt delete the files created to run the test if the test passes.: .classpath src/com/mostc/pftt/model/core/PhptSourceTestPack.java src/com/mostc/pftt/runner/AbstractPhptTestCaseRunner.java src/com/mostc/pftt/runner/PhptTestPreparer.java |
||
| Groups: | php.qa | ||
| Request: | Send a blank email to php-qa+get-68494@lists.php.net to get a copy of this message | ||
Commit: cfbda5e1297236fc74c183d96422f277d26f0915
Author: Allen Truong <v-altruo@microsoft.com> Wed, 1 May 2019 12:07:04 -0700
Committer: Anatol Belski <ab@php.net> Tue, 7 May 2019 21:34:32 +0200
Parents: b1704f17dd71abd5d4b8064019f5ecd9fcd9e9d5
Branches: master
Link: http://git.php.net/?p=pftt2.git;a=commitdiff;h=cfbda5e1297236fc74c183d96422f277d26f0915
Log:
Issue #19: Have pftt delete the files created to run the test if the test passes.
Bugs:
https://bugs.php.net/19
Changed paths:
M .classpath
M src/com/mostc/pftt/model/core/PhptSourceTestPack.java
M src/com/mostc/pftt/runner/AbstractPhptTestCaseRunner.java
M src/com/mostc/pftt/runner/PhptTestPreparer.java
Diff:
diff --git a/.classpath b/.classpath
index 75579dd..4d802ae 100644
--- a/.classpath
+++ b/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry
excluding="com/mostc/pftt/scenario/AzureWebsitesScenario.java|com/mostc/pftt/scenario/AzureKuduVFSScenario.java"
kind="src" path="src"/>
+ <classpathentry excluding="com/mostc/pftt/scenario/AzureWebsitesScenario.java"
kind="src" path="src"/>
<classpathentry exported="true" kind="lib"
path="lib/htmlcleaner-2.2.jar"/>
<classpathentry exported="true" kind="lib"
path="lib/icu4j-49_1.jar"/>
<classpathentry exported="true" kind="lib"
path="lib/icudata.jar"/>
diff --git a/src/com/mostc/pftt/model/core/PhptSourceTestPack.java
b/src/com/mostc/pftt/model/core/PhptSourceTestPack.java
index 693ad8d..aeca356 100644
--- a/src/com/mostc/pftt/model/core/PhptSourceTestPack.java
+++ b/src/com/mostc/pftt/model/core/PhptSourceTestPack.java
@@ -142,6 +142,7 @@ public class PhptSourceTestPack extends SourceTestPack<PhptActiveTestPack,
PhptT
fs.deleteFileExtension(test_pack, ".skip.php");
fs.deleteFileExtension(test_pack, ".cmd");
fs.deleteFileExtension(test_pack, "..sh");
+ fs.deleteFileExtension(test_pack, ".clean.php");
fs.deleteFileExtension(test_pack, ".tmp");
// don't delete .php (specifically run-test.php) in root of test-pack (user may want it
later)
IFileChooser PHP_CHOOSER = new IFileChooser() {
diff --git a/src/com/mostc/pftt/runner/AbstractPhptTestCaseRunner.java
b/src/com/mostc/pftt/runner/AbstractPhptTestCaseRunner.java
index 5c2bf4b..657c143 100644
--- a/src/com/mostc/pftt/runner/AbstractPhptTestCaseRunner.java
+++ b/src/com/mostc/pftt/runner/AbstractPhptTestCaseRunner.java
@@ -210,21 +210,25 @@ public abstract class AbstractPhptTestCaseRunner extends
AbstractTestCaseRunner<
// some tests create files/dirs which, which will cause the test to fail again
// if its run in-place from the same test-pack
- if (!cm.isPhptNotInPlace()&&prep.test_clean!=null&&!host.isBusy()) {
+ if (!cm.isPhptNotInPlace()&&prep.test_clean!=null) {
current_section = EPhptSection.CLEAN; // @see #getSAPIOutput
- executeClean(); // #executeClean != #doRunTestClean
+ executeClean(); // clean based on test file
+ }
+
+ // if test passed, remove files created to run the test
+ if(result.status.name() == EPhptTestStatus.PASS.toString()) {
+ removeTempFiles();
}
}
-
- if (!host.isBusy())
- doRunTestClean(cm);
}
protected void redoCrashedTest() throws Exception {
}
- protected void doRunTestClean(ConsoleManager cm) throws IllegalStateException, IOException {
-
+ protected void removeTempFiles() throws IllegalStateException, IOException {
+ fs.deleteIfExists(prep.test_clean);
+ fs.deleteIfExists(prep.test_file);
+ fs.deleteIfExists(prep.test_dir + "\\" + prep.base_file_name + ".php.cmd");
}
/** prepares to execute the test case up to executing the SKIPIF section
diff --git a/src/com/mostc/pftt/runner/PhptTestPreparer.java
b/src/com/mostc/pftt/runner/PhptTestPreparer.java
index a38328d..73440f5 100644
--- a/src/com/mostc/pftt/runner/PhptTestPreparer.java
+++ b/src/com/mostc/pftt/runner/PhptTestPreparer.java
@@ -9,6 +9,7 @@ import com.mostc.pftt.model.core.EPhptSection;
import com.mostc.pftt.model.core.PhptActiveTestPack;
import com.mostc.pftt.model.core.PhptSourceTestPack;
import com.mostc.pftt.model.core.PhptTestCase;
+import com.mostc.pftt.scenario.AzureKuduVFSScenario;
// TODO import com.mostc.pftt.scenario.AzureWebsitesScenario;
import com.mostc.pftt.scenario.FileSystemScenario;
@@ -56,9 +57,9 @@ public class PhptTestPreparer {
if (test_case.containsSection(EPhptSection.CLEAN)) {
prep.test_clean = host.joinIntoOnePath(prep.test_dir, prep.base_file_name +
".clean.php");
- /* TODO if (!AzureWebsitesScenario.check(fs)) {
+ if (!(fs instanceof AzureKuduVFSScenario)) {
fs.saveTextFile(prep.test_clean, test_case.get(EPhptSection.CLEAN));
- } */
+ }
} // else test_clean = null;
return prep;