Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfixes on tests and github actions runner for Windows #10196

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions .github/workflows/ant.yml

This file was deleted.

58 changes: 58 additions & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Arduino IDE unit test run

on:
push:
pull_request:

jobs:
test-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build with Ant
working-directory: ./build
run: ant clean build
- name: Install X virtual framebuffer
run: sudo apt-get install -y xvfb
- name: Run tests
working-directory: ./build
run: xvfb-run --auto-servernum --server-args "-screen 0 1024x768x24" ant test -Drunning-from-github-action=1
- name: Publish results
if: always()
cmaglie marked this conversation as resolved.
Show resolved Hide resolved
uses: actions/upload-artifact@v2
with:
name: html-results-linux
path: app/test-bin/results/html/
- name: Cleanup xvfb
uses: bcomnes/cleanup-xvfb@v1

test-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Download JDK 1.8 for Windows/x86
run: curl -O "https://cdn.azul.com/zulu/bin/zulu8.46.0.19-ca-jdk8.0.252-win_i686.zip"
- name: Set up JDK 1.8
uses: actions/setup-java@master
with:
version: 1.8
architecture: x86
jdkFile: ./zulu8.46.0.19-ca-jdk8.0.252-win_i686.zip
- name: Build with Ant
working-directory: ./build
run: |
java -version
ant clean build
- name: Run tests
working-directory: ./build
run: ant test -Drunning-from-github-action=1
- name: Publish results
if: always()
uses: actions/upload-artifact@v2
with:
name: html-results-win
path: app/test-bin/results/html/
12 changes: 7 additions & 5 deletions app/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,16 @@
<classpathentry kind="lib" path="lib/xml-apis-1.3.04.jar"/>
<classpathentry kind="lib" path="lib/xml-apis-ext-1.3.04.jar"/>
<classpathentry kind="lib" path="lib/xmlgraphics-commons-2.0.jar"/>
<classpathentry kind="lib" path="test-lib/junit-4.11.jar"/>
<classpathentry kind="lib" path="test-lib/fest-assert-1.2.jar"/>
<classpathentry kind="lib" path="test-lib/fest-reflect-1.2.jar"/>
<classpathentry kind="lib" path="test-lib/fest-swing-1.2.jar"/>
<classpathentry kind="lib" path="test-lib/fest-util-1.1.2.jar"/>
<classpathentry kind="lib" path="test-lib/jcip-annotations-1.0.jar"/>
<classpathentry kind="lib" path="lib/jtouchbar-1.0.0.jar"/>
<classpathentry kind="lib" path="lib/commons-lang3-3.8.1.jar"/>
<classpathentry kind="lib" path="lib/jssc-2.8.0-arduino4.jar"/>
<classpathentry kind="lib" path="test-lib/assertj-swing-junit-3.9.2.jar"/>
<classpathentry kind="lib" path="test-lib/assertj-core-1.7.1.jar"/>
<classpathentry kind="lib" path="test-lib/assertj-swing-1.2.0.jar"/>
<classpathentry kind="lib" path="test-lib/assertj-swing-junit-1.2.0.jar"/>
<classpathentry kind="lib" path="test-lib/assertj-swing-junit-4.5-1.2.0.jar"/>
<classpathentry kind="lib" path="test-lib/fest-util-1.2.5.jar"/>
<classpathentry kind="lib" path="test-lib/junit-4.5.jar"/>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to downgrade junit from 4.11 to 4.5. Is that intentional?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a forced dependency from assertj-swing-junit-4.5-1.2.0.jar, unfortunately I didn't found an assertj-swing-junit-4.11-1.2.0.jar.

Maybe it's ok to build with juint-4.11, but since it's not a critical dependency I've just downgraded it.

<classpathentry kind="output" path="bin"/>
</classpath>
5 changes: 2 additions & 3 deletions app/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
<fail message="Need single-test-class if single-test-methods is set" if="single-test-methods" unless="single-test-class"/>

