Skip to content

Commit

Permalink
Add workaround to solve headless test failure on Windows OS
Browse files Browse the repository at this point in the history
For headless test task, 'prism.order' property is used to choose the
graph renderer to use. Currently, we specify this property to be 'sw'.

However, this property triggers a bug of openjdk-jfx with headless
mode [1]. This property will cause Java Runtime Error for Windows OS
including AppVeyor:

    # A fatal error has been detected by the Java Runtime Environment:
    #
    #  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffd95b64879, pid=1476, tid=2640
    #
    # JRE version: OpenJDK Runtime Environment (11.0.1+13) (build 11.0.1+13)
    # Java VM: OpenJDK 64-Bit Server VM (11.0.1+13, mixed mode, tiered, compressed oops, g1 gc, windows-amd64)
    # Problematic frame:
    # C  [javafx_font.dll+0x4879]

This bug has been identified and will be fixed in future release [2].
Let's use the workaround suggested [3] to solve the problem.

[1] javafxports/openjdk-jfx#66
[2] javafxports/openjdk-jfx#66 (comment)
[3] javafxports/openjdk-jfx#66 (comment)
  • Loading branch information
fzdy1914 committed Apr 2, 2019
1 parent 0603851 commit 3f5f10b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ dependencies {
implementation group: 'org.openjfx', name: 'javafx-web', version: javafxVersion, classifier: 'mac'
implementation group: 'org.openjfx', name: 'javafx-web', version: javafxVersion, classifier: 'linux'

implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.8.1'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.7.0'
implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: '2.7.4'

Expand Down
7 changes: 7 additions & 0 deletions src/test/java/seedu/address/ui/GuiUnitTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.Optional;

import org.apache.commons.lang3.SystemUtils;
import org.junit.Rule;

import guitests.GuiRobot;
Expand All @@ -18,6 +19,12 @@ public abstract class GuiUnitTest {

protected final GuiRobot guiRobot = new GuiRobot();

static {
if (SystemUtils.IS_OS_WINDOWS) {
System.load("C:\\Windows\\System32\\WindowsCodecs.dll");
}
}

/**
* Retrieves the {@code query} node owned by the {@code rootNode}.
*
Expand Down
7 changes: 7 additions & 0 deletions src/test/java/systemtests/SystemTestSetupHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.concurrent.TimeoutException;
import java.util.function.Supplier;

import org.apache.commons.lang3.SystemUtils;
import org.testfx.api.FxToolkit;

import guitests.guihandles.MainWindowHandle;
Expand All @@ -18,6 +19,12 @@ public class SystemTestSetupHelper {
private TestApp testApp;
private MainWindowHandle mainWindowHandle;

static {
if (SystemUtils.IS_OS_WINDOWS) {
System.load("C:\\Windows\\System32\\WindowsCodecs.dll");
}
}

/**
* Sets up a new {@code TestApp} and returns it.
*/
Expand Down

0 comments on commit 3f5f10b

Please sign in to comment.