You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by mb...@apache.org on 2023/03/13 20:45:22 UTC

[netbeans] branch master updated: bump php job to test on JDK 11 and fix failing tests

This is an automated email from the ASF dual-hosted git repository.

mbien pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new 2bfd123215 bump php job to test on JDK 11 and fix failing tests
     new 34f1b48f8b Merge pull request #5658 from mbien/test-php-on-11
2bfd123215 is described below

commit 2bfd123215d39b7642a3c7256688d0e5e30fbfbe
Author: Michael Bien <mb...@gmail.com>
AuthorDate: Mon Mar 13 04:17:16 2023 +0100

    bump php job to test on JDK 11 and fix failing tests
    
    fix php folding test on JDK 11+ by opening the document in advance.
    
    FoldingScanner#folds calls source.getDocument(false) and receives non
    null values on JDK 8. On JDK 11+ however the document is null, which
    leads to test failures in FoldingTest#testPHPTags.
    
    This is likely a race condition which is more likely to occur on
    JDK 11+ since the test can be brute forced to passing on linux if
    restarted often enough.
---
 .github/workflows/main.yml                                        | 2 +-
 .../unit/src/org/netbeans/modules/csl/api/test/CslTestBase.java   | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index b2c61c4c52..3da769f0f7 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -2069,7 +2069,7 @@ jobs:
       DISPLAY: ":99.0"
     strategy:
       matrix:
-        java: [ '8' ]
+        java: [ '11' ]
         os: [ 'windows-2022', 'ubuntu-20.04' ]
       fail-fast: false
     steps:
diff --git a/ide/csl.api/test/unit/src/org/netbeans/modules/csl/api/test/CslTestBase.java b/ide/csl.api/test/unit/src/org/netbeans/modules/csl/api/test/CslTestBase.java
index 24a9c38266..2c97bab489 100644
--- a/ide/csl.api/test/unit/src/org/netbeans/modules/csl/api/test/CslTestBase.java
+++ b/ide/csl.api/test/unit/src/org/netbeans/modules/csl/api/test/CslTestBase.java
@@ -2145,6 +2145,14 @@ public abstract class CslTestBase extends NbTestCase {
 
         ParserManager.parse(Collections.singleton(testSource), new UserTask() {
             public @Override void run(ResultIterator resultIterator) throws Exception {
+
+                // FoldingScanner#folds calls source.getDocument(false) and receive non null values on JDK 8.
+                // On JDK 11+ however the document is null which leads to test failures in FoldingTest#testPHPTags.
+                // This is likely a race condition which is more likely to occur on JDK 11+ since the test can be
+                // brute forced to passing on linux if restarted often enough. 
+                // This fixes it by making sure the document is open before folds are computed
+                assertNotNull(resultIterator.getSnapshot().getSource().getDocument(true));
+                
                 StructureScanner analyzer = getStructureScanner();
                 assertNotNull("getStructureScanner must be implemented", analyzer);
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists