Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 579431

Summary: org.eclipse.modisco.jee.jsp.generation.tests.DiffGeneratedJspTest.testJspFileExistence fails for 2022-03
Product: [Modeling] MoDisco Reporter: Ed Willink <ed>
Component: MainAssignee: Project Inbox <modisco.web-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 10   
Whiteboard:
Bug Depends on: 479450    
Bug Blocks:    

Description Ed Willink CLA 2022-03-27 13:13:48 EDT
java.lang.AssertionError: 
Generated JSP files differ from original files 
Please check differences between source Directory /home/jenkins/agent/workspace/modisco-master/org.eclipse.modisco.jee.jsp.generation.tests/target/work/data/Jsp.org.eclipse.modisco.jee.jsp.generation.tests.DiffGeneratedJspTest
And generated directory /home/jenkins/agent/workspace/modisco-master/org.eclipse.modisco.jee.jsp.generation.tests/target/work/data/.metadata/.plugins/org.eclipse.modisco.jee.jsp.generation.tests/JspOutput
	at org.eclipse.modisco.jee.jsp.generation.tests.DiffGeneratedJspTest.testJspFileExistence(DiffGeneratedJspTest.java:91)

Reruning on branch-tests that archives everything

https://ci.eclipse.org/modisco/job/modisco-branch-tests/19/artifact/org.eclipse.modisco.jee.jsp.generation.tests/target/work/data/Jsp.org.eclipse.modisco.jee.jsp.generation.tests.DiffGeneratedJspTest/resources/jspAction.jsp

is

<%-- Comment JSP Element --%> <%@ include name="value"%> <%-- Comment JSP Root --%> <%@ include name="value"%> <%-- Comment JSP Forward --%> <%-- Comment JSP Params --%> <%-- Comment JSP Plugin --%> <%-- Comment3 --%> This is some content for the fallback tag text on top of jspbody <%@ include name="value"%> text on bottom of jspbody <%-- Comment JSP Root --%> <%@ include name="value"%> This is some text to test the jsp:text function 

whereas

https://ci.eclipse.org/modisco/job/modisco-branch-tests/19/artifact/org.eclipse.modisco.jee.jsp.generation.tests/target/work/data/.metadata/.plugins/org.eclipse.modisco.jee.jsp.generation.tests/JspOutput/resources/jspAction.jsp/*view*/

is

<jsp:elementname="value"name1="value1" />

<jsp:element name="value"name1="value1">
	<%-- Comment JSP Element --%>
	<%@ include name="value"%>
</jsp:element>

...

<jsp:text >
	This is some text to test the jsp:text function 
</jsp:text>

Fails to reproduce iin my workspace for which the content is consistent.

Looks like something has gone wrong with GenerateJsp.doGenerate
Comment 1 Ed Willink CLA 2022-03-28 04:56:28 EDT
(In reply to Ed Willink from comment #0)
> Fails to reproduce iin my workspace for which the content is consistent.

Attempting to use workspace interactively falls foul of Bug 579441, but once fixed, running org.eclipse.modisco.jee.jsp.generation.tests.DiffGeneratedJspTest as a JUnit plugin test works fine.

So:

2022-03 JUnit plugin Windows => ok
2022-03++ I-build Tycho/m2e Windows => ok
2022-03++ I-build Tycho/Jenkins Linux => bad

Looks like a Linux/Windows difference.

Need to develop stronger debugging interactively so that it can be run in branch-tests.
Comment 2 Ed Willink CLA 2022-03-28 05:41:33 EDT
(In reply to Ed Willink from comment #0)
> <%-- Comment JSP Element --%> <%@ include name="value"%> <%-- Comment JSP
...
> include name="value"%> This is some text to test the jsp:text function 

Oops not /*view*/

with /*view*/

<jsp:element name="value" name1="value1" />

<jsp:element name="value" name1="value1" >      
	   <%-- Comment JSP Element --%>
	   <%@ include name="value"%>        
</jsp:element>

...

<jsp:text>This is some text to test the jsp:text function </jsp:text>

---

some whitespsce differences are obvious but they occur in an ok run in my workspace.

After a bt of debugging, it turns out that the 'filecomparator' cannot cope with the whitespace anomalies and so has been trivialized to just a file name comparison. How can that be going wrong?

?? the ".." file ?? but then how did it ever work ??
Comment 3 Ed Willink CLA 2022-03-28 06:32:00 EDT
(In reply to Ed Willink from comment #1)
> Looks like a Linux/Windows difference.

No it does reproduc locally, but test failures do not fail the build so it loks like success. On Jenkins the attempt to find the testresults provides a gone-unstable fall-back.

With extra debugging the failure is

Original Jsp files location : C:\Users\ed\modisco-master2\git\org.eclipse.modisco\org.eclipse.modisco.jee.jsp.generation.tests\target\work\data\Jsp.org.eclipse.modisco.jee.jsp.generation.tests.DiffGeneratedJspTest
comparison of Jsp.org.eclipse.modisco.jee.jsp.generation.tests.DiffGeneratedJspTest and JspOutput
folders Jsp.org.eclipse.modisco.jee.jsp.generation.tests.DiffGeneratedJspTest and JspOutput do not have the same number of children (2, 1)
folders Jsp.org.eclipse.modisco.jee.jsp.generation.tests.DiffGeneratedJspTest and JspOutput are not equal.
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 6.192 s <<< FAILURE! - in org.eclipse.modisco.jee.jsp.generation.tests.AllTestsInUIThread
testJspFileExistence(org.eclipse.modisco.jee.jsp.generation.tests.DiffGeneratedJspTest)  Time elapsed: 6.161 s  <<< FAILURE!
java.lang.AssertionError: 
Generated JSP files differ from original files 

Jsp.org.eclipse.modisco.jee.jsp.generation.tests.DiffGeneratedJspTest has an extra

/org.eclipse.modisco.jee.jsp.generation.tests/target/work/data/Jsp.org.eclipse.modisco.jee.jsp.generation.tests.DiffGeneratedJspTest/.settings/org.eclipse.core.resources.prefs

whose content

eclipse.preferences.version=1
encoding/<project>=Cp1252

does not correspond to project settings.
Comment 4 Ed Willink CLA 2022-03-28 08:31:46 EDT
(In reply to Ed Willink from comment #3)
> Jsp.org.eclipse.modisco.jee.jsp.generation.tests.DiffGeneratedJspTest has an
> extra
...
> .settings/org.eclipse.core.resources.prefs

A bad m2e / Tycho handling of project resources copy would seem like the obvious culprit, but we're still using Tycho 2.1.0 so perhaps the only possibility is the platform I-build.

Ah! Bug 479450 is an increasingly contentious platform chanfe. The .settings/org.eclipse.core.resources.prefs is created by writeEncodingAfterOpen(monitor) in Project.open().
Comment 5 Ed Willink CLA 2022-03-28 11:19:24 EDT
(In reply to Ed Willink from comment #4)
> Ah! Bug 479450 is an increasingly contentious platform chanfe.

But actually a good one.

Ensuring that the MoDisco test ignores .settings is easy enough.

Pushed to master.