<junit printsummary="yes" dir="${work.dir}" fork="true" showoutput="no" failureproperty="test.failed">
<jvmarg value="-Dlog4j.dir=."/>
<jvmarg value="-Djava.library.path=${java.additional.library.path}"/>
<jvmarg value="-DWORK_DIR=."/>
<jvmarg value="-ea"/>
Expand All @@ -135,10 +136,8 @@
</classpath>

<!-- Write XML files (for report-generation) and TXT files (for manual review) for every test class -->
<formatter type="plain" />
<formatter type="plain" usefile="false" /> <!-- to screen -->
<formatter type="xml"/>
<!-- Print full details to stdout when running a single test -->
<formatter type="plain" usefile="false" if="single-test-class"/>
<!-- When running all tests, print details for failing tests and a summary for each test class (printsummary=yes above) -->
<formatter type="brief" usefile="false" unless="single-test-class"/>

Expand Down
8 changes: 7 additions & 1 deletion app/src/processing/app/EditorConsole.java
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,13 @@ public void insertString(String str, SimpleAttributeSet attributes) throws BadLo
}

public String getText() {
return consoleTextPane.getText();
try {
return document.getText(0, document.getLength());
} catch (BadLocationException e) {
// Should never happen...
e.printStackTrace();
return "";
}
}

}
Binary file added app/test-lib/assertj-core-1.7.1.jar
Binary file not shown.
Binary file added app/test-lib/assertj-swing-1.2.0.jar
Binary file not shown.
Binary file added app/test-lib/assertj-swing-junit-1.2.0.jar
Binary file not shown.
Binary file added app/test-lib/assertj-swing-junit-3.9.2.jar
Binary file not shown.
Binary file added app/test-lib/assertj-swing-junit-4.5-1.2.0.jar
Binary file not shown.
Binary file removed app/test-lib/fest-assert-1.2.jar
Binary file not shown.
Binary file removed app/test-lib/fest-reflect-1.2.jar
Binary file not shown.
Binary file removed app/test-lib/fest-swing-1.2.jar
Binary file not shown.
Binary file removed app/test-lib/fest-util-1.1.2.jar
Binary file not shown.
Binary file added app/test-lib/fest-util-1.2.5.jar
Binary file not shown.
202 changes: 0 additions & 202 deletions app/test-lib/fest.LICENSE.ASL-2.0.txt

This file was deleted.

Binary file removed app/test-lib/junit-4.11.jar
Binary file not shown.
Binary file added app/test-lib/junit-4.5.jar
Binary file not shown.
1 change: 1 addition & 0 deletions app/test/cc/arduino/contributions/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package_index.json* -text
14 changes: 6 additions & 8 deletions app/test/processing/app/AbstractGUITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,15 @@

package processing.app;

import cc.arduino.files.DeleteFilesOnShutdown;
import org.fest.swing.edt.FailOnThreadViolationRepaintManager;
import org.fest.swing.edt.GuiActionRunner;
import org.fest.swing.edt.GuiQuery;
import javax.swing.JPopupMenu;

import org.assertj.swing.edt.FailOnThreadViolationRepaintManager;
import org.assertj.swing.edt.GuiActionRunner;
import org.assertj.swing.edt.GuiQuery;
import org.junit.After;
import org.junit.Before;
import processing.app.helpers.ArduinoFrameFixture;
import processing.app.helpers.FileUtils;

import javax.swing.*;
import java.util.Random;
import processing.app.helpers.ArduinoFrameFixture;

public abstract class AbstractGUITest extends AbstractWithPreferencesTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@

package processing.app;

import org.fest.swing.fixture.JMenuItemFixture;
import org.junit.Test;
import processing.app.helpers.SketchTextAreaFixture;

import static org.junit.Assert.assertEquals;

import org.assertj.swing.fixture.JMenuItemFixture;

public class AutoformatProducesOneUndoActionTest extends AbstractGUITest {

public static final String SOURCE_BEFORE = "void setup() {\n" +
Expand Down
Loading