Building on MacOS fails because some SWT related tests

13 views
Skip to first unread message

Mihai Nita

unread,
Aug 4, 2022, 11:52:31 AMAug 4
to Group: okapi-devel
Just using the normal shell batch script:

./deployment/maven/build.sh js fi

But happens even for the most simple maven install command:

mvn install

Environment:
macOS Monterey, 12.5
AdoptOpenJDK-11.0.11+9
Maven 6.3.6
Ant 1.10.7
bash

Do we really need SWT to test font mapping?
As long as the mapping itself does not depend on SWT, why would we need SWT to test it?

Am not trying to just make it work (by using -XstartOnFirstThread, for example), but trying to first understand why we need that kind of test.

See results below.

Thank you,
M.

=========

[INFO]
[INFO] --------------------< net.sf.okapi:build-okapi-ui >---------------------
[INFO] Building Okapi UI Build 1.44.0-SNAPSHOT                        [127/175]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0:enforce (enforce-maven) @ build-okapi-ui ---
[INFO]
[INFO] --- ph-javacc-maven-plugin:3.0.0:javacc (javacc) @ build-okapi-ui ---
[INFO] Skipping non-existing source directory: /Users/mnita/third_party/okapi/okapi.clean.build/okapi-ui/swt/src/main/javacc
[INFO]
[INFO] --- build-helper-maven-plugin:3.3.0:add-source (add-source) @ build-okapi-ui ---
[INFO] Source directory: /Users/mnita/third_party/okapi/okapi.clean.build/okapi-ui/swt/target/generated-sources/javacc added.
[INFO]
[INFO] --- maven-javadoc-plugin:3.3.2:jar (attach-javadocs) @ build-okapi-ui ---
[INFO] Not executing Javadoc as the project is not a Java classpath-capable package
[INFO]
[INFO] --- maven-source-plugin:3.2.1:jar-no-fork (attach-sources) @ build-okapi-ui ---
[INFO]
[INFO] --- maven-install-plugin:3.0.0-M1:install (default-install) @ build-okapi-ui ---
[INFO] Installing /Users/mnita/third_party/okapi/okapi.clean.build/okapi-ui/swt/pom.xml to /Users/mnita/.m2/repository/net/sf/okapi/build-okapi-ui/1.44.0-SNAPSHOT/build-okapi-ui-1.44.0-SNAPSHOT.pom
[INFO]
[INFO] ---------------------< net.sf.okapi:okapi-core-ui >---------------------
[INFO] Building Okapi Core UI 1.44.0-SNAPSHOT                         [128/175]
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for org.eclipse.platform:org.eclipse.swt:jar:3.119.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0:enforce (enforce-maven) @ okapi-core-ui ---
[INFO]
[INFO] --- ph-javacc-maven-plugin:3.0.0:javacc (javacc) @ okapi-core-ui ---
[INFO] Skipping non-existing source directory: /Users/mnita/third_party/okapi/okapi.clean.build/okapi-ui/swt/core-ui/src/main/javacc
[INFO]
[INFO] --- build-helper-maven-plugin:3.3.0:add-source (add-source) @ okapi-core-ui ---
[INFO] Source directory: /Users/mnita/third_party/okapi/okapi.clean.build/okapi-ui/swt/core-ui/target/generated-sources/javacc added.
[INFO]
[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ okapi-core-ui ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 4 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.10.1:compile (default-compile) @ okapi-core-ui ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 55 source files to /Users/mnita/third_party/okapi/okapi.clean.build/okapi-ui/swt/core-ui/target/classes
[INFO] /Users/mnita/third_party/okapi/okapi.clean.build/okapi-ui/swt/core-ui/src/main/java/net/sf/okapi/common/ui/filters/FilterConfigurationsPanel.java: Some input files use or override a deprecated API.
[INFO] /Users/mnita/third_party/okapi/okapi.clean.build/okapi-ui/swt/core-ui/src/main/java/net/sf/okapi/common/ui/filters/FilterConfigurationsPanel.java: Recompile with -Xlint:deprecation for details.
[INFO]
[INFO] --- maven-resources-plugin:3.2.0:testResources (default-testResources) @ okapi-core-ui ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] skip non existing resourceDirectory /Users/mnita/third_party/okapi/okapi.clean.build/okapi-ui/swt/core-ui/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.10.1:testCompile (default-testCompile) @ okapi-core-ui ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /Users/mnita/third_party/okapi/okapi.clean.build/okapi-ui/swt/core-ui/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:3.0.0-M6:test (default-test) @ okapi-core-ui ---
[INFO] Using auto detected provider org.apache.maven.surefire.junit4.JUnit4Provider
[INFO]
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running net.sf.okapi.common.ui.filters.ResponsiveTableFontMappingsTest
***WARNING: Display must be created on main thread due to Cocoa restrictions. Use vmarg -XstartOnFirstThread
***WARNING: Display must be created on main thread due to Cocoa restrictions. Use vmarg -XstartOnFirstThread
[ERROR] Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.455 s <<< FAILURE! - in net.sf.okapi.common.ui.filters.ResponsiveTableFontMappingsTest
[ERROR] net.sf.okapi.common.ui.filters.ResponsiveTableFontMappingsTest.constructed  Time elapsed: 0.424 s  <<< ERROR!
org.eclipse.swt.SWTException: Invalid thread access
at org.eclipse.swt.SWT.error(SWT.java:4918)
at org.eclipse.swt.SWT.error(SWT.java:4833)
at org.eclipse.swt.SWT.error(SWT.java:4804)
at org.eclipse.swt.widgets.Display.error(Display.java:1162)
at org.eclipse.swt.widgets.Display.createDisplay(Display.java:913)
at org.eclipse.swt.widgets.Display.create(Display.java:897)
at org.eclipse.swt.graphics.Device.<init>(Device.java:131)
at org.eclipse.swt.widgets.Display.<init>(Display.java:753)
at org.eclipse.swt.widgets.Display.<init>(Display.java:744)
at org.eclipse.swt.widgets.Display.getDefault(Display.java:1496)
at org.eclipse.swt.widgets.Shell.<init>(Shell.java:278)
at org.eclipse.swt.widgets.Shell.<init>(Shell.java:271)
at org.eclipse.swt.widgets.Shell.<init>(Shell.java:220)
at org.eclipse.swt.widgets.Shell.<init>(Shell.java:154)
at net.sf.okapi.common.ui.filters.ResponsiveTableFontMappingsTest.constructed(ResponsiveTableFontMappingsTest.java:47)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:377)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:284)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:248)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:167)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:456)
at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:169)
at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:595)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:581)

[ERROR] net.sf.okapi.common.ui.filters.ResponsiveTableFontMappingsTest.exposed  Time elapsed: 0.002 s  <<< ERROR!
org.eclipse.swt.SWTException: Invalid thread access
at org.eclipse.swt.SWT.error(SWT.java:4918)
at org.eclipse.swt.SWT.error(SWT.java:4833)
at org.eclipse.swt.SWT.error(SWT.java:4804)
at org.eclipse.swt.widgets.Display.error(Display.java:1162)
at org.eclipse.swt.widgets.Display.createDisplay(Display.java:913)
at org.eclipse.swt.widgets.Display.create(Display.java:897)
at org.eclipse.swt.graphics.Device.<init>(Device.java:131)
at org.eclipse.swt.widgets.Display.<init>(Display.java:753)
at org.eclipse.swt.widgets.Display.<init>(Display.java:744)
at org.eclipse.swt.widgets.Display.getDefault(Display.java:1496)
at org.eclipse.swt.widgets.Shell.<init>(Shell.java:278)
at org.eclipse.swt.widgets.Shell.<init>(Shell.java:271)
at org.eclipse.swt.widgets.Shell.<init>(Shell.java:220)
at org.eclipse.swt.widgets.Shell.<init>(Shell.java:154)
at net.sf.okapi.common.ui.filters.ResponsiveTableFontMappingsTest.exposed(ResponsiveTableFontMappingsTest.java:89)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:377)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:284)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:248)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:167)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:456)
at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:169)
at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:595)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:581)

[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR]   ResponsiveTableFontMappingsTest.constructed:47 » SWT Invalid thread access
[ERROR]   ResponsiveTableFontMappingsTest.exposed:89 » SWT Invalid thread access
[INFO]
[ERROR] Tests run: 2, Failures: 0, Errors: 2, Skipped: 0

jimbo

unread,
Aug 4, 2022, 11:58:18 AMAug 4
to okapi...@googlegroups.com, Mihai Nita

Mihai,

Even without the font mapping test wouldn't we get a runtime error in the application (Rainbow) when the font mapping is accessed? If that's true I think the tests are useful because at least we see an error during build vs runtime.

Jim

--
You received this message because you are subscribed to the Google Groups "okapi-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to okapi-devel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/okapi-devel/CAK69zbnuX9u5gd19fDR7q%2B6FxCTjxSsx4K96mJQiF7rfRZVfyQ%40mail.gmail.com.

Mihai Nita

unread,
Aug 7, 2022, 8:22:06 PMAug 7
to jimbo, Group: okapi-devel
I didn't have the time to see what the code does, so I was hoping that a short explanation would save me from digging :-)

What I did was:
    tikal.exe -e okf_openxml

And nothing there seemed to require testing.
There is no fancy font selection dialog, or something like that.
The dialog to add a new entry only asks for source/target locale patterns and source/target fonts.
I don't know if there is any validation.
I tried putting some random (invalid) stuff, and there was no complaint.

If the criteria is "runtime error in Rainbow / other apps", then we would have to do a lot more of this kind of testing...
But we never did until now.
I was asking because this seems to be a change in our "unwritten rules"

Might be useful, but it also gets in the way.
MacOS does not build anymore, and yesterday, trying to fix the build, I stumbled on it a lot
(for some reason in my docker SWT was complaining that it does not have handlers when running those tests)

Regards,
Mihai

jimbo

unread,
Aug 8, 2022, 12:03:21 PMAug 8
to Mihai Nita, Group: okapi-devel

Seems like disabling  (@Ignore) the test is the best way forward - not worth the hassle as you say.

Denis A. Konovalyenko

unread,
Aug 17, 2022, 5:39:37 PMAug 17
to okapi...@googlegroups.com

Hi Mihai,

Thank you for digging into this!

My initial intention was to make a test suite which would cover the main cases of new UI usage. And actually, I was wondering why there were no tests for the Core UI module at all... Could you please let me know what makes it different from other places in the code base and what are the "unwritten rules"?

I do not have macOS to try out the mentioned -XstartOnFirstThread option. Does it help to pass the tests or we have look for another solution?

Thanks again,

Denis
Reply all
Reply to author
Forward
0 new messages