Commit:    fbf6589a25163f8ea175a3820a9858a145f1995c
Author:    Holly Li (WIPRO LIMITED) <v-hu...@microsoft.com>         Fri, 26 Jul 
2019 17:33:16 -0700
Committer: Christoph M. Becker <cmbecke...@gmx.de>      Sat, 27 Jul 2019 
09:23:06 +0200
Parents:   7c40ee87a37e52bcfe479bf2bc2261db4869d08d
Branches:  master

Link:       
http://git.php.net/?p=pftt2.git;a=commitdiff;h=fbf6589a25163f8ea175a3820a9858a145f1995c

Log:
1. aways evaluate skipif section, 2.Support xfail in SKIPIF sections

Changed paths:
  M  src/com/mostc/pftt/model/core/PhptTestCase.java
  M  src/com/mostc/pftt/runner/AbstractPhptTestCaseRunner.java
  M  src/com/mostc/pftt/runner/AbstractPhptTestCaseRunner2.java


Diff:
diff --git a/src/com/mostc/pftt/model/core/PhptTestCase.java 
b/src/com/mostc/pftt/model/core/PhptTestCase.java
index 9ebb82e..16d2bd9 100644
--- a/src/com/mostc/pftt/model/core/PhptTestCase.java
+++ b/src/com/mostc/pftt/model/core/PhptTestCase.java
@@ -132,6 +132,7 @@ public class PhptTestCase extends TestCase {
        private CharsetEncoder ce;
        public boolean redo = false; // TODO temp
        public PreparedPhptTestCase prep; // TODO temp
+       public boolean skipifAsXfail = false;
        
        /** loads the named PHPT test from the given PhptSourceTestPack
         * 
@@ -435,7 +436,8 @@ public class PhptTestCase extends TestCase {
         * @return
         */
        public boolean isXFail() {
-               return containsSection(EPhptSection.XFAIL);
+               return containsSection(EPhptSection.XFAIL)
+                               || (containsSection(EPhptSection.SKIPIF) && 
this.skipifAsXfail);
        }
                
        /** returns the expected output as a string
diff --git a/src/com/mostc/pftt/runner/AbstractPhptTestCaseRunner.java 
b/src/com/mostc/pftt/runner/AbstractPhptTestCaseRunner.java
index a73b638..7917690 100644
--- a/src/com/mostc/pftt/runner/AbstractPhptTestCaseRunner.java
+++ b/src/com/mostc/pftt/runner/AbstractPhptTestCaseRunner.java
@@ -127,51 +127,14 @@ public abstract class AbstractPhptTestCaseRunner extends 
AbstractTestCaseRunner<
                if (!prepare())
                        // test is SKIP BORK EXCEPTION etc...
                        return;
+               
                if (prep.skipif_file!=null) {
-                       String skipif_code = 
prep.test_case.get(EPhptSection.SKIPIF).toLowerCase(); 
-                       if (!skipif_code.contains("include") && 
!skipif_code.contains("PHP_SAPI") && !skipif_code.contains("require")) {
-                               if (host.isWindows() && 
skipif_code.contains("skip non-windows only test")||skipif_code.contains("skip 
not for windows")||skipif_code.contains("not valid for windows")) {
-                                       twriter.addResult(host, scenario_set, 
src_test_pack, new PhptTestResult(host, EPhptTestStatus.SKIP, prep.test_case, 
skipif_code, null, null, null, ini, null, null, null, null, null, null, null));
-                                       return;
-                               } else if (!host.isX64() && 
skipif_code.contains("skip this test is for 64bit platform only")) {
-                                       twriter.addResult(host, scenario_set, 
src_test_pack, new PhptTestResult(host, EPhptTestStatus.SKIP, prep.test_case, 
skipif_code, null, null, null, ini, null, null, null, null, null, null, null));
-                                       return;
-                               }
-                               
-                               // avoid starting PHP process just to call 
extension_loaded();
-                               //
-                               // if we got here, SAPIScenario#willSkip was 
already called for this test case,
-                               //   which would have prevented getting here if 
the extension wasn't loaded
-                               // 
-                               // therefore, don't need to start PHP process 
just to check that again
-                               //
-                               // this has the additional effect that if the 
extension couldn't be loaded (corrupted DLL, etc...)
-                               //  the test case will be shown as a FAIL (so 
it'll be noticed, otherwise it would just be an increased SKIP count)
-                               if (skipif_code.contains("extension_loaded") && 
!skipif_code.contains("PHP_INT_SIZE")) {
-                                       // extension is already loaded
-                                       if (prep.test_case.isExtensionTest()
-                                                       
&&!ini.hasExtension(prep.test_case.getExtensionName())) {
-                                               // test of extension that is 
not loaded
-                                               //
-                                               // don't bother launching a 
process just to find that out
-                                               twriter.addResult(host, 
scenario_set, src_test_pack, new PhptTestResult(host, EPhptTestStatus.SKIP, 
prep.test_case, skipif_code, null, null, null, ini, null, null, null, null, 
null, null, null));
-                                               return;
-                                       }
-                               } else {
-                                       current_section = EPhptSection.SKIPIF; 
// @see #getSAPIOutput
-                                       if ( evalSkipIf(executeSkipIf()) ) {
-                                               return;
-                                       }
-                               }
-                       } else {
-                               current_section = EPhptSection.SKIPIF; // @see 
#getSAPIOutput
-                               if ( evalSkipIf(executeSkipIf()) ) {
-                                       return;
-                               }
+                       current_section = EPhptSection.SKIPIF; // @see 
#getSAPIOutput
+                       if ( evalSkipIf(executeSkipIf()) ) {
+                               return;
                        }
                }
                
-               
                current_section = EPhptSection.TEST; // @see #getSAPIOutput
                // no SKIPIF section or executed SKIPIF says to execute the 
TEST section
                prepareTest();
@@ -296,6 +259,12 @@ public abstract class AbstractPhptTestCaseRunner extends 
AbstractTestCaseRunner<
                        // skip this test
                        return true;
                }
+               
+               // Support xfail in SKIPIF sections
+               if(lc_output.contains("xfail"))
+               {
+                       prep.test_case.skipifAsXfail = true;
+               }
 
                // execute this test, don't skip it
                return false;
diff --git a/src/com/mostc/pftt/runner/AbstractPhptTestCaseRunner2.java 
b/src/com/mostc/pftt/runner/AbstractPhptTestCaseRunner2.java
index 6e649fa..03dbef6 100644
--- a/src/com/mostc/pftt/runner/AbstractPhptTestCaseRunner2.java
+++ b/src/com/mostc/pftt/runner/AbstractPhptTestCaseRunner2.java
@@ -69,41 +69,11 @@ public abstract class AbstractPhptTestCaseRunner2 extends 
AbstractPhptTestCaseRu
                if (!prepare())
                        // test is SKIP BORK EXCEPTION etc...
                        return;
+               
                if (prep.skipif_file!=null) {
-                       String skipif_code = 
prep.test_case.get(EPhptSection.SKIPIF).toLowerCase(); 
-                       if (!skipif_code.contains("include") && 
!skipif_code.contains("PHP_SAPI") && !skipif_code.contains("require")) {
-                               if (host.isWindows() && 
skipif_code.contains("skip not for windows")||skipif_code.contains("not valid 
for windows")) {
-                                       twriter.addResult(host, scenario_set, 
src_test_pack, new PhptTestResult(host, EPhptTestStatus.SKIP, prep.test_case, 
skipif_code, null, null, null, ini, null, null, null, null, null, null, null));
-                                       return;
-                               } else if (!host.isX64() && 
skipif_code.contains("skip this test is for 64bit platform only")) {
-                                       twriter.addResult(host, scenario_set, 
src_test_pack, new PhptTestResult(host, EPhptTestStatus.SKIP, prep.test_case, 
skipif_code, null, null, null, ini, null, null, null, null, null, null, null));
-                                       return;
-                               }
-                               
-                               // avoid starting PHP process just to call 
extension_loaded();
-                               //
-                               // if we got here, SAPIScenario#willSkip was 
already called for this test case,
-                               //   which would have prevented getting here if 
the extension wasn't loaded
-                               // 
-                               // therefore, don't need to start PHP process 
just to check that again
-                               //
-                               // this has the additional effect that if the 
extension couldn't be loaded (corrupted DLL, etc...)
-                               //  the test case will be shown as a FAIL (so 
it'll be noticed, otherwise it would just be an increased SKIP count)
-                               if (skipif_code.contains("extension_loaded(")) {
-                                       // extension is already loaded
-                               } else {
-                                       current_section = EPhptSection.SKIPIF; 
// @see #getSAPIOutput
-                                       if ( evalSkipIf(executeSkipIf()) ) {
-                                               twriter.addResult(host, 
scenario_set, src_test_pack, new PhptTestResult(host, EPhptTestStatus.SKIP, 
prep.test_case, skipif_code, null, null, null, ini, null, null, null, null, 
null, null, null));
-                                               return;
-                                       }
-                               }
-                       } else {
-                               current_section = EPhptSection.SKIPIF; // @see 
#getSAPIOutput
-                               if ( evalSkipIf(executeSkipIf()) ) {
-                                       twriter.addResult(host, scenario_set, 
src_test_pack, new PhptTestResult(host, EPhptTestStatus.SKIP, prep.test_case, 
skipif_code, null, null, null, ini, null, null, null, null, null, null, null));
-                                       return;
-                               }
+                       current_section = EPhptSection.SKIPIF; // @see 
#getSAPIOutput
+                       if ( evalSkipIf(executeSkipIf()) ) {
+                               return;
                        }
                }
                
@@ -243,6 +213,12 @@ public abstract class AbstractPhptTestCaseRunner2 extends 
AbstractPhptTestCaseRu
                        // skip this test
                        return true;
                }
+               
+               // Support xfail in SKIPIF sections
+               if(lc_output.contains("xfail"))
+               {
+                       prep.test_case.skipifAsXfail = true;
+               }
 
                // execute this test, don't skip it
                return false;

Reply via email